Skip to content

Commit

Permalink
Fix permission bug with avatar gallery selection.
Browse files Browse the repository at this point in the history
  • Loading branch information
cody-signal committed Oct 30, 2020
1 parent 5f6d971 commit d36ec9a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ private void askForPermissionIfNeededAndLaunch(@NonNull SelectionOption option)
.onAnyDenied(() -> Toast.makeText(requireContext(), R.string.AvatarSelectionBottomSheetDialogFragment__taking_a_photo_requires_the_camera_permission, Toast.LENGTH_SHORT)
.show())
.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 {
launchOptionAndDismiss(option);
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@
<string name="AvatarSelectionBottomSheetDialogFragment__choose_from_gallery">Choose from gallery</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__viewing_your_gallery_requires_the_storage_permission">Viewing your gallery requires the storage permission.</string>

<!-- DateUtils -->
<string name="DateUtils_just_now">Now</string>
Expand Down

0 comments on commit d36ec9a

Please sign in to comment.