aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/prefs/sections')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/BehaviourPrefs.kt10
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/CorePrefs.kt10
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/FeedPrefs.kt10
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/NotifPrefs.kt10
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/ShowcasePrefs.kt3
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/ThemePrefs.kt22
6 files changed, 22 insertions, 43 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/BehaviourPrefs.kt b/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/BehaviourPrefs.kt
index aa40c0d2..8842d988 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/BehaviourPrefs.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/BehaviourPrefs.kt
@@ -22,8 +22,6 @@ import com.pitchedapps.frost.BuildConfig
import com.pitchedapps.frost.prefs.OldPrefs
import com.pitchedapps.frost.prefs.PrefsBase
import javax.inject.Inject
-import org.koin.core.component.KoinComponent
-import org.koin.core.component.inject
interface BehaviourPrefs : PrefsBase {
var biometricsEnabled: Boolean
@@ -52,11 +50,9 @@ interface BehaviourPrefs : PrefsBase {
}
class BehaviourPrefsImpl @Inject internal constructor(
- factory: KPrefFactory
-) : KPref("${BuildConfig.APPLICATION_ID}.prefs.behaviour", factory),
- BehaviourPrefs, KoinComponent {
-
- private val oldPrefs: OldPrefs by inject()
+ factory: KPrefFactory,
+ oldPrefs: OldPrefs,
+) : KPref("${BuildConfig.APPLICATION_ID}.prefs.behaviour", factory), BehaviourPrefs {
override var biometricsEnabled: Boolean by kpref(
"biometrics_enabled",
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/CorePrefs.kt b/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/CorePrefs.kt
index 13fa5729..880a7225 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/CorePrefs.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/CorePrefs.kt
@@ -22,8 +22,6 @@ import com.pitchedapps.frost.BuildConfig
import com.pitchedapps.frost.prefs.OldPrefs
import com.pitchedapps.frost.prefs.PrefsBase
import javax.inject.Inject
-import org.koin.core.component.KoinComponent
-import org.koin.core.component.inject
interface CorePrefs : PrefsBase {
var lastLaunch: Long
@@ -58,11 +56,9 @@ interface CorePrefs : PrefsBase {
}
class CorePrefsImpl @Inject internal constructor(
- factory: KPrefFactory
-) : KPref("${BuildConfig.APPLICATION_ID}.prefs.core", factory),
- CorePrefs, KoinComponent {
-
- private val oldPrefs: OldPrefs by inject()
+ factory: KPrefFactory,
+ oldPrefs: OldPrefs,
+) : KPref("${BuildConfig.APPLICATION_ID}.prefs.core", factory), CorePrefs {
override var lastLaunch: Long by kpref("last_launch", oldPrefs.lastLaunch /* -1L */)
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/FeedPrefs.kt b/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/FeedPrefs.kt
index 17e3bfac..00df9743 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/FeedPrefs.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/FeedPrefs.kt
@@ -23,8 +23,6 @@ import com.pitchedapps.frost.enums.MainActivityLayout
import com.pitchedapps.frost.prefs.OldPrefs
import com.pitchedapps.frost.prefs.PrefsBase
import javax.inject.Inject
-import org.koin.core.component.KoinComponent
-import org.koin.core.component.inject
interface FeedPrefs : PrefsBase {
var webTextScaling: Int
@@ -53,11 +51,9 @@ interface FeedPrefs : PrefsBase {
}
class FeedPrefsImpl @Inject internal constructor(
- factory: KPrefFactory
-) : KPref("${BuildConfig.APPLICATION_ID}.prefs.feed", factory),
- FeedPrefs, KoinComponent {
-
- private val oldPrefs: OldPrefs by inject()
+ factory: KPrefFactory,
+ oldPrefs: OldPrefs
+) : KPref("${BuildConfig.APPLICATION_ID}.prefs.feed", factory), FeedPrefs {
override var webTextScaling: Int by kpref("web_text_scaling", oldPrefs.webTextScaling /* 100 */)
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/NotifPrefs.kt b/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/NotifPrefs.kt
index c33cd92e..5e34c105 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/NotifPrefs.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/NotifPrefs.kt
@@ -22,8 +22,6 @@ import com.pitchedapps.frost.BuildConfig
import com.pitchedapps.frost.prefs.OldPrefs
import com.pitchedapps.frost.prefs.PrefsBase
import javax.inject.Inject
-import org.koin.core.component.KoinComponent
-import org.koin.core.component.inject
interface NotifPrefs : PrefsBase {
var notificationKeywords: Set<String>
@@ -50,11 +48,9 @@ interface NotifPrefs : PrefsBase {
}
class NotifPrefsImpl @Inject internal constructor(
- factory: KPrefFactory
-) : KPref("${BuildConfig.APPLICATION_ID}.prefs.notif", factory),
- NotifPrefs, KoinComponent {
-
- private val oldPrefs: OldPrefs by inject()
+ factory: KPrefFactory,
+ oldPrefs: OldPrefs,
+) : KPref("${BuildConfig.APPLICATION_ID}.prefs.notif", factory), NotifPrefs {
override var notificationKeywords: Set<String> by kpref(
"notification_keywords",
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/ShowcasePrefs.kt b/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/ShowcasePrefs.kt
index d8a51e32..dce8b898 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/ShowcasePrefs.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/ShowcasePrefs.kt
@@ -38,8 +38,7 @@ interface ShowcasePrefs : PrefsBase {
*/
class ShowcasePrefsImpl @Inject internal constructor(
factory: KPrefFactory
-) : KPref("${BuildConfig.APPLICATION_ID}.showcase", factory),
- ShowcasePrefs {
+) : KPref("${BuildConfig.APPLICATION_ID}.showcase", factory), ShowcasePrefs {
override val firstWebOverlay: Boolean by kprefSingle("first_web_overlay")
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/ThemePrefs.kt b/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/ThemePrefs.kt
index 126c3654..b024b2d3 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/ThemePrefs.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/ThemePrefs.kt
@@ -19,12 +19,9 @@ package com.pitchedapps.frost.prefs.sections
import ca.allanwang.kau.kpref.KPref
import ca.allanwang.kau.kpref.KPrefFactory
import com.pitchedapps.frost.BuildConfig
-import com.pitchedapps.frost.injectors.ThemeProvider
import com.pitchedapps.frost.prefs.OldPrefs
import com.pitchedapps.frost.prefs.PrefsBase
import javax.inject.Inject
-import org.koin.core.component.KoinComponent
-import org.koin.core.component.inject
interface ThemePrefs : PrefsBase {
var theme: Int
@@ -43,16 +40,15 @@ interface ThemePrefs : PrefsBase {
}
class ThemePrefsImpl @Inject internal constructor(
- factory: KPrefFactory
-) : KPref("${BuildConfig.APPLICATION_ID}.prefs.theme", factory),
- ThemePrefs, KoinComponent {
-
- private val oldPrefs: OldPrefs by inject()
- private val themeProvider: ThemeProvider by inject()
-
- override var theme: Int by kpref("theme", oldPrefs.theme /* 0 */) {
- themeProvider.setTheme(it)
- }
+ factory: KPrefFactory,
+ oldPrefs: OldPrefs,
+) : KPref("${BuildConfig.APPLICATION_ID}.prefs.theme", factory), ThemePrefs {
+
+ /**
+ * Note that this is purely for the pref storage. Updating themes should use
+ * ThemeProvider
+ */
+ override var theme: Int by kpref("theme", oldPrefs.theme /* 0 */)
override var customTextColor: Int by kpref(
"color_text",