Observe updateWhenRequestNewsChanges

This commit is contained in:
tarsin committed 2023-06-06 16:36:00 +08:00
1 parent 48e3b44658
commit 67d5942aff
2 files changed
+7 -1

No files matched your search

@@ -57,7 +57,7 @@ object Settings : DataStorePreferences(null) {
var readCacheSize by intFromStrPref("read_cache_size", 640)
var launchPage by intFromStrPref("launch_page", 0)
var showComments by boolPref("show_gallery_comments", true)
var requestNews by boolPref(KEY_REQUEST_NEWS, false)
var requestNews by boolPref(KEY_REQUEST_NEWS, false).observed { updateWhenRequestNewsChanges() }
var hideHvEvents by boolPref(KEY_HIDE_HV_EVENTS, false)
var showJpnTitle by boolPref(KEY_SHOW_JPN_TITLE, false)
var showGalleryPages by boolPref("show_gallery_pages", false)
@@ -2,6 +2,7 @@ package com.hippo.ehviewer
import androidx.appcompat.app.AppCompatDelegate
import androidx.core.os.LocaleListCompat
import com.hippo.ehviewer.dailycheck.updateDailyCheckWork
import com.hippo.ehviewer.ui.keepNoMediaFileStatus
import eu.kanade.tachiyomi.util.lang.launchIO
import kotlinx.coroutines.CoroutineScope
@@ -9,6 +10,7 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import splitties.init.appCtx
import splitties.preferences.PrefDelegate
val collectScope = CoroutineScope(Dispatchers.Main + SupervisorJob())
@@ -38,3 +40,7 @@ fun updateWhenThemeChanges() {
AppCompatDelegate.setDefaultNightMode(Settings.theme)
}
}
fun updateWhenRequestNewsChanges() {
updateDailyCheckWork(appCtx)
}