diff --git a/app/src/main/java/eu/faircode/email/ActivityView.java b/app/src/main/java/eu/faircode/email/ActivityView.java index 573be64593..5ae92dd93b 100644 --- a/app/src/main/java/eu/faircode/email/ActivityView.java +++ b/app/src/main/java/eu/faircode/email/ActivityView.java @@ -253,7 +253,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB onShowLog(); break; case R.string.menu_setup: - onReload(); + onReset(); break; case R.string.menu_faq: onDebugInfo(); @@ -1068,8 +1068,8 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB Helper.view(this, this, getIntentOtherApps()); } - private void onReload() { - ServiceSynchronize.reload(this, "manual reload"); + private void onReset() { + ServiceSynchronize.reset(this); } private void onDebugInfo() { diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index 3e22f04913..c081bf0b34 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -204,6 +204,11 @@ public class ServiceSynchronize extends LifecycleService { onReload(intent.getStringExtra("reason")); break; + case "reset": + lastLost = 0; + onReload("reset"); + break; + case "oneshot_start": onOneshot(true); break; @@ -1277,6 +1282,12 @@ public class ServiceSynchronize extends LifecycleService { .putExtra("reason", reason)); } + static void reset(Context context) { + ContextCompat.startForegroundService(context, + new Intent(context, ServiceSynchronize.class) + .setAction("reset")); + } + static void process(Context context) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); boolean enabled = prefs.getBoolean("enabled", true);