profile delete bug fixed

This commit is contained in:
jens 2022-02-28 13:46:18 +01:00
parent e719114166
commit 4c9e61618b
2 changed files with 6 additions and 17 deletions

View File

@ -458,29 +458,17 @@ public class Profile implements Comparable<Profile>
public boolean delete(Context context)
{
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.profileActive))
Rule usingRule = this.isInUseByRules();
if(usingRule != null)
{
for (Rule rule : Rule.findRuleCandidatesByTriggerProfile(this))
{
Toast.makeText(context, String.format(context.getResources().getString(R.string.ruleXIsUsingProfileY), rule.getName(), this.getName()), Toast.LENGTH_LONG).show();
return false;
}
}
else if(Rule.isAnyRuleUsing(Action_Enum.changeSoundProfile))
{
for (Rule rule : Rule.findRuleCandidatesByActionProfile(this))
{
Toast.makeText(context, String.format(context.getResources().getString(R.string.ruleXIsUsingProfileY), rule.getName(), this.getName()), Toast.LENGTH_LONG).show();
return false;
}
Toast.makeText(context, String.format(context.getResources().getString(R.string.ruleXIsUsingProfileY), usingRule.getName(), this.getName()), Toast.LENGTH_LONG).show();
return false;
}
else
{
profileCollection.remove(this);
return XmlFileInterface.writeFile();
}
return false;
}
private boolean plausibilityCheck()

View File

@ -6,4 +6,5 @@
* Fixed: Variables were not replaced when sending text messages
* Fixed: Service wouldn't always start after device has been powered on
* Fixed: Set ringtones on Android 11 and above
* Fixed: Permission read storage required for changing ringtones
* Fixed: Permission read storage required for changing ringtones
* Fixed: Profile that were not in use, could not be deleted.