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(
|
||||
checked = showSystemApp,
|
||||
onCheckedChange = {
|
||||
vm.showSystemAppFlow.value =
|
||||
!vm.showSystemAppFlow.value
|
||||
storeFlow.update { s -> s.copy(showSystemApp = !showSystemApp) }
|
||||
})
|
||||
Text("显示系统应用")
|
||||
}
|
||||
},
|
||||
onClick = {
|
||||
vm.showSystemAppFlow.value = !vm.showSystemAppFlow.value
|
||||
storeFlow.update { s -> s.copy(showSystemApp = !showSystemApp) }
|
||||
},
|
||||
)
|
||||
DropdownMenuItem(
|
||||
|
@ -199,14 +198,13 @@ fun useAppListPage(): ScaffoldExt {
|
|||
Checkbox(
|
||||
checked = showHiddenApp,
|
||||
onCheckedChange = {
|
||||
vm.showHiddenAppFlow.value =
|
||||
!vm.showHiddenAppFlow.value
|
||||
storeFlow.update { s -> s.copy(showHiddenApp = !s.showHiddenApp) }
|
||||
})
|
||||
Text("显示隐藏应用")
|
||||
}
|
||||
},
|
||||
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 ->
|
||||
SortTypeOption.allSubObject.find { o -> o.value == s.sortType } ?: SortTypeOption.SortByName
|
||||
}
|
||||
val showSystemAppFlow = MutableStateFlow(true)
|
||||
val showHiddenAppFlow = MutableStateFlow(false)
|
||||
val showSystemAppFlow = storeFlow.map(viewModelScope) { s -> s.showSystemApp }
|
||||
val showHiddenAppFlow = storeFlow.map(viewModelScope) { s -> s.showHiddenApp }
|
||||
val searchStrFlow = MutableStateFlow("")
|
||||
private val debounceSearchStrFlow = searchStrFlow.debounce(200)
|
||||
.stateIn(viewModelScope, SharingStarted.Eagerly, searchStrFlow.value)
|
||||
|
|
|
@ -57,6 +57,8 @@ data class Store(
|
|||
val enableDarkTheme: Boolean? = null,
|
||||
val enableAbFloatWindow: Boolean = true,
|
||||
val sortType: Int = SortTypeOption.SortByName.value,
|
||||
val showSystemApp: Boolean = true,
|
||||
val showHiddenApp: Boolean = false,
|
||||
)
|
||||
|
||||
val storeFlow by lazy {
|
||||
|
|
Loading…
Reference in New Issue
Block a user