Hide top bar when permission until storage permission is granted
This commit is contained in:
parent
41ffe3d5d9
commit
adae5b5e9b
2 changed files with 10 additions and 8 deletions
|
|
@ -23,6 +23,8 @@ import com.aliucord.manager.BuildConfig
|
|||
import com.aliucord.manager.R
|
||||
import com.aliucord.manager.ui.screens.destinations.*
|
||||
import com.aliucord.manager.ui.screens.navDestination
|
||||
import com.ramcosta.composedestinations.navigation.navigateTo
|
||||
import com.ramcosta.composedestinations.navigation.popUpTo
|
||||
|
||||
@get:StringRes
|
||||
private val Destination.title
|
||||
|
|
@ -56,8 +58,8 @@ fun AppBar(navController: NavController) {
|
|||
|
||||
IconButton(
|
||||
onClick = {
|
||||
navController.navigate(StoreScreenDestination.route) {
|
||||
popUpTo(HomeScreenDestination.route) { saveState = true }
|
||||
navController.navigateTo(StoreScreenDestination) {
|
||||
popUpTo(HomeScreenDestination) { saveState = true }
|
||||
}
|
||||
},
|
||||
) {
|
||||
|
|
@ -101,7 +103,7 @@ fun AppBar(navController: NavController) {
|
|||
DropdownMenuItem(
|
||||
onClick = {
|
||||
isMenuExpanded = false
|
||||
navController.navigate(AboutScreenDestination.route)
|
||||
navController.navigateTo(AboutScreenDestination)
|
||||
},
|
||||
text = { Text(stringResource(AboutScreenDestination.title)) }
|
||||
)
|
||||
|
|
@ -109,7 +111,7 @@ fun AppBar(navController: NavController) {
|
|||
DropdownMenuItem(
|
||||
onClick = {
|
||||
isMenuExpanded = false
|
||||
navController.navigate(SettingsScreenDestination.route)
|
||||
navController.navigateTo(SettingsScreenDestination)
|
||||
},
|
||||
text = { Text(stringResource(SettingsScreenDestination.title)) }
|
||||
)
|
||||
|
|
|
|||
|
|
@ -28,11 +28,11 @@ import com.ramcosta.composedestinations.rememberNavHostEngine
|
|||
fun ManagerScaffold() {
|
||||
val navController = rememberNavController()
|
||||
|
||||
Scaffold(
|
||||
topBar = { AppBar(navController) }
|
||||
) { paddingValues ->
|
||||
val storagePermissionState = rememberPermissionState(Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||
val storagePermissionState = rememberPermissionState(Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||
|
||||
Scaffold(
|
||||
topBar = { if (storagePermissionState.hasPermission) AppBar(navController) }
|
||||
) { paddingValues ->
|
||||
PermissionRequired(
|
||||
permissionState = storagePermissionState,
|
||||
permissionNotAvailableContent = { GrantPermission(storagePermissionState) },
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue