mirror of
https://github.com/gkd-kit/gkd.git
synced 2024-11-16 11:42:22 +08:00
perf: store showSystemApp/showHiddenApp
This commit is contained in:
parent
6206b8635c
commit
caa328aead
|
@ -181,14 +181,13 @@ fun useAppListPage(): ScaffoldExt {
|
||||||
Checkbox(
|
Checkbox(
|
||||||
checked = showSystemApp,
|
checked = showSystemApp,
|
||||||
onCheckedChange = {
|
onCheckedChange = {
|
||||||
vm.showSystemAppFlow.value =
|
storeFlow.update { s -> s.copy(showSystemApp = !showSystemApp) }
|
||||||
!vm.showSystemAppFlow.value
|
|
||||||
})
|
})
|
||||||
Text("显示系统应用")
|
Text("显示系统应用")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onClick = {
|
onClick = {
|
||||||
vm.showSystemAppFlow.value = !vm.showSystemAppFlow.value
|
storeFlow.update { s -> s.copy(showSystemApp = !showSystemApp) }
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
DropdownMenuItem(
|
DropdownMenuItem(
|
||||||
|
@ -199,14 +198,13 @@ fun useAppListPage(): ScaffoldExt {
|
||||||
Checkbox(
|
Checkbox(
|
||||||
checked = showHiddenApp,
|
checked = showHiddenApp,
|
||||||
onCheckedChange = {
|
onCheckedChange = {
|
||||||
vm.showHiddenAppFlow.value =
|
storeFlow.update { s -> s.copy(showHiddenApp = !s.showHiddenApp) }
|
||||||
!vm.showHiddenAppFlow.value
|
|
||||||
})
|
})
|
||||||
Text("显示隐藏应用")
|
Text("显示隐藏应用")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onClick = {
|
onClick = {
|
||||||
vm.showHiddenAppFlow.value = !vm.showHiddenAppFlow.value
|
storeFlow.update { s -> s.copy(showHiddenApp = !showHiddenApp) }
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -234,8 +234,8 @@ class HomeVm @Inject constructor() : ViewModel() {
|
||||||
val sortTypeFlow = storeFlow.map(viewModelScope) { s ->
|
val sortTypeFlow = storeFlow.map(viewModelScope) { s ->
|
||||||
SortTypeOption.allSubObject.find { o -> o.value == s.sortType } ?: SortTypeOption.SortByName
|
SortTypeOption.allSubObject.find { o -> o.value == s.sortType } ?: SortTypeOption.SortByName
|
||||||
}
|
}
|
||||||
val showSystemAppFlow = MutableStateFlow(true)
|
val showSystemAppFlow = storeFlow.map(viewModelScope) { s -> s.showSystemApp }
|
||||||
val showHiddenAppFlow = MutableStateFlow(false)
|
val showHiddenAppFlow = storeFlow.map(viewModelScope) { s -> s.showHiddenApp }
|
||||||
val searchStrFlow = MutableStateFlow("")
|
val searchStrFlow = MutableStateFlow("")
|
||||||
private val debounceSearchStrFlow = searchStrFlow.debounce(200)
|
private val debounceSearchStrFlow = searchStrFlow.debounce(200)
|
||||||
.stateIn(viewModelScope, SharingStarted.Eagerly, searchStrFlow.value)
|
.stateIn(viewModelScope, SharingStarted.Eagerly, searchStrFlow.value)
|
||||||
|
|
|
@ -57,6 +57,8 @@ data class Store(
|
||||||
val enableDarkTheme: Boolean? = null,
|
val enableDarkTheme: Boolean? = null,
|
||||||
val enableAbFloatWindow: Boolean = true,
|
val enableAbFloatWindow: Boolean = true,
|
||||||
val sortType: Int = SortTypeOption.SortByName.value,
|
val sortType: Int = SortTypeOption.SortByName.value,
|
||||||
|
val showSystemApp: Boolean = true,
|
||||||
|
val showHiddenApp: Boolean = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
val storeFlow by lazy {
|
val storeFlow by lazy {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user