Skip to content

Commit

Permalink
Remove not-needed permissions for the Camera function
Browse files Browse the repository at this point in the history
The pictures are saved to our own folder, so we don't need any permissions to read them, and the Camera app is granted permissions to write to them via the FileProvider.
  • Loading branch information
hichamboushaba committed Jul 24, 2024
1 parent 62b29b9 commit ae9b5f5
Showing 1 changed file with 2 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,28 +55,18 @@ internal class MediaPickerPermissionUtils @Inject constructor(
}

fun hasPermissionsToTakePhotos(): Boolean {
return hasCameraPermission() && (VERSION.SDK_INT > VERSION_CODES.P || hasWriteStoragePermission())
return hasCameraPermission()
}

val permissionsForTakingPhotos: List<PermissionsRequested>
get() = if (VERSION.SDK_INT > VERSION_CODES.P) {
listOf(CAMERA)
} else {
listOf(CAMERA, WRITE_STORAGE)
}
get() = listOf(CAMERA)

fun hasReadStoragePermission(): Boolean {
return ContextCompat.checkSelfPermission(
context, permission.READ_EXTERNAL_STORAGE
) == PackageManager.PERMISSION_GRANTED
}

private fun hasWriteStoragePermission(): Boolean {
return ContextCompat.checkSelfPermission(
context, permission.WRITE_EXTERNAL_STORAGE
) == PackageManager.PERMISSION_GRANTED
}

private fun hasCameraPermission(): Boolean {
return ContextCompat.checkSelfPermission(
context,
Expand Down

0 comments on commit ae9b5f5

Please sign in to comment.