Permission page is now showing if all the permissions are not granted (while locking the user out).
This commit is contained in:
parent
d11f58b716
commit
5ef0bf7160
@ -35,6 +35,9 @@
|
||||
<entry key="../../../../../layout/compose-model-1641294737726.xml" value="0.38796296296296295" />
|
||||
<entry key="../../../../../layout/compose-model-1641305520689.xml" value="0.38796296296296295" />
|
||||
<entry key="../../../../../layout/compose-model-1641310759461.xml" value="0.38796296296296295" />
|
||||
<entry key="../../../../../layout/compose-model-1641313051635.xml" value="0.3861111111111111" />
|
||||
<entry key="../../../../../layout/compose-model-1641313223231.xml" value="0.3861111111111111" />
|
||||
<entry key="../../../../../layout/compose-model-1641313346209.xml" value="0.3861111111111111" />
|
||||
<entry key="app/src/main/res/drawable-v24/ic_launcher_foreground.xml" value="0.5307291666666667" />
|
||||
<entry key="app/src/main/res/drawable/ic_baseline_arrow_back_24.xml" value="0.38981481481481484" />
|
||||
<entry key="app/src/main/res/drawable/ic_baseline_keyboard_24.xml" value="0.38981481481481484" />
|
||||
|
@ -8,11 +8,22 @@ import androidx.navigation.compose.rememberNavController
|
||||
import ch.mathieubroillet.jarvis.android.pages.DisplayMainPage
|
||||
import ch.mathieubroillet.jarvis.android.pages.DisplayPermissionsPage
|
||||
import ch.mathieubroillet.jarvis.android.pages.DisplaySettingsPage
|
||||
import com.google.accompanist.permissions.ExperimentalPermissionsApi
|
||||
import com.google.accompanist.permissions.rememberMultiplePermissionsState
|
||||
|
||||
@OptIn(ExperimentalPermissionsApi::class)
|
||||
@Composable
|
||||
fun Navigation() {
|
||||
val navController = rememberNavController()
|
||||
NavHost(navController = navController, startDestination = Screen.MainScreen.route) {
|
||||
|
||||
val permissions = listOf(android.Manifest.permission.RECORD_AUDIO)
|
||||
val permissionState = rememberMultiplePermissionsState(permissions)
|
||||
|
||||
|
||||
NavHost(
|
||||
navController = navController,
|
||||
startDestination = if (permissionState.allPermissionsGranted) Screen.MainScreen.route else Screen.PermissionsScreen.route
|
||||
) {
|
||||
composable(route = Screen.MainScreen.route) {
|
||||
MainScreen(navController = navController)
|
||||
}
|
||||
|
@ -30,7 +30,11 @@ fun DisplayPermissionsPage(navController: NavController) {
|
||||
|
||||
@Composable
|
||||
fun PermissionsBase(navController: NavController) {
|
||||
Column(Modifier.padding(bottom = 25.dp)) {
|
||||
Column(
|
||||
Modifier
|
||||
.padding(bottom = 25.dp)
|
||||
.fillMaxSize()
|
||||
) {
|
||||
Row {
|
||||
Icon(
|
||||
painter = painterResource(id = R.drawable.ic_baseline_shield_24),
|
||||
|
@ -14,14 +14,14 @@ import com.google.accompanist.permissions.rememberPermissionState
|
||||
@OptIn(ExperimentalPermissionsApi::class)
|
||||
@Composable
|
||||
fun requestPermission(permission: String) {
|
||||
val cameraPermissionState = rememberPermissionState(permission = permission)
|
||||
val permissionState = rememberPermissionState(permission = permission)
|
||||
val context = LocalContext.current
|
||||
|
||||
PermissionRequired(
|
||||
permissionState = cameraPermissionState,
|
||||
permissionState = permissionState,
|
||||
permissionNotGrantedContent = {
|
||||
Button(onClick = {
|
||||
cameraPermissionState.launchPermissionRequest()
|
||||
permissionState.launchPermissionRequest()
|
||||
}) {
|
||||
Text(text = stringResource(id = R.string.permissions_page_grant_permission))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user