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
|
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(
|
mapOf(
|
||||||
AppCategory.ALL to viewModel.appList.size,
|
AppCategory.ALL to viewModel.appList.size,
|
||||||
AppCategory.ROOT to viewModel.appList.count { it.allowSu },
|
AppCategory.ROOT to viewModel.appList.count { it.allowSu },
|
||||||
@@ -240,7 +246,7 @@ fun SuperUserScreen(navigator: DestinationsNavigator) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// BottomSheet菜单项
|
// BottomSheet菜单项
|
||||||
val bottomSheetMenuItems = remember {
|
val bottomSheetMenuItems = remember(viewModel.showSystemApps) {
|
||||||
listOf(
|
listOf(
|
||||||
BottomSheetMenuItem(
|
BottomSheetMenuItem(
|
||||||
icon = Icons.Filled.Refresh,
|
icon = Icons.Filled.Refresh,
|
||||||
@@ -263,6 +269,7 @@ fun SuperUserScreen(navigator: DestinationsNavigator) {
|
|||||||
onClick = {
|
onClick = {
|
||||||
viewModel.updateShowSystemApps(!viewModel.showSystemApps)
|
viewModel.updateShowSystemApps(!viewModel.showSystemApps)
|
||||||
scope.launch {
|
scope.launch {
|
||||||
|
kotlinx.coroutines.delay(100)
|
||||||
bottomSheetState.hide()
|
bottomSheetState.hide()
|
||||||
showBottomSheet = false
|
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 {
|
private fun sanitizeVersionString(version: String): String {
|
||||||
return version.replace(Regex("[^a-zA-Z0-9.\\-_]"), "_")
|
return version.replace(Regex("[^a-zA-Z0-9.\\-_]"), "_")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -189,6 +189,13 @@ class SuperUserViewModel : ViewModel() {
|
|||||||
fun updateShowSystemApps(newValue: Boolean) {
|
fun updateShowSystemApps(newValue: Boolean) {
|
||||||
showSystemApps = newValue
|
showSystemApps = newValue
|
||||||
saveShowSystemApps(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 {
|
val appList by derivedStateOf {
|
||||||
sortedList.filter {
|
val filtered = sortedList.filter {
|
||||||
it.label.contains(search, true) || it.packageName.contains(
|
it.label.contains(search, true) || it.packageName.contains(
|
||||||
search,
|
search,
|
||||||
true
|
true
|
||||||
@@ -260,6 +267,8 @@ class SuperUserViewModel : ViewModel() {
|
|||||||
}.filter {
|
}.filter {
|
||||||
it.uid == 2000 || showSystemApps || it.packageInfo.applicationInfo!!.flags.and(ApplicationInfo.FLAG_SYSTEM) == 0
|
it.uid == 2000 || showSystemApps || it.packageInfo.applicationInfo!!.flags.and(ApplicationInfo.FLAG_SYSTEM) == 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filtered
|
||||||
}
|
}
|
||||||
|
|
||||||
// 切换批量操作模式
|
// 切换批量操作模式
|
||||||
|
|||||||
Reference in New Issue
Block a user