[mob][photos] Request for ACCESS_MEDIA_LOCATION permission if not granted (#1600)

## Description


a5d05decf2/mobile/lib/utils/photo_manager_util.dart (L8)

^passing true here should let the app have `ACCESS_MEDIA_LOCATION`
permission. But looks like that isn't working for a small set of users.
So, asking for permission explicitly.
This commit is contained in:
Vishnu Mohandas 2024-05-03 15:42:47 +05:30 committed by GitHub
commit 27ef12b222
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -376,7 +376,13 @@ class FileUploader {
if (Platform.isAndroid) {
final bool hasPermission = await Permission.accessMediaLocation.isGranted;
if (!hasPermission) {
throw NoMediaLocationAccessError();
final permissionStatus = await Permission.accessMediaLocation.request();
if (!permissionStatus.isGranted) {
_logger.severe(
"Media location access denied with permission status: ${permissionStatus.name}",
);
throw NoMediaLocationAccessError();
}
}
}
}