From 755d47a247e05fb9d3a2c0a936deae4ce49cc30e Mon Sep 17 00:00:00 2001 From: cketti Date: Sun, 1 Dec 2019 18:30:26 +0100 Subject: [PATCH 1/2] Disable sync notifications by default Also remove the option to configure the sync notification during account setup. --- .../main/java/com/fsck/k9/AccountPreferenceSerializer.kt | 2 +- .../com/fsck/k9/activity/setup/AccountSetupOptions.java | 4 ---- app/ui/src/main/res/layout/account_setup_options.xml | 8 -------- 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/app/core/src/main/java/com/fsck/k9/AccountPreferenceSerializer.kt b/app/core/src/main/java/com/fsck/k9/AccountPreferenceSerializer.kt index d616720c3..4856cbafa 100644 --- a/app/core/src/main/java/com/fsck/k9/AccountPreferenceSerializer.kt +++ b/app/core/src/main/java/com/fsck/k9/AccountPreferenceSerializer.kt @@ -513,7 +513,7 @@ class AccountPreferenceSerializer( accountNumber = UNASSIGNED_ACCOUNT_NUMBER isNotifyNewMail = true folderNotifyNewMailMode = FolderMode.ALL - isNotifySync = true + isNotifySync = false isNotifySelfNewMail = true isNotifyContactsMailOnly = false folderDisplayMode = FolderMode.NOT_SECOND_CLASS diff --git a/app/ui/src/main/java/com/fsck/k9/activity/setup/AccountSetupOptions.java b/app/ui/src/main/java/com/fsck/k9/activity/setup/AccountSetupOptions.java index 1eba2b11c..7dd5149b4 100644 --- a/app/ui/src/main/java/com/fsck/k9/activity/setup/AccountSetupOptions.java +++ b/app/ui/src/main/java/com/fsck/k9/activity/setup/AccountSetupOptions.java @@ -29,7 +29,6 @@ public class AccountSetupOptions extends K9Activity implements OnClickListener { private CheckBox mNotifyView; - private CheckBox mNotifySyncView; private Account mAccount; @@ -48,7 +47,6 @@ public class AccountSetupOptions extends K9Activity implements OnClickListener { mCheckFrequencyView = findViewById(R.id.account_check_frequency); mDisplayCountView = findViewById(R.id.account_display_count); mNotifyView = findViewById(R.id.account_notify); - mNotifySyncView = findViewById(R.id.account_notify_sync); findViewById(R.id.next).setOnClickListener(this); @@ -99,7 +97,6 @@ public class AccountSetupOptions extends K9Activity implements OnClickListener { mAccount = Preferences.getPreferences(this).getAccount(accountUuid); mNotifyView.setChecked(mAccount.isNotifyNewMail()); - mNotifySyncView.setChecked(mAccount.isNotifySync()); SpinnerOption.setSpinnerOptionValue(mCheckFrequencyView, mAccount .getAutomaticCheckIntervalMinutes()); SpinnerOption.setSpinnerOptionValue(mDisplayCountView, mAccount @@ -109,7 +106,6 @@ public class AccountSetupOptions extends K9Activity implements OnClickListener { private void onDone() { mAccount.setDescription(mAccount.getEmail()); mAccount.setNotifyNewMail(mNotifyView.isChecked()); - mAccount.setNotifySync(mNotifySyncView.isChecked()); mAccount.setAutomaticCheckIntervalMinutes((Integer)((SpinnerOption)mCheckFrequencyView .getSelectedItem()).value); mAccount.setDisplayCount((Integer)((SpinnerOption)mDisplayCountView diff --git a/app/ui/src/main/res/layout/account_setup_options.xml b/app/ui/src/main/res/layout/account_setup_options.xml index 0eafecd5b..3e51349b7 100644 --- a/app/ui/src/main/res/layout/account_setup_options.xml +++ b/app/ui/src/main/res/layout/account_setup_options.xml @@ -55,14 +55,6 @@ android:text="@string/account_setup_options_notify_label" android:textColor="?android:attr/textColorPrimary" /> - - Date: Sun, 1 Dec 2019 18:37:51 +0100 Subject: [PATCH 2/2] Change default sync interval to 1 hour --- app/core/src/main/java/com/fsck/k9/Account.java | 1 + .../main/java/com/fsck/k9/AccountPreferenceSerializer.kt | 6 +++--- .../main/java/com/fsck/k9/preferences/AccountSettings.java | 3 ++- .../src/main/java/com/fsck/k9/preferences/Settings.java | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/core/src/main/java/com/fsck/k9/Account.java b/app/core/src/main/java/com/fsck/k9/Account.java index f2b7182aa..8b00724da 100644 --- a/app/core/src/main/java/com/fsck/k9/Account.java +++ b/app/core/src/main/java/com/fsck/k9/Account.java @@ -111,6 +111,7 @@ public class Account implements BaseAccount, StoreConfig { public static final int UNASSIGNED_ACCOUNT_NUMBER = -1; public static final int INTERVAL_MINUTES_NEVER = -1; + public static final int DEFAULT_SYNC_INTERVAL = 60; private DeletePolicy deletePolicy = DeletePolicy.NEVER; diff --git a/app/core/src/main/java/com/fsck/k9/AccountPreferenceSerializer.kt b/app/core/src/main/java/com/fsck/k9/AccountPreferenceSerializer.kt index 4856cbafa..2f87291a9 100644 --- a/app/core/src/main/java/com/fsck/k9/AccountPreferenceSerializer.kt +++ b/app/core/src/main/java/com/fsck/k9/AccountPreferenceSerializer.kt @@ -2,11 +2,11 @@ package com.fsck.k9 import com.fsck.k9.Account.DEFAULT_SORT_ASCENDING import com.fsck.k9.Account.DEFAULT_SORT_TYPE +import com.fsck.k9.Account.DEFAULT_SYNC_INTERVAL import com.fsck.k9.Account.DeletePolicy import com.fsck.k9.Account.Expunge import com.fsck.k9.Account.FolderMode import com.fsck.k9.Account.INBOX -import com.fsck.k9.Account.INTERVAL_MINUTES_NEVER import com.fsck.k9.Account.MessageFormat import com.fsck.k9.Account.NO_OPENPGP_KEY import com.fsck.k9.Account.QuoteStyle @@ -37,7 +37,7 @@ class AccountPreferenceSerializer( transportUri = Base64.decode(storage.getString("$accountUuid.transportUri", null)) description = storage.getString("$accountUuid.description", null) alwaysBcc = storage.getString("$accountUuid.alwaysBcc", alwaysBcc) - automaticCheckIntervalMinutes = storage.getInt("$accountUuid.automaticCheckIntervalMinutes", INTERVAL_MINUTES_NEVER) + automaticCheckIntervalMinutes = storage.getInt("$accountUuid.automaticCheckIntervalMinutes", DEFAULT_SYNC_INTERVAL) idleRefreshMinutes = storage.getInt("$accountUuid.idleRefreshMinutes", 24) isPushPollOnConnect = storage.getBoolean("$accountUuid.pushPollOnConnect", true) displayCount = storage.getInt("$accountUuid.displayCount", K9.DEFAULT_VISIBLE_LIMIT) @@ -506,7 +506,7 @@ class AccountPreferenceSerializer( fun loadDefaults(account: Account) { with(account) { localStorageProviderId = storageManager.defaultProviderId - automaticCheckIntervalMinutes = INTERVAL_MINUTES_NEVER + automaticCheckIntervalMinutes = DEFAULT_SYNC_INTERVAL idleRefreshMinutes = 24 isPushPollOnConnect = true displayCount = K9.DEFAULT_VISIBLE_LIMIT diff --git a/app/core/src/main/java/com/fsck/k9/preferences/AccountSettings.java b/app/core/src/main/java/com/fsck/k9/preferences/AccountSettings.java index a1165045e..7ff622d74 100644 --- a/app/core/src/main/java/com/fsck/k9/preferences/AccountSettings.java +++ b/app/core/src/main/java/com/fsck/k9/preferences/AccountSettings.java @@ -63,7 +63,8 @@ public class AccountSettings { new V(1, new StringSetting("INBOX")) )); s.put("automaticCheckIntervalMinutes", Settings.versions( - new V(1, new IntegerResourceSetting(-1, R.array.check_frequency_values)) + new V(1, new IntegerResourceSetting(-1, R.array.check_frequency_values)), + new V(61, new IntegerResourceSetting(60, R.array.check_frequency_values)) )); s.put("chipColor", Settings.versions( new V(1, new ColorSetting(0xFF0000FF)) diff --git a/app/core/src/main/java/com/fsck/k9/preferences/Settings.java b/app/core/src/main/java/com/fsck/k9/preferences/Settings.java index 2313793f8..860a907c5 100644 --- a/app/core/src/main/java/com/fsck/k9/preferences/Settings.java +++ b/app/core/src/main/java/com/fsck/k9/preferences/Settings.java @@ -36,7 +36,7 @@ public class Settings { * * @see SettingsExporter */ - public static final int VERSION = 60; + public static final int VERSION = 61; static Map validate(int version, Map> settings, Map importedSettings, boolean useDefaultValues) {