[DO NOT USE] Migrate to datastore backend

This commit is contained in:
tarsin committed 2023-06-05 12:24:08 +08:00
1 parent 3664ca846c
commit 59959bb9ee
2 files changed
+11 -3

No files matched your search

@@ -46,6 +46,7 @@ import com.hippo.ehviewer.yorozuya.FileUtils
import eu.kanade.tachiyomi.core.preference.AndroidPreferenceStore
import eu.kanade.tachiyomi.ui.reader.setting.ReaderPreferences
import eu.kanade.tachiyomi.util.lang.launchIO
import eu.kanade.tachiyomi.util.lang.withUIContext
import kotlinx.coroutines.DelicateCoroutinesApi
import okio.Path.Companion.toOkioPath
import splitties.arch.room.roomDb
@@ -69,7 +70,12 @@ class EhApplication : Application(), ImageLoaderFactory {
super.onCreate()
System.loadLibrary("ehviewer")
ReadableTime.initialize(this)
AppCompatDelegate.setDefaultNightMode(Settings.theme)
launchIO {
val theme = Settings.theme
withUIContext {
AppCompatDelegate.setDefaultNightMode(theme)
}
}
launchIO {
launchIO {
EhTagDatabase.update()
@@ -3,12 +3,14 @@
package com.hippo.ehviewer
import com.hippo.ehviewer.client.data.FavListUrlBuilder
import splitties.preferences.DefaultPreferences
import splitties.preferences.DataStorePreferences
import splitties.preferences.DataStorePreferencesPreview
import splitties.preferences.edit
import java.util.Locale
import kotlin.reflect.KProperty
object Settings : DefaultPreferences() {
@OptIn(DataStorePreferencesPreview::class)
object Settings : DataStorePreferences(null) {
const val KEY_THEME = "theme"
const val KEY_ACCOUNT = "account"
const val KEY_IMAGE_LIMITS = "image_limits"