Просмотр исходного кода

refactor: 删除设置门面 SP 回退读写与重复门面,DsSync 更名 SettingsWriter

- getPref*/putPref* 门面改为纯 AppConfigStore 快照读写,删除 SP 回退读+补写
  与 pre-init SP 旧路径(App.onCreate 首行已 init,无更早的门面调用方)
- 删除无调用方的 observeSharedPreferences、defaultSharedPreferences、
  FragmentExtensions pref 重复门面(2 个调用点改 requireContext())、
  SettingsRepository.batchPutFromMap 死代码
- DsSync 更名 SettingsWriter(唯一写队列,awaitPendingWrites 保留)
- SharedPreferencesMigration/ShowBrightnessViewMigration/Backup 导出格式不动
5151561 3 месяцев назад
Родитель
Сommit
0d189e1cbd

+ 0 - 22
app/src/main/java/io/legado/app/data/repository/SettingsRepository.kt

@@ -1,7 +1,6 @@
 package io.legado.app.data.repository
 package io.legado.app.data.repository
 
 
 import android.content.Context
 import android.content.Context
-import androidx.core.content.edit
 import androidx.datastore.core.DataMigration
 import androidx.datastore.core.DataMigration
 import androidx.datastore.core.DataStore
 import androidx.datastore.core.DataStore
 import androidx.datastore.preferences.SharedPreferencesMigration
 import androidx.datastore.preferences.SharedPreferencesMigration
@@ -63,7 +62,6 @@ internal object ShowBrightnessViewMigration : DataMigration<Preferences> {
 /**
 /**
  * 设置仓储
  * 设置仓储
  * 以 DataStore 为唯一写入源,读取以 DataStore 为准。
  * 以 DataStore 为唯一写入源,读取以 DataStore 为准。
- * SP 同步由 PrefDelegate 双写保证(阶段 1),此处不再回写 SP。
  */
  */
 class SettingsRepository(private val context: Context) {
 class SettingsRepository(private val context: Context) {
 
 
@@ -139,26 +137,6 @@ class SettingsRepository(private val context: Context) {
     suspend fun putStringSet(key: String, value: Set<String>) =
     suspend fun putStringSet(key: String, value: Set<String>) =
         updatePreference(stringSetPreferencesKey(key), value)
         updatePreference(stringSetPreferencesKey(key), value)
 
 
-    // 批量从 Map 恢复到 DataStore (用于兼容 Restore 逻辑)
-    suspend fun batchPutFromMap(map: Map<String, *>) {
-        dataStore.edit { preferences ->
-            map.forEach { (key, value) ->
-                when (value) {
-                    is String -> preferences[stringPreferencesKey(key)] = value
-                    is Int -> preferences[intPreferencesKey(key)] = value
-                    is Boolean -> preferences[booleanPreferencesKey(key)] = value
-                    is Long -> preferences[longPreferencesKey(key)] = value
-                    is Float -> preferences[floatPreferencesKey(key)] = value
-                    is Set<*> -> {
-                        @Suppress("UNCHECKED_CAST")
-                        preferences[stringSetPreferencesKey(key)] = value as Set<String>
-                    }
-                }
-            }
-        }
-    }
-
-
     // 移除配置
     // 移除配置
     suspend fun remove(key: String) {
     suspend fun remove(key: String) {
         dataStore.edit { preferences ->
         dataStore.edit { preferences ->

+ 1 - 3
app/src/main/java/io/legado/app/help/config/AppConfigStore.kt

@@ -42,8 +42,6 @@ object AppConfigStore {
     private var core: PendingOverlayCore? = null
     private var core: PendingOverlayCore? = null
     private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
     private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
 
 
-    val isInitialized: Boolean get() = core != null
-
     /**
     /**
      * 在 App.onCreate 首行调用,先于一切设置读取(主题初始化等)。
      * 在 App.onCreate 首行调用,先于一切设置读取(主题初始化等)。
      * runBlocking 首读会触发 DataStore 迁移,与旧版首个 PrefDelegate 构造时的行为一致,
      * runBlocking 首读会触发 DataStore 迁移,与旧版首个 PrefDelegate 构造时的行为一致,
@@ -59,7 +57,7 @@ object AppConfigStore {
         }
         }
         val newCore = PendingOverlayCore(
         val newCore = PendingOverlayCore(
             initial = initial,
             initial = initial,
-            launchWrite = { DsSync.launchWrite(it) },
+            launchWrite = { SettingsWriter.launchWrite(it) },
             persist = { key, value -> dataStore.edit { it.setPrefValue(key, value) } },
             persist = { key, value -> dataStore.edit { it.setPrefValue(key, value) } },
             persistAll = { values ->
             persistAll = { values ->
                 dataStore.edit { prefs ->
                 dataStore.edit { prefs ->

+ 2 - 2
app/src/main/java/io/legado/app/help/config/DsSync.kt → app/src/main/java/io/legado/app/help/config/SettingsWriter.kt

@@ -16,7 +16,7 @@ import kotlin.time.measureTime
 /**
 /**
  * DataStore 写入序列化队列,所有经 [AppConfigStore] 的异步写入按提交顺序串行落盘。
  * DataStore 写入序列化队列,所有经 [AppConfigStore] 的异步写入按提交顺序串行落盘。
  */
  */
-object DsSync {
+object SettingsWriter {
 
 
     private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
     private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
 
 
@@ -39,7 +39,7 @@ object DsSync {
                 val elapsed = measureTime { runCatching { block() } }
                 val elapsed = measureTime { runCatching { block() } }
                 if (elapsed > 500.milliseconds) {
                 if (elapsed > 500.milliseconds) {
                     LogUtils.d(
                     LogUtils.d(
-                        "DsSync",
+                        "SettingsWriter",
                         "单次 edit 耗时 ${elapsed.inWholeMilliseconds}ms, 队列剩余 ${pendingCount.get() - 1}"
                         "单次 edit 耗时 ${elapsed.inWholeMilliseconds}ms, 队列剩余 ${pendingCount.get() - 1}"
                     )
                     )
                 }
                 }

+ 2 - 2
app/src/main/java/io/legado/app/help/storage/Restore.kt

@@ -38,7 +38,7 @@ import io.legado.app.help.book.isLocal
 import io.legado.app.help.book.upType
 import io.legado.app.help.book.upType
 import io.legado.app.help.config.AppConfigStore
 import io.legado.app.help.config.AppConfigStore
 import io.legado.app.help.config.LocalConfig
 import io.legado.app.help.config.LocalConfig
-import io.legado.app.help.config.DsSync
+import io.legado.app.help.config.SettingsWriter
 import io.legado.app.help.config.ThemeConfigStore
 import io.legado.app.help.config.ThemeConfigStore
 import io.legado.app.help.config.ReadBookConfig
 import io.legado.app.help.config.ReadBookConfig
 import io.legado.app.ui.config.otherConfig.OtherConfig
 import io.legado.app.ui.config.otherConfig.OtherConfig
@@ -406,7 +406,7 @@ object Restore : KoinComponent {
         // 经快照层批量恢复:立即对读侧生效(onRestoreFinish 的读取不再依赖回灌时机),单次原子 edit 落盘
         // 经快照层批量恢复:立即对读侧生效(onRestoreFinish 的读取不再依赖回灌时机),单次原子 edit 落盘
         AppConfigStore.putAll(finalMap)
         AppConfigStore.putAll(finalMap)
         // 恢复完成提示前等待落盘,dataStore.edit 返回即持久化完成
         // 恢复完成提示前等待落盘,dataStore.edit 返回即持久化完成
-        DsSync.awaitPendingWrites()
+        SettingsWriter.awaitPendingWrites()
     }
     }
 
 
     private fun readXmlToMap(file: File): Map<String, Any?> {
     private fun readXmlToMap(file: File): Map<String, Any?> {

+ 1 - 1
app/src/main/java/io/legado/app/ui/association/ImportReplaceRuleDialog.kt

@@ -124,7 +124,7 @@ class ImportReplaceRuleDialog() : BaseDialogFragment(R.layout.dialog_recycler_vi
             R.id.menu_new_group -> alertCustomGroup(item)
             R.id.menu_new_group -> alertCustomGroup(item)
             R.id.menu_keep_original_name -> {
             R.id.menu_keep_original_name -> {
                 item.isChecked = !item.isChecked
                 item.isChecked = !item.isChecked
-                putPrefBoolean(PreferKey.importKeepName, item.isChecked)
+                requireContext().putPrefBoolean(PreferKey.importKeepName, item.isChecked)
             }
             }
         }
         }
         return true
         return true

+ 1 - 1
app/src/main/java/io/legado/app/ui/config/CheckSourceConfig.kt

@@ -93,7 +93,7 @@ class CheckSourceConfig : BaseBottomSheetDialogFragment(R.layout.dialog_check_so
                 checkCategory = binding.checkCategory.isChecked
                 checkCategory = binding.checkCategory.isChecked
                 checkContent = binding.checkContent.isChecked
                 checkContent = binding.checkContent.isChecked
                 putConfig()
                 putConfig()
-                putPrefString(PreferKey.checkSource, summary)
+                requireContext().putPrefString(PreferKey.checkSource, summary)
                 dismiss()
                 dismiss()
             }
             }
         }
         }

+ 1 - 1
app/src/main/java/io/legado/app/ui/config/PrefDelegate.kt

@@ -59,7 +59,7 @@ fun <T> prefDelegate(
         private var dsObserverJob: Job? = null
         private var dsObserverJob: Job? = null
 
 
         init {
         init {
-            // 初值走门面:AppConfigStore 内存快照,DS 缺值时门面内回退 SP 并补写
+            // 初值走门面:AppConfigStore 内存快照(DataStore 唯一真源)
             val initialValue = readInitial()
             val initialValue = readInitial()
             _value = mutableStateOf(initialValue)
             _value = mutableStateOf(initialValue)
             currentValue = initialValue
             currentValue = initialValue

+ 15 - 99
app/src/main/java/io/legado/app/utils/ContextExtensions.kt

@@ -16,7 +16,6 @@ import android.content.ClipData
 import android.content.Context
 import android.content.Context
 import android.content.Intent
 import android.content.Intent
 import android.content.IntentFilter
 import android.content.IntentFilter
-import android.content.SharedPreferences
 import android.content.pm.ApplicationInfo
 import android.content.pm.ApplicationInfo
 import android.content.pm.PackageManager
 import android.content.pm.PackageManager
 import android.content.res.ColorStateList
 import android.content.res.ColorStateList
@@ -34,16 +33,14 @@ import androidx.annotation.ColorRes
 import androidx.annotation.DrawableRes
 import androidx.annotation.DrawableRes
 import androidx.core.content.ContextCompat
 import androidx.core.content.ContextCompat
 import androidx.core.content.FileProvider
 import androidx.core.content.FileProvider
-import androidx.core.content.edit
 import androidx.core.net.toUri
 import androidx.core.net.toUri
-import androidx.preference.PreferenceManager
 import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
 import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
 import io.legado.app.R
 import io.legado.app.R
 import io.legado.app.constant.AppConst
 import io.legado.app.constant.AppConst
 import io.legado.app.data.entities.Book
 import io.legado.app.data.entities.Book
 import io.legado.app.help.IntentHelp
 import io.legado.app.help.IntentHelp
 import io.legado.app.help.config.AppConfigStore
 import io.legado.app.help.config.AppConfigStore
-import io.legado.app.help.config.DsSync
+import io.legado.app.help.config.SettingsWriter
 import io.legado.app.help.book.isAudio
 import io.legado.app.help.book.isAudio
 import io.legado.app.help.book.isImage
 import io.legado.app.help.book.isImage
 import io.legado.app.help.book.isLocal
 import io.legado.app.help.book.isLocal
@@ -185,136 +182,55 @@ fun Context.startForegroundServiceCompat(intent: Intent) {
     }
     }
 }
 }
 
 
-val Context.defaultSharedPreferences: SharedPreferences
-    get() = PreferenceManager.getDefaultSharedPreferences(this)
-
 // getPref*/putPref* 门面:读写统一走 AppConfigStore 内存快照(DataStore 唯一真源),
 // getPref*/putPref* 门面:读写统一走 AppConfigStore 内存快照(DataStore 唯一真源),
-// 主线程零 IO。AppConfigStore 未初始化时(App.onCreate 之前,如 ContentProvider)走 SP 旧路径。
+// 主线程零 IO。须在 App.onCreate 首行 AppConfigStore.init() 之后使用。
 
 
-fun Context.getPrefBoolean(key: String, defValue: Boolean = false): Boolean {
-    if (!AppConfigStore.isInitialized) return defaultSharedPreferences.getBoolean(key, defValue)
-    AppConfigStore.getBoolean(key)?.let { return it }
-    if (!defaultSharedPreferences.contains(key)) return defValue
-    val value = defaultSharedPreferences.getBoolean(key, defValue)
-    AppConfigStore.putBoolean(key, value)
-    return value
-}
+fun Context.getPrefBoolean(key: String, defValue: Boolean = false): Boolean =
+    AppConfigStore.getBoolean(key) ?: defValue
 
 
 fun Context.putPrefBoolean(key: String, value: Boolean = false) {
 fun Context.putPrefBoolean(key: String, value: Boolean = false) {
-    if (!AppConfigStore.isInitialized) {
-        defaultSharedPreferences.edit { putBoolean(key, value) }
-        return
-    }
     AppConfigStore.putBoolean(key, value)
     AppConfigStore.putBoolean(key, value)
 }
 }
 
 
-fun Context.getPrefInt(key: String, defValue: Int = 0): Int {
-    if (!AppConfigStore.isInitialized) return defaultSharedPreferences.getInt(key, defValue)
-    AppConfigStore.getInt(key)?.let { return it }
-    if (!defaultSharedPreferences.contains(key)) return defValue
-    val value = defaultSharedPreferences.getInt(key, defValue)
-    AppConfigStore.putInt(key, value)
-    return value
-}
+fun Context.getPrefInt(key: String, defValue: Int = 0): Int =
+    AppConfigStore.getInt(key) ?: defValue
 
 
 fun Context.putPrefInt(key: String, value: Int) {
 fun Context.putPrefInt(key: String, value: Int) {
-    if (!AppConfigStore.isInitialized) {
-        defaultSharedPreferences.edit { putInt(key, value) }
-        return
-    }
     AppConfigStore.putInt(key, value)
     AppConfigStore.putInt(key, value)
 }
 }
 
 
-fun Context.getPrefLong(key: String, defValue: Long = 0L): Long {
-    if (AppConfigStore.isInitialized) {
-        AppConfigStore.getLong(key)?.let { return it }
-        if (!defaultSharedPreferences.contains(key)) return defValue
-    }
-    val value = try {
-        defaultSharedPreferences.getLong(key, defValue)
-    } catch (e: ClassCastException) {
-        val fixed = defaultSharedPreferences.getInt(key, defValue.toInt()).toLong()
-        defaultSharedPreferences.edit { putLong(key, fixed) }
-        fixed
-    }
-    if (AppConfigStore.isInitialized) AppConfigStore.putLong(key, value)
-    return value
-}
+fun Context.getPrefLong(key: String, defValue: Long = 0L): Long =
+    AppConfigStore.getLong(key) ?: defValue
 
 
 fun Context.putPrefLong(key: String, value: Long) {
 fun Context.putPrefLong(key: String, value: Long) {
-    if (!AppConfigStore.isInitialized) {
-        defaultSharedPreferences.edit { putLong(key, value) }
-        return
-    }
     AppConfigStore.putLong(key, value)
     AppConfigStore.putLong(key, value)
 }
 }
 
 
-fun Context.getPrefFloat(key: String, defValue: Float = 0f): Float {
-    if (AppConfigStore.isInitialized) {
-        AppConfigStore.getFloat(key)?.let { return it }
-        if (!defaultSharedPreferences.contains(key)) return defValue
-    }
-    val value = try {
-        defaultSharedPreferences.getFloat(key, defValue)
-    } catch (e: ClassCastException) {
-        val fixed = defaultSharedPreferences.getInt(key, defValue.toInt()).toFloat()
-        defaultSharedPreferences.edit { putFloat(key, fixed) }
-        fixed
-    }
-    if (AppConfigStore.isInitialized) AppConfigStore.putFloat(key, value)
-    return value
-}
+fun Context.getPrefFloat(key: String, defValue: Float = 0f): Float =
+    AppConfigStore.getFloat(key) ?: defValue
 
 
 fun Context.putPrefFloat(key: String, value: Float) {
 fun Context.putPrefFloat(key: String, value: Float) {
-    if (!AppConfigStore.isInitialized) {
-        defaultSharedPreferences.edit { putFloat(key, value) }
-        return
-    }
     AppConfigStore.putFloat(key, value)
     AppConfigStore.putFloat(key, value)
 }
 }
 
 
-fun Context.getPrefString(key: String, defValue: String? = null): String? {
-    if (!AppConfigStore.isInitialized) return defaultSharedPreferences.getString(key, defValue)
-    AppConfigStore.getString(key)?.let { return it }
-    if (!defaultSharedPreferences.contains(key)) return defValue
-    val value = defaultSharedPreferences.getString(key, defValue)
-    if (value != null) AppConfigStore.putString(key, value)
-    return value
-}
+fun Context.getPrefString(key: String, defValue: String? = null): String? =
+    AppConfigStore.getString(key) ?: defValue
 
 
 fun Context.putPrefString(key: String, value: String?) {
 fun Context.putPrefString(key: String, value: String?) {
-    if (!AppConfigStore.isInitialized) {
-        defaultSharedPreferences.edit { putString(key, value) }
-        return
-    }
     AppConfigStore.putString(key, value)
     AppConfigStore.putString(key, value)
 }
 }
 
 
 fun Context.getPrefStringSet(
 fun Context.getPrefStringSet(
     key: String,
     key: String,
     defValue: MutableSet<String>? = null,
     defValue: MutableSet<String>? = null,
-): MutableSet<String>? {
-    if (!AppConfigStore.isInitialized) return defaultSharedPreferences.getStringSet(key, defValue)
-    AppConfigStore.getStringSet(key)?.let { return it.toMutableSet() }
-    if (!defaultSharedPreferences.contains(key)) return defValue
-    val value = defaultSharedPreferences.getStringSet(key, defValue)
-    if (value != null) AppConfigStore.putStringSet(key, value.toSet())
-    return value
-}
+): MutableSet<String>? =
+    AppConfigStore.getStringSet(key)?.toMutableSet() ?: defValue
 
 
 fun Context.putPrefStringSet(key: String, value: MutableSet<String>) {
 fun Context.putPrefStringSet(key: String, value: MutableSet<String>) {
-    if (!AppConfigStore.isInitialized) {
-        defaultSharedPreferences.edit { putStringSet(key, value) }
-        return
-    }
     AppConfigStore.putStringSet(key, value.toSet())
     AppConfigStore.putStringSet(key, value.toSet())
 }
 }
 
 
 fun Context.removePref(key: String) {
 fun Context.removePref(key: String) {
-    if (!AppConfigStore.isInitialized) {
-        defaultSharedPreferences.edit { remove(key) }
-        return
-    }
     AppConfigStore.remove(key)
     AppConfigStore.remove(key)
 }
 }
 
 
@@ -338,7 +254,7 @@ fun Context.restart() {
                     or Intent.FLAG_ACTIVITY_CLEAR_TOP
                     or Intent.FLAG_ACTIVITY_CLEAR_TOP
         )
         )
         runBlocking {
         runBlocking {
-            DsSync.awaitPendingWrites()
+            SettingsWriter.awaitPendingWrites()
         }
         }
         startActivity(intent)
         startActivity(intent)
         //杀掉以前进程
         //杀掉以前进程

+ 0 - 39
app/src/main/java/io/legado/app/utils/FragmentExtensions.kt

@@ -17,7 +17,6 @@ import io.legado.app.data.entities.Book
 import io.legado.app.help.book.isAudio
 import io.legado.app.help.book.isAudio
 import io.legado.app.help.book.isImage
 import io.legado.app.help.book.isImage
 import io.legado.app.help.book.isLocal
 import io.legado.app.help.book.isLocal
-import io.legado.app.help.config.AppConfig
 import io.legado.app.ui.config.readMangaConfig.ReadMangaConfig
 import io.legado.app.ui.config.readMangaConfig.ReadMangaConfig
 import io.legado.app.ui.book.audio.AudioPlayActivity
 import io.legado.app.ui.book.audio.AudioPlayActivity
 import io.legado.app.ui.book.manga.ReadMangaActivity
 import io.legado.app.ui.book.manga.ReadMangaActivity
@@ -38,44 +37,6 @@ fun Fragment.showDialogFragment(dialogFragment: DialogFragment) {
     dialogFragment.show(childFragmentManager, dialogFragment::class.simpleName)
     dialogFragment.show(childFragmentManager, dialogFragment::class.simpleName)
 }
 }
 
 
-// 统一委托给 Context 门面(读快照、写双写),避免两套实现漂移
-
-fun Fragment.getPrefBoolean(key: String, defValue: Boolean = false) =
-    requireContext().getPrefBoolean(key, defValue)
-
-fun Fragment.putPrefBoolean(key: String, value: Boolean = false) =
-    requireContext().putPrefBoolean(key, value)
-
-fun Fragment.getPrefInt(key: String, defValue: Int = 0) =
-    requireContext().getPrefInt(key, defValue)
-
-fun Fragment.putPrefInt(key: String, value: Int) =
-    requireContext().putPrefInt(key, value)
-
-fun Fragment.getPrefLong(key: String, defValue: Long = 0L) =
-    requireContext().getPrefLong(key, defValue)
-
-fun Fragment.putPrefLong(key: String, value: Long) =
-    requireContext().putPrefLong(key, value)
-
-fun Fragment.getPrefString(key: String, defValue: String? = null) =
-    requireContext().getPrefString(key, defValue)
-
-fun Fragment.putPrefString(key: String, value: String) =
-    requireContext().putPrefString(key, value)
-
-fun Fragment.getPrefStringSet(
-    key: String,
-    defValue: MutableSet<String>? = null
-): MutableSet<String>? =
-    requireContext().getPrefStringSet(key, defValue)
-
-fun Fragment.putPrefStringSet(key: String, value: MutableSet<String>) =
-    requireContext().putPrefStringSet(key, value)
-
-fun Fragment.removePref(key: String) =
-    requireContext().removePref(key)
-
 fun Fragment.getCompatColor(@ColorRes id: Int): Int = requireContext().getCompatColor(id)
 fun Fragment.getCompatColor(@ColorRes id: Int): Int = requireContext().getCompatColor(id)
 
 
 fun Fragment.getCompatDrawable(@DrawableRes id: Int): Drawable? =
 fun Fragment.getCompatDrawable(@DrawableRes id: Int): Drawable? =

+ 0 - 28
app/src/main/java/io/legado/app/utils/PreferencesExtensions.kt

@@ -8,9 +8,6 @@ import android.content.Context
 import android.content.ContextWrapper
 import android.content.ContextWrapper
 import android.content.SharedPreferences
 import android.content.SharedPreferences
 import androidx.core.content.edit
 import androidx.core.content.edit
-import androidx.lifecycle.DefaultLifecycleObserver
-import androidx.lifecycle.LifecycleOwner
-import splitties.init.appCtx
 import java.io.File
 import java.io.File
 
 
 /**
 /**
@@ -109,28 +106,3 @@ fun SharedPreferences.remove(key: String) {
         remove(key)
         remove(key)
     }
     }
 }
 }
-
-fun LifecycleOwner.observeSharedPreferences(
-    prefs: SharedPreferences = appCtx.defaultSharedPreferences,
-    l: SharedPreferences.OnSharedPreferenceChangeListener
-) {
-    val observer = object : DefaultLifecycleObserver {
-        override fun onCreate(owner: LifecycleOwner) {
-            prefs.registerOnSharedPreferenceChangeListener(l)
-        }
-
-        override fun onDestroy(owner: LifecycleOwner) {
-            prefs.unregisterOnSharedPreferenceChangeListener(l)
-            lifecycle.removeObserver(this)
-        }
-
-        override fun onPause(owner: LifecycleOwner) {
-            prefs.unregisterOnSharedPreferenceChangeListener(l)
-        }
-
-        override fun onResume(owner: LifecycleOwner) {
-            prefs.registerOnSharedPreferenceChangeListener(l)
-        }
-    }
-    lifecycle.addObserver(observer)
-}

+ 1 - 1
app/src/test/java/io/legado/app/help/config/PendingOverlayCoreTest.kt

@@ -36,7 +36,7 @@ class PendingOverlayCoreTest {
             },
             },
         )
         )
 
 
-        /** 执行队列中下一个落盘任务(模拟 DsSync 串行队列跑完一个 Job) */
+        /** 执行队列中下一个落盘任务(模拟 SettingsWriter 串行队列跑完一个 Job) */
         fun completeNextWrite() = runBlocking { writeQueue.removeFirst().invoke() }
         fun completeNextWrite() = runBlocking { writeQueue.removeFirst().invoke() }
 
 
         fun read(key: String): Int? = core.preferencesFlow.value.compatDsInt(key)
         fun read(key: String): Int? = core.preferencesFlow.value.compatDsInt(key)