fix: 设置页面修改后不刷新
This commit is contained in:
parent
3ae3fcb96f
commit
a9115bb520
|
|
@ -65,10 +65,8 @@ fun ListPref(
|
|||
prefs?.get(selectionKey)?.also { selected = it } // starting value if it exists in datastore
|
||||
|
||||
fun edit(current: Pair<String, String>) = run {
|
||||
scope.launch {
|
||||
selected = current.first
|
||||
onValueChange?.invoke(current.first)
|
||||
}
|
||||
selected = current.first
|
||||
onValueChange?.invoke(current.first)
|
||||
scope.launch {
|
||||
try {
|
||||
datastore.edit { preferences ->
|
||||
|
|
|
|||
|
|
@ -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 ->
|
||||
|
|
|
|||
Loading…
Reference in New Issue