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
|
prefs?.get(selectionKey)?.also { selected = it } // starting value if it exists in datastore
|
||||||
|
|
||||||
fun edit(current: Pair<String, String>) = run {
|
fun edit(current: Pair<String, String>) = run {
|
||||||
scope.launch {
|
|
||||||
selected = current.first
|
selected = current.first
|
||||||
onValueChange?.invoke(current.first)
|
onValueChange?.invoke(current.first)
|
||||||
}
|
|
||||||
scope.launch {
|
scope.launch {
|
||||||
try {
|
try {
|
||||||
datastore.edit { preferences ->
|
datastore.edit { preferences ->
|
||||||
|
|
|
||||||
|
|
@ -39,10 +39,8 @@ fun SwitchPref(
|
||||||
prefs?.get(selectionKey)?.also { checked = it } // starting value if it exists in datastore
|
prefs?.get(selectionKey)?.also { checked = it } // starting value if it exists in datastore
|
||||||
|
|
||||||
fun edit(newState: Boolean) = run {
|
fun edit(newState: Boolean) = run {
|
||||||
scope.launch {
|
|
||||||
checked = newState
|
checked = newState
|
||||||
onCheckedChange?.invoke(newState)
|
onCheckedChange?.invoke(newState)
|
||||||
}
|
|
||||||
scope.launch {
|
scope.launch {
|
||||||
try {
|
try {
|
||||||
datastore.edit { preferences ->
|
datastore.edit { preferences ->
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue