upgrade "permission_handler" dependency in example app and request correct permission after android 33

This commit is contained in:
Wenqi Li 2023-05-14 02:23:49 +08:00
parent 88e0ad714b
commit eafedcb225
3 changed files with 17 additions and 11 deletions

View File

@ -1,6 +1,6 @@
PODS: PODS:
- Flutter (1.0.0) - Flutter (1.0.0)
- "permission_handler (5.1.0+2)": - permission_handler_apple (9.0.4):
- Flutter - Flutter
- photo_gallery (0.0.1): - photo_gallery (0.0.1):
- Flutter - Flutter
@ -9,15 +9,15 @@ PODS:
DEPENDENCIES: DEPENDENCIES:
- Flutter (from `Flutter`) - Flutter (from `Flutter`)
- permission_handler (from `.symlinks/plugins/permission_handler/ios`) - permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- photo_gallery (from `.symlinks/plugins/photo_gallery/ios`) - photo_gallery (from `.symlinks/plugins/photo_gallery/ios`)
- video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/ios`) - video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/ios`)
EXTERNAL SOURCES: EXTERNAL SOURCES:
Flutter: Flutter:
:path: Flutter :path: Flutter
permission_handler: permission_handler_apple:
:path: ".symlinks/plugins/permission_handler/ios" :path: ".symlinks/plugins/permission_handler_apple/ios"
photo_gallery: photo_gallery:
:path: ".symlinks/plugins/photo_gallery/ios" :path: ".symlinks/plugins/photo_gallery/ios"
video_player_avfoundation: video_player_avfoundation:
@ -25,7 +25,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS: SPEC CHECKSUMS:
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0 permission_handler_apple: 44366e37eaf29454a1e7b1b7d736c2cceaeb17ce
photo_gallery: 9f95e57747cd22c10676ece3660d1ffe6c603ee5 photo_gallery: 9f95e57747cd22c10676ece3660d1ffe6c603ee5
video_player_avfoundation: 81e49bb3d9fb63dccf9fa0f6d877dc3ddbeac126 video_player_avfoundation: 81e49bb3d9fb63dccf9fa0f6d877dc3ddbeac126

View File

@ -41,12 +41,18 @@ class _MyAppState extends State<MyApp> {
} }
Future<bool> _promptPermissionSetting() async { Future<bool> _promptPermissionSetting() async {
if (Platform.isIOS && if (Platform.isIOS) {
await Permission.storage.request().isGranted && if (await Permission.storage.request().isGranted) {
await Permission.photos.request().isGranted ||
Platform.isAndroid && await Permission.storage.request().isGranted) {
return true; return true;
} }
}
if (Platform.isAndroid) {
if (await Permission.storage.request().isGranted ||
await Permission.photos.request().isGranted &&
await Permission.videos.request().isGranted) {
return true;
}
}
return false; return false;
} }

View File

@ -24,7 +24,7 @@ dependencies:
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2 cupertino_icons: ^1.0.2
transparent_image: ^2.0.0 transparent_image: ^2.0.0
permission_handler: ^6.1.1 permission_handler: ^10.2.0
video_player: ^2.6.1 video_player: ^2.6.1
dev_dependencies: dev_dependencies: