In my code, I am checking whether all permissions are revoked with the Accompanist library's MultiplePermissionsState.revokedPermissions
method, and, for some reason, it always indicates that all permissions are revoked in the beginning but then shows the correct number after at least one permission is revoked. What could be wrong with the code? I'm using the following dependency:
implementation "com.google.accompanist:accompanist-permissions:0.26.1-alpha"
if (multiplePermissionsState.allPermissionsGranted) {
// If all permissions are granted, then show screen with the feature enabled
Text("Camera and Read storage permissions Granted! Thank you!")
} else if(
!multiplePermissionsState.shouldShowRationale &&
multiplePermissionsState.revokedPermissions.size == multiplePermissionsState.permissions.size
) {
PermissionsPermanentlyDeniedAlertDialog(
onDismissRequest = { showPermissionState.value = false },
onOpenSettingsClick = { },
textToShow = "You permanently denied all the permissions. Please go to settings to grant those permissions."
)
} else {
if(multiplePermissionsState.shouldShowRationale){
Rationale(
text = getTextToShowGivenPermissions(
multiplePermissionsState.revokedPermissions,
multiplePermissionsState.shouldShowRationale
),
onDismissRequest = { showPermissionState.value = false },
onRequestPermission = {
multiplePermissionsState.launchMultiplePermissionRequest()
}
)
} else {
SideEffect {
multiplePermissionsState.launchMultiplePermissionRequest()
}
}
}