#1168 Enable background synchronization by default

This commit is contained in:
Stefan Niedermann 2021-05-10 14:36:18 +02:00
parent ecff7bb0e7
commit d508552b93
3 changed files with 5 additions and 6 deletions

View file

@ -102,15 +102,14 @@ public class ImportAccountActivity extends AppCompatActivity {
*/
@Override
public void onSuccess(Account account) {
Context context = getApplicationContext();
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
SyncWorker.update(context, sharedPreferences.getBoolean(context.getString(R.string.pref_key_background_sync), true));
runOnUiThread(() -> {
Log.i(TAG, capabilities.toString());
BrandingUtil.saveBrandColors(ImportAccountActivity.this, capabilities.getColor(), capabilities.getTextColor());
setResult(RESULT_OK);
finish();
});
SyncWorker.update(ImportAccountActivity.this, PreferenceManager.getDefaultSharedPreferences(ImportAccountActivity.this)
.getBoolean(getString(R.string.pref_key_background_sync), true));
}
@Override

View file

@ -28,11 +28,10 @@ public class Migration_21_22 extends Migration {
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
SharedPreferences.Editor editor = sharedPreferences.edit();
if (sharedPreferences.contains("backgroundSync")) {
editor.remove("backgroundSync");
if (sharedPreferences.getString("backgroundSync", "").equals("off")) {
editor.remove("backgroundSync");
editor.putBoolean("backgroundSync", false);
} else {
editor.remove("backgroundSync");
editor.putBoolean("backgroundSync", true);
SyncWorker.update(context, true);
}

View file

@ -1,3 +1,4 @@
- 🌐 Enhanced linkifying - by @Cui-Yusong
- ⚙️ Use Retrofit for API calls (#1167)
- ⚙ Switched based for markdown rendering in widgets
- ⚙ Switched based for markdown rendering in widgets
- ⚙ Enable background synchronization by default (#1168) - by @MasterWanna