diff --git a/app/src/main/java/com/huanchengfly/tieba/post/ui/common/prefs/widgets/ListPref.kt b/app/src/main/java/com/huanchengfly/tieba/post/ui/common/prefs/widgets/ListPref.kt index a17baf37..cad81606 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/ui/common/prefs/widgets/ListPref.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/ui/common/prefs/widgets/ListPref.kt @@ -65,10 +65,8 @@ fun ListPref( prefs?.get(selectionKey)?.also { selected = it } // starting value if it exists in datastore fun edit(current: Pair) = run { - scope.launch { - selected = current.first - onValueChange?.invoke(current.first) - } + selected = current.first + onValueChange?.invoke(current.first) scope.launch { try { datastore.edit { preferences -> diff --git a/app/src/main/java/com/huanchengfly/tieba/post/ui/common/prefs/widgets/SwitchPref.kt b/app/src/main/java/com/huanchengfly/tieba/post/ui/common/prefs/widgets/SwitchPref.kt index 3191113d..1c1264e9 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/ui/common/prefs/widgets/SwitchPref.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/ui/common/prefs/widgets/SwitchPref.kt @@ -39,10 +39,8 @@ fun SwitchPref( prefs?.get(selectionKey)?.also { checked = it } // starting value if it exists in datastore fun edit(newState: Boolean) = run { - scope.launch { - checked = newState - onCheckedChange?.invoke(newState) - } + checked = newState + onCheckedChange?.invoke(newState) scope.launch { try { datastore.edit { preferences ->