aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-10-29 20:15:17 +0100
committerChristian Schneppe <christian@pix-art.de>2017-10-29 20:15:17 +0100
commitf753c750d7f6be0ce72b8b4cf5cbdf8d68b9f3ca (patch)
tree6ca4845f063d5bdc7c94993e99756e26d5b45d53 /src/main
parentffd5bb0176821664e9d7ab2ea5559e17a8ace3a0 (diff)
Resync has_enabled_account setting after delete and on start
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index 8293d39f0..93b8b0d15 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -1031,11 +1031,13 @@ public class XmppConnectionService extends Service {
Log.d(Config.LOGTAG, "number of restarts exceeds threshold.");
}
- if (this.accounts.size() == 0 && Arrays.asList("Sony","Sony Ericsson").contains(Build.MANUFACTURER)) {
- getPreferences().edit().putBoolean(SettingsActivity.SHOW_FOREGROUND_SERVICE, true).commit();
+ final SharedPreferences.Editor editor = getPreferences().edit();
+ if (this.accounts.size() == 0 && Arrays.asList("Sony", "Sony Ericsson").contains(Build.MANUFACTURER)) {
+ editor.putBoolean(SettingsActivity.SHOW_FOREGROUND_SERVICE, true);
Log.d(Config.LOGTAG, Build.MANUFACTURER + " is on blacklist. enabling foreground service");
}
-
+ editor.putBoolean(EventReceiver.SETTING_ENABLED_ACCOUNTS, hasEnabledAccounts()).apply();
+ editor.apply();
restoreFromDatabase();
getContentResolver().registerContentObserver(ContactsContract.Contacts.CONTENT_URI, true, contactObserver);
@@ -1046,7 +1048,7 @@ public class XmppConnectionService extends Service {
}
}).start();
if (Config.supportOpenPgp()) {
- this.pgpServiceConnection = new OpenPgpServiceConnection(getApplicationContext(), "org.sufficientlysecure.keychain", new OpenPgpServiceConnection.OnBound() {
+ this.pgpServiceConnection = new OpenPgpServiceConnection(this, "org.sufficientlysecure.keychain", new OpenPgpServiceConnection.OnBound() {
@Override
public void onBound(IOpenPgpService2 service) {
for (Account account : accounts) {
@@ -2058,6 +2060,7 @@ public class XmppConnectionService extends Service {
this.accounts.remove(account);
updateAccountUi();
getNotificationService().updateErrorNotification();
+ syncEnabledAccountSetting();
}
}