|
|
@@ -33,7 +33,7 @@ class ImagePickerUtil {
|
|
|
} else {
|
|
|
// iOS 请求照片权限
|
|
|
final status = await Permission.photos.request();
|
|
|
- return status.isGranted;
|
|
|
+ return status.isGranted || status.isLimited;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -53,7 +53,7 @@ class ImagePickerUtil {
|
|
|
} else {
|
|
|
// iOS 判断照片权限
|
|
|
final status = await Permission.photos.status;
|
|
|
- return status.isGranted;
|
|
|
+ return status.isGranted || status.isLimited;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -83,34 +83,34 @@ class ImagePickerUtil {
|
|
|
required int maxAssetsCount,
|
|
|
List<AssetEntity> selectedAssets = const [],
|
|
|
}) async {
|
|
|
- bool isAllow = await ImagePickerUtil.hasPermission();
|
|
|
+ bool isAllow = await ImagePickerUtil.requestPermissionExtend();
|
|
|
if (!isAllow) {
|
|
|
- bool shouldProceed = await PermissionDialog.showRequestDialog(
|
|
|
- StringName.permissionDialogTitle,
|
|
|
- PermissionDialog.buildStorageView(),
|
|
|
- StringName.permissionDialogAuthorize,
|
|
|
- "使用该功能App需要访问您设备“照片和媒体”权限,开启权限后,您可以上传图片使用该功能使用",
|
|
|
- sureClick: () async {
|
|
|
- bool granted = await ImagePickerUtil.requestPermissionExtend();
|
|
|
- if (!granted &&
|
|
|
- await ImagePickerUtil.isPermissionPermanentlyDenied()) {
|
|
|
- Future.delayed(const Duration(milliseconds: 400), () {
|
|
|
- AppSettingUtil.jumpSystemAppSetting();
|
|
|
- });
|
|
|
- }
|
|
|
- return granted;
|
|
|
- },
|
|
|
- );
|
|
|
- if (shouldProceed) {
|
|
|
- return await pickImage(
|
|
|
- context,
|
|
|
- maxAssetsCount: maxAssetsCount,
|
|
|
- selectedAssets: selectedAssets,
|
|
|
- );
|
|
|
- } else {
|
|
|
+ // bool shouldProceed = await PermissionDialog.showRequestDialog(
|
|
|
+ // StringName.permissionDialogTitle,
|
|
|
+ // PermissionDialog.buildStorageView(),
|
|
|
+ // StringName.permissionDialogAuthorize,
|
|
|
+ // "使用该功能App需要访问您设备“照片和媒体”权限,开启权限后,您可以上传图片使用该功能使用",
|
|
|
+ // sureClick: () async {
|
|
|
+ // bool granted = await ImagePickerUtil.requestPermissionExtend();
|
|
|
+ // if (!granted &&
|
|
|
+ // await ImagePickerUtil.isPermissionPermanentlyDenied()) {
|
|
|
+ // Future.delayed(const Duration(milliseconds: 400), () {
|
|
|
+ // AppSettingUtil.jumpSystemAppSetting();
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // return granted;
|
|
|
+ // },
|
|
|
+ // );
|
|
|
+ // if (shouldProceed) {
|
|
|
+ // return await pickImage(
|
|
|
+ // context,
|
|
|
+ // maxAssetsCount: maxAssetsCount,
|
|
|
+ // selectedAssets: selectedAssets,
|
|
|
+ // );
|
|
|
+ // } else {
|
|
|
ToastUtil.show(StringName.pickerImagePermissionDeniedTip);
|
|
|
return null;
|
|
|
- }
|
|
|
+ // }
|
|
|
}
|
|
|
// 2. 权限已授权,打开选择器
|
|
|
try {
|