Run compose/service when dirty only

pull/187/head
M66B 5 years ago
parent 7e4e03f282
commit 75480a6f42

@ -4256,6 +4256,7 @@ public class FragmentCompose extends FragmentBase {
boolean notext = args.getBoolean("notext"); boolean notext = args.getBoolean("notext");
Bundle extras = args.getBundle("extras"); Bundle extras = args.getBundle("extras");
boolean dirty = false;
EntityMessage draft; EntityMessage draft;
DB db = DB.getInstance(context); DB db = DB.getInstance(context);
@ -4274,6 +4275,7 @@ public class FragmentCompose extends FragmentBase {
Log.i("Load action id=" + draft.id + " action=" + getActionName(action)); Log.i("Load action id=" + draft.id + " action=" + getActionName(action));
if (action == R.id.action_delete) { if (action == R.id.action_delete) {
dirty = true;
boolean discard_delete = prefs.getBoolean("discard_delete", false); boolean discard_delete = prefs.getBoolean("discard_delete", false);
EntityFolder trash = db.folder().getFolderByType(draft.account, EntityFolder.TRASH); EntityFolder trash = db.folder().getFolderByType(draft.account, EntityFolder.TRASH);
if (empty || trash == null || discard_delete) if (empty || trash == null || discard_delete)
@ -4289,8 +4291,6 @@ public class FragmentCompose extends FragmentBase {
} }
}); });
} else { } else {
boolean dirty = false;
// Move draft to new account // Move draft to new account
if (draft.account != aid && aid >= 0) { if (draft.account != aid && aid >= 0) {
Log.i("Account changed"); Log.i("Account changed");
@ -4777,6 +4777,7 @@ public class FragmentCompose extends FragmentBase {
db.endTransaction(); db.endTransaction();
} }
if (dirty)
ServiceSynchronize.eval(context, "compose/action"); ServiceSynchronize.eval(context, "compose/action");
if (action == R.id.action_send) if (action == R.id.action_send)

Loading…
Cancel
Save