manager: Fix anomaly in displaying system app functions due to status refresh issue.
This commit is contained in:
@@ -159,7 +159,13 @@ fun SuperUserScreen(navigator: DestinationsNavigator) {
|
||||
}
|
||||
|
||||
// 应用分类和排序逻辑
|
||||
val filteredAndSortedApps = remember(viewModel.appList, selectedCategory, currentSortType, viewModel.search) {
|
||||
val filteredAndSortedApps = remember(
|
||||
viewModel.appList,
|
||||
selectedCategory,
|
||||
currentSortType,
|
||||
viewModel.search,
|
||||
viewModel.showSystemApps
|
||||
) {
|
||||
var apps = viewModel.appList
|
||||
|
||||
// 按分类筛选
|
||||
@@ -230,7 +236,7 @@ fun SuperUserScreen(navigator: DestinationsNavigator) {
|
||||
}
|
||||
|
||||
// 计算应用数量
|
||||
val appCounts = remember(viewModel.appList) {
|
||||
val appCounts = remember(viewModel.appList, viewModel.showSystemApps) {
|
||||
mapOf(
|
||||
AppCategory.ALL to viewModel.appList.size,
|
||||
AppCategory.ROOT to viewModel.appList.count { it.allowSu },
|
||||
@@ -240,7 +246,7 @@ fun SuperUserScreen(navigator: DestinationsNavigator) {
|
||||
}
|
||||
|
||||
// BottomSheet菜单项
|
||||
val bottomSheetMenuItems = remember {
|
||||
val bottomSheetMenuItems = remember(viewModel.showSystemApps) {
|
||||
listOf(
|
||||
BottomSheetMenuItem(
|
||||
icon = Icons.Filled.Refresh,
|
||||
@@ -263,6 +269,7 @@ fun SuperUserScreen(navigator: DestinationsNavigator) {
|
||||
onClick = {
|
||||
viewModel.updateShowSystemApps(!viewModel.showSystemApps)
|
||||
scope.launch {
|
||||
kotlinx.coroutines.delay(100)
|
||||
bottomSheetState.hide()
|
||||
showBottomSheet = false
|
||||
}
|
||||
|
||||
@@ -230,14 +230,6 @@ class ModuleViewModel : ViewModel() {
|
||||
}
|
||||
}
|
||||
|
||||
fun createModuleVerificationFlag(moduleId: String): Boolean {
|
||||
return ModuleVerificationManager.createVerificationFlag(moduleId)
|
||||
}
|
||||
|
||||
fun removeModuleVerificationFlag(moduleId: String): Boolean {
|
||||
return ModuleVerificationManager.removeVerificationFlag(moduleId)
|
||||
}
|
||||
|
||||
private fun sanitizeVersionString(version: String): String {
|
||||
return version.replace(Regex("[^a-zA-Z0-9.\\-_]"), "_")
|
||||
}
|
||||
|
||||
@@ -189,6 +189,13 @@ class SuperUserViewModel : ViewModel() {
|
||||
fun updateShowSystemApps(newValue: Boolean) {
|
||||
showSystemApps = newValue
|
||||
saveShowSystemApps(newValue)
|
||||
notifyAppListChanged()
|
||||
}
|
||||
|
||||
private fun notifyAppListChanged() {
|
||||
val currentApps = apps
|
||||
apps = emptyList()
|
||||
apps = currentApps
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -251,7 +258,7 @@ class SuperUserViewModel : ViewModel() {
|
||||
}
|
||||
|
||||
val appList by derivedStateOf {
|
||||
sortedList.filter {
|
||||
val filtered = sortedList.filter {
|
||||
it.label.contains(search, true) || it.packageName.contains(
|
||||
search,
|
||||
true
|
||||
@@ -260,6 +267,8 @@ class SuperUserViewModel : ViewModel() {
|
||||
}.filter {
|
||||
it.uid == 2000 || showSystemApps || it.packageInfo.applicationInfo!!.flags.and(ApplicationInfo.FLAG_SYSTEM) == 0
|
||||
}
|
||||
|
||||
filtered
|
||||
}
|
||||
|
||||
// 切换批量操作模式
|
||||
|
||||
Reference in New Issue
Block a user