From b37b3767f3c55a74bede78d11300249ab419a4c7 Mon Sep 17 00:00:00 2001 From: arkon Date: Wed, 21 Sep 2022 22:39:32 -0400 Subject: [PATCH] Minor cleanup Also add POST_NOTIFICATIONS permissions to make Android Studio stop complaining about it. --- app/src/main/AndroidManifest.xml | 2 + .../domain/track/service/TrackPreferences.kt | 15 ++++-- .../data/download/model/DownloadQueue.kt | 2 +- .../preference/EmptyPreferenceDataStore.kt | 48 ------------------- .../data/preference/PreferenceKeys.kt | 6 --- .../tachiyomi/extension/model/LoadResult.kt | 1 - .../ui/setting/SettingsTrackingController.kt | 5 +- 7 files changed, 16 insertions(+), 63 deletions(-) delete mode 100644 app/src/main/java/eu/kanade/tachiyomi/data/preference/EmptyPreferenceDataStore.kt diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 7d9c7049b..7c7b5653b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -21,6 +21,8 @@ + + = + private fun getActiveDownloads(): Observable = Observable.from(this).filter { download -> download.status == Download.State.DOWNLOADING } @Deprecated("Use getStatusAsFlow instead") diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/EmptyPreferenceDataStore.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/EmptyPreferenceDataStore.kt deleted file mode 100644 index 2f2081a27..000000000 --- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/EmptyPreferenceDataStore.kt +++ /dev/null @@ -1,48 +0,0 @@ -package eu.kanade.tachiyomi.data.preference - -import androidx.preference.PreferenceDataStore - -class EmptyPreferenceDataStore : PreferenceDataStore() { - - override fun getBoolean(key: String?, defValue: Boolean): Boolean { - return false - } - - override fun putBoolean(key: String?, value: Boolean) { - } - - override fun getInt(key: String?, defValue: Int): Int { - return 0 - } - - override fun putInt(key: String?, value: Int) { - } - - override fun getLong(key: String?, defValue: Long): Long { - return 0 - } - - override fun putLong(key: String?, value: Long) { - } - - override fun getFloat(key: String?, defValue: Float): Float { - return 0f - } - - override fun putFloat(key: String?, value: Float) { - } - - override fun getString(key: String?, defValue: String?): String? { - return null - } - - override fun putString(key: String?, value: String?) { - } - - override fun getStringSet(key: String?, defValues: Set?): Set? { - return null - } - - override fun putStringSet(key: String?, values: Set?) { - } -} diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt index 119941fc3..1325b44d6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt @@ -6,10 +6,4 @@ package eu.kanade.tachiyomi.data.preference object PreferenceKeys { const val dateFormat = "app_date_format" - - fun trackUsername(syncId: Long) = "pref_mangasync_username_$syncId" - - fun trackPassword(syncId: Long) = "pref_mangasync_password_$syncId" - - fun trackToken(syncId: Long) = "track_token_$syncId" } diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/model/LoadResult.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/model/LoadResult.kt index f1982b2f2..aa3c1359f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/model/LoadResult.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/model/LoadResult.kt @@ -1,7 +1,6 @@ package eu.kanade.tachiyomi.extension.model sealed class LoadResult { - class Success(val extension: Extension.Installed) : LoadResult() class Untrusted(val extension: Extension.Untrusted) : LoadResult() object Error : LoadResult() diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsTrackingController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsTrackingController.kt index 69f7e129f..d6af368c3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsTrackingController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsTrackingController.kt @@ -31,7 +31,6 @@ import eu.kanade.tachiyomi.util.system.openInBrowser import eu.kanade.tachiyomi.util.system.toast import eu.kanade.tachiyomi.widget.preference.TrackerPreference import uy.kohesive.injekt.injectLazy -import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys class SettingsTrackingController : SettingsController(), @@ -104,7 +103,7 @@ class SettingsTrackingController : ): TrackerPreference { return add( TrackerPreference(context).apply { - key = Keys.trackUsername(service.id) + key = TrackPreferences.trackUsername(service.id) titleRes = service.nameRes() iconRes = service.getLogo() iconColor = service.getLogoColor() @@ -148,7 +147,7 @@ class SettingsTrackingController : } private fun updatePreference(id: Long) { - val pref = findPreference(Keys.trackUsername(id)) as? TrackerPreference + val pref = findPreference(TrackPreferences.trackUsername(id)) as? TrackerPreference pref?.notifyChanged() }