Resync has_enabled_account setting after delete and on start
This commit is contained in:
parent
3205d763cf
commit
8f0cd86090
|
@ -923,11 +923,13 @@ public class XmppConnectionService extends Service {
|
||||||
this.databaseBackend = DatabaseBackend.getInstance(getApplicationContext());
|
this.databaseBackend = DatabaseBackend.getInstance(getApplicationContext());
|
||||||
Log.d(Config.LOGTAG, "restoring accounts...");
|
Log.d(Config.LOGTAG, "restoring accounts...");
|
||||||
this.accounts = databaseBackend.getAccounts();
|
this.accounts = databaseBackend.getAccounts();
|
||||||
|
final SharedPreferences.Editor editor = getPreferences().edit();
|
||||||
if (this.accounts.size() == 0 && Arrays.asList("Sony", "Sony Ericsson").contains(Build.MANUFACTURER)) {
|
if (this.accounts.size() == 0 && Arrays.asList("Sony", "Sony Ericsson").contains(Build.MANUFACTURER)) {
|
||||||
getPreferences().edit().putBoolean(SettingsActivity.KEEP_FOREGROUND_SERVICE,true).commit();
|
editor.putBoolean(SettingsActivity.KEEP_FOREGROUND_SERVICE, true);
|
||||||
Log.d(Config.LOGTAG, Build.MANUFACTURER + " is on blacklist. enabling foreground service");
|
Log.d(Config.LOGTAG, Build.MANUFACTURER + " is on blacklist. enabling foreground service");
|
||||||
}
|
}
|
||||||
|
editor.putBoolean(EventReceiver.SETTING_ENABLED_ACCOUNTS, hasEnabledAccounts()).apply();
|
||||||
|
editor.apply();
|
||||||
|
|
||||||
restoreFromDatabase();
|
restoreFromDatabase();
|
||||||
|
|
||||||
|
@ -939,7 +941,7 @@ public class XmppConnectionService extends Service {
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
if (Config.supportOpenPgp()) {
|
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
|
@Override
|
||||||
public void onBound(IOpenPgpService2 service) {
|
public void onBound(IOpenPgpService2 service) {
|
||||||
for (Account account : accounts) {
|
for (Account account : accounts) {
|
||||||
|
@ -1884,6 +1886,7 @@ public class XmppConnectionService extends Service {
|
||||||
this.accounts.remove(account);
|
this.accounts.remove(account);
|
||||||
updateAccountUi();
|
updateAccountUi();
|
||||||
getNotificationService().updateErrorNotification();
|
getNotificationService().updateErrorNotification();
|
||||||
|
syncEnabledAccountSetting();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3925,6 +3928,7 @@ public class XmppConnectionService extends Service {
|
||||||
|
|
||||||
public interface OnMamPreferencesFetched {
|
public interface OnMamPreferencesFetched {
|
||||||
void onPreferencesFetched(Element prefs);
|
void onPreferencesFetched(Element prefs);
|
||||||
|
|
||||||
void onPreferencesFetchFailed();
|
void onPreferencesFetchFailed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue