Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
hillelcoren committed Dec 1, 2023
2 parents b403b7e + a7a3aee commit 7dc89df
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions lib/utils/files.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,21 @@ Future<List<MultipartFile>?> pickFiles({
allowMultiple: allowMultiple,
);
} else {
final androidInfo = await DeviceInfoPlugin().androidInfo;
PermissionStatus status;
PermissionStatus? status;

if (Platform.isIOS && fileType == FileType.image) {
status = await Permission.photos.request();
} else if (Platform.isAndroid && androidInfo.version.sdkInt >= 33) {
status = await Permission.photos.request();
} else {
status = await Permission.storage.request();
if (Platform.isIOS) {
if (fileType == FileType.image) {
status = await Permission.photos.request();
} else {
status = await Permission.storage.request();
}
} else if (Platform.isAndroid) {
final androidInfo = await DeviceInfoPlugin().androidInfo;
if (androidInfo.version.sdkInt >= 33) {
status = await Permission.photos.request();
} else {
status = await Permission.storage.request();
}
}

if (status == PermissionStatus.granted) {
Expand Down

0 comments on commit 7dc89df

Please sign in to comment.