Fix permission bug with avatar gallery selection.

This commit is contained in:
Cody Henthorne 2020-10-30 11:36:12 -04:00 committed by GitHub
parent 5f6d971bf7
commit d36ec9af47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -112,6 +112,14 @@ public class AvatarSelectionBottomSheetDialogFragment extends BottomSheetDialogF
.onAnyDenied(() -> Toast.makeText(requireContext(), R.string.AvatarSelectionBottomSheetDialogFragment__taking_a_photo_requires_the_camera_permission, Toast.LENGTH_SHORT) .onAnyDenied(() -> Toast.makeText(requireContext(), R.string.AvatarSelectionBottomSheetDialogFragment__taking_a_photo_requires_the_camera_permission, Toast.LENGTH_SHORT)
.show()) .show())
.execute(); .execute();
} else if (option == SelectionOption.GALLERY) {
Permissions.with(this)
.request(Manifest.permission.READ_EXTERNAL_STORAGE)
.ifNecessary()
.onAllGranted(() -> launchOptionAndDismiss(option))
.onAnyDenied(() -> Toast.makeText(requireContext(), R.string.AvatarSelectionBottomSheetDialogFragment__viewing_your_gallery_requires_the_storage_permission, Toast.LENGTH_SHORT)
.show())
.execute();
} else { } else {
launchOptionAndDismiss(option); launchOptionAndDismiss(option);
} }

View File

@ -427,6 +427,7 @@
<string name="AvatarSelectionBottomSheetDialogFragment__choose_from_gallery">Choose from gallery</string> <string name="AvatarSelectionBottomSheetDialogFragment__choose_from_gallery">Choose from gallery</string>
<string name="AvatarSelectionBottomSheetDialogFragment__remove_photo">Remove photo</string> <string name="AvatarSelectionBottomSheetDialogFragment__remove_photo">Remove photo</string>
<string name="AvatarSelectionBottomSheetDialogFragment__taking_a_photo_requires_the_camera_permission">Taking a photo requires the camera permission.</string> <string name="AvatarSelectionBottomSheetDialogFragment__taking_a_photo_requires_the_camera_permission">Taking a photo requires the camera permission.</string>
<string name="AvatarSelectionBottomSheetDialogFragment__viewing_your_gallery_requires_the_storage_permission">Viewing your gallery requires the storage permission.</string>
<!-- DateUtils --> <!-- DateUtils -->
<string name="DateUtils_just_now">Now</string> <string name="DateUtils_just_now">Now</string>