From 430b18e77b9eed6d525daa6982acaf5c74ad4a8d Mon Sep 17 00:00:00 2001 From: Matthew Crossman Date: Tue, 4 Jan 2022 21:44:24 +1100 Subject: [PATCH] Rename auto install preference to better reflect behaviour. Auto install preference always runs after a sync, even if it's manual. The names of the preference & strings have been updated to reflect this new behaviour. --- src/main/kotlin/com/looker/droidify/content/Preferences.kt | 4 ++-- .../kotlin/com/looker/droidify/screen/SettingsFragment.kt | 4 ++-- src/main/kotlin/com/looker/droidify/service/SyncService.kt | 4 ++-- src/main/res/values/strings.xml | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/kotlin/com/looker/droidify/content/Preferences.kt b/src/main/kotlin/com/looker/droidify/content/Preferences.kt index cbc7dcfa..6eec3171 100644 --- a/src/main/kotlin/com/looker/droidify/content/Preferences.kt +++ b/src/main/kotlin/com/looker/droidify/content/Preferences.kt @@ -24,7 +24,7 @@ object Preferences { private val keys = sequenceOf( Key.Language, Key.AutoSync, - Key.AutoSyncInstall, + Key.InstallAfterSync, Key.IncompatibleVersions, Key.ListAnimation, Key.ProxyHost, @@ -131,7 +131,7 @@ object Preferences { "auto_sync", Value.EnumerationValue(Preferences.AutoSync.Wifi) ) - object AutoSyncInstall : + object InstallAfterSync : Key("auto_sync_install", Value.BooleanValue(Android.sdk(31))) object IncompatibleVersions : diff --git a/src/main/kotlin/com/looker/droidify/screen/SettingsFragment.kt b/src/main/kotlin/com/looker/droidify/screen/SettingsFragment.kt index 9d636faa..92c1d8e0 100644 --- a/src/main/kotlin/com/looker/droidify/screen/SettingsFragment.kt +++ b/src/main/kotlin/com/looker/droidify/screen/SettingsFragment.kt @@ -109,8 +109,8 @@ class SettingsFragment : ScreenFragment() { } } addSwitch( - Preferences.Key.AutoSyncInstall, getString(R.string.sync_auto_install), - getString(R.string.sync_auto_install_summary) + Preferences.Key.InstallAfterSync, getString(R.string.install_after_sync), + getString(R.string.install_after_sync_summary) ) addSwitch( Preferences.Key.UpdateNotify, getString(R.string.notify_about_updates), diff --git a/src/main/kotlin/com/looker/droidify/service/SyncService.kt b/src/main/kotlin/com/looker/droidify/service/SyncService.kt index 4d000c05..57a4f451 100644 --- a/src/main/kotlin/com/looker/droidify/service/SyncService.kt +++ b/src/main/kotlin/com/looker/droidify/service/SyncService.kt @@ -403,7 +403,7 @@ class SyncService : ConnectionService() { currentTask = null handleNextTask(false) if (result.isNotEmpty()) { - if (Preferences[Preferences.Key.AutoSyncInstall]) + if (Preferences[Preferences.Key.InstallAfterSync]) runAutoUpdate(result) if (hasUpdates && Preferences[Preferences.Key.UpdateNotify] && updateNotificationBlockerFragment?.get()?.isAdded == true @@ -434,7 +434,7 @@ class SyncService : ConnectionService() { * @see SyncService.displayUpdatesNotification */ private fun runAutoUpdate(productItems: List) { - if (Preferences[Preferences.Key.AutoSyncInstall]) { + if (Preferences[Preferences.Key.InstallAfterSync]) { // run startUpdate on every item productItems.map { productItem -> Pair( diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 9fd2399a..0a8d7b5a 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -180,6 +180,6 @@ Installed applications Sort & Filter New applications - Install updates automatically - Automatically install app updates after syncing repositories + Install updates automatically + Automatically install app updates after syncing repositories