From 1a9379489298e43ea8736c1c5f64dbc8e2c242bf Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 24 Feb 2021 15:58:53 +0100 Subject: [PATCH] Fixed "badge" settings update --- .../eu/faircode/email/FragmentOptionsNotifications.java | 2 ++ app/src/main/java/eu/faircode/email/ServiceSynchronize.java | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java b/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java index c78a71ad5f..09917306bb 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java @@ -331,6 +331,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { prefs.edit().putBoolean("badge", checked).apply(); + ServiceSynchronize.restart(compoundButton.getContext()); } }); @@ -338,6 +339,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { prefs.edit().putBoolean("unseen_ignored", checked).apply(); + ServiceSynchronize.restart(compoundButton.getContext()); } }); diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index 23cb5d2669..751c0dc351 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -145,7 +145,6 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences "sync_folders", "sync_shared_folders", "prefer_ip4", "standalone_vpn", "tcp_keep_alive", "ssl_harden", // force reconnect - "badge", "unseen_ignored", // force update badge/widget "experiments", "debug", "protocol", // force reconnect "auth_plain", "auth_login", "auth_ntlm", "auth_sasl" // force reconnect )); @@ -2408,6 +2407,11 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences .setAction("watchdog")); } + static void restart(Context context) { + context.stopService(new Intent(context, ServiceSynchronize.class)); + eval(context, "restart"); + } + private static void start(Context context, Intent intent) { if (isBackgroundService(context)) context.startService(intent);