fix: crash after accepting permission on Android 13+

This commit is contained in:
darthpaul 2022-10-09 02:33:35 +01:00
parent 57d93f8c31
commit 815287b9b2
1 changed files with 2 additions and 4 deletions

View File

@ -251,9 +251,7 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera
if (isTiramisuPlus()) {
handlePermission(PERMISSION_READ_MEDIA_IMAGES) { grantedReadImages ->
if (grantedReadImages) {
handlePermission(PERMISSION_READ_MEDIA_VIDEO) { grantedReadVideos ->
callback.invoke(grantedReadVideos)
}
handlePermission(PERMISSION_READ_MEDIA_VIDEO, callback)
} else {
callback.invoke(false)
}
@ -553,7 +551,7 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera
private fun hasPhotoModePermissions(): Boolean {
return if (isTiramisuPlus()) {
hasPermission(PERMISSION_READ_MEDIA_IMAGES) && hasPermission(PERMISSION_CAMERA)
hasPermission(PERMISSION_READ_MEDIA_IMAGES) && hasPermission(PERMISSION_READ_MEDIA_VIDEO) && hasPermission(PERMISSION_CAMERA)
} else {
hasPermission(PERMISSION_WRITE_STORAGE) && hasPermission(PERMISSION_CAMERA)
}