Fixed "badge" settings update

This commit is contained in:
M66B 2021-02-24 15:58:53 +01:00
parent 60b33adb22
commit 1a93794892
2 changed files with 7 additions and 1 deletions

View File

@ -331,6 +331,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
@Override @Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("badge", checked).apply(); prefs.edit().putBoolean("badge", checked).apply();
ServiceSynchronize.restart(compoundButton.getContext());
} }
}); });
@ -338,6 +339,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
@Override @Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("unseen_ignored", checked).apply(); prefs.edit().putBoolean("unseen_ignored", checked).apply();
ServiceSynchronize.restart(compoundButton.getContext());
} }
}); });

View File

@ -145,7 +145,6 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
"sync_folders", "sync_folders",
"sync_shared_folders", "sync_shared_folders",
"prefer_ip4", "standalone_vpn", "tcp_keep_alive", "ssl_harden", // force reconnect "prefer_ip4", "standalone_vpn", "tcp_keep_alive", "ssl_harden", // force reconnect
"badge", "unseen_ignored", // force update badge/widget
"experiments", "debug", "protocol", // force reconnect "experiments", "debug", "protocol", // force reconnect
"auth_plain", "auth_login", "auth_ntlm", "auth_sasl" // 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")); .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) { private static void start(Context context, Intent intent) {
if (isBackgroundService(context)) if (isBackgroundService(context))
context.startService(intent); context.startService(intent);