diff --git a/app/src/main/kotlin/li/songe/gkd/permission/PermissionState.kt b/app/src/main/kotlin/li/songe/gkd/permission/PermissionState.kt index 0794a1e..5bbc7d1 100644 --- a/app/src/main/kotlin/li/songe/gkd/permission/PermissionState.kt +++ b/app/src/main/kotlin/li/songe/gkd/permission/PermissionState.kt @@ -13,7 +13,6 @@ import kotlinx.coroutines.flow.updateAndGet import li.songe.gkd.app import li.songe.gkd.appScope import li.songe.gkd.shizuku.shizukuIsSafeOK -import li.songe.gkd.util.appInfoCacheFlow import li.songe.gkd.util.initOrResetAppInfoCache import li.songe.gkd.util.launchTry @@ -133,10 +132,7 @@ fun updatePermissionState() { shizukuOkState ).forEach { it.updateAndGet() } - if (canQueryPkgState.stateFlow.value != canQueryPkgState.updateAndGet() || - // https://github.com/gkd-kit/gkd/issues/543 - appInfoCacheFlow.value.count { e -> !e.value.isSystem && !e.value.hidden } < 16 - ) { + if (canQueryPkgState.stateFlow.value != canQueryPkgState.updateAndGet()) { appScope.launchTry { initOrResetAppInfoCache() } diff --git a/app/src/main/kotlin/li/songe/gkd/ui/home/AppListPage.kt b/app/src/main/kotlin/li/songe/gkd/ui/home/AppListPage.kt index 436481b..20da924 100644 --- a/app/src/main/kotlin/li/songe/gkd/ui/home/AppListPage.kt +++ b/app/src/main/kotlin/li/songe/gkd/ui/home/AppListPage.kt @@ -23,6 +23,7 @@ import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.filled.Sort import androidx.compose.material.icons.filled.Android import androidx.compose.material.icons.filled.Apps +import androidx.compose.material.icons.filled.AppsOutage import androidx.compose.material.icons.filled.Close import androidx.compose.material.icons.filled.PriorityHigh import androidx.compose.material.icons.filled.Search @@ -79,6 +80,7 @@ import li.songe.gkd.util.storeFlow val appListNav = BottomNavItem( label = "应用", icon = Icons.Default.Apps ) +val appListOutageNav = appListNav.copy(icon = Icons.Default.AppsOutage) @Composable fun useAppListPage(): ScaffoldExt { @@ -124,7 +126,14 @@ fun useAppListPage(): ScaffoldExt { } }) val scrollBehavior = TopAppBarDefaults.enterAlwaysScrollBehavior() - return ScaffoldExt(navItem = appListNav, + val canQueryPkg by canQueryPkgState.stateFlow.collectAsState() + val navItem = if (canQueryPkg) { + appListNav + } else { + appListOutageNav + } + return ScaffoldExt( + navItem = navItem, modifier = Modifier.nestedScroll(scrollBehavior.nestedScrollConnection), topBar = { DisposableEffect(null) { @@ -169,7 +178,6 @@ fun useAppListPage(): ScaffoldExt { ) } } else { - val canQueryPkg by canQueryPkgState.stateFlow.collectAsState() if (!canQueryPkg) { IconButton(onClick = vm.viewModelScope.launchAsFn { checkOrRequestPermission(context, canQueryPkgState)