Clear rules with transaction

pull/184/head
M66B 4 years ago
parent fb2347c8c0
commit f1627e758b

@ -456,12 +456,12 @@ public class FragmentRules extends FragmentBase {
boolean all = args.getBoolean("all"); boolean all = args.getBoolean("all");
DB db = DB.getInstance(context); DB db = DB.getInstance(context);
try {
db.beginTransaction();
if (all) { if (all)
db.rule().deleteRules(fid); db.rule().deleteRules(fid);
return null; else {
}
EntityFolder folder = db.folder().getFolder(fid); EntityFolder folder = db.folder().getFolder(fid);
if (folder == null) if (folder == null)
return null; return null;
@ -481,6 +481,12 @@ public class FragmentRules extends FragmentBase {
if (type == TYPE_MOVE && target == junk.id) if (type == TYPE_MOVE && target == junk.id)
db.rule().deleteRule(rule.id); db.rule().deleteRule(rule.id);
} }
}
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
return null; return null;
} }

Loading…
Cancel
Save