[Bug]: When I use the add photos only permission, the returned permission is always isGranted #1402
Closed
3 of 5 tasks
Labels
status: closed (missing info)
Indicates the issue was automatically closed due to a lack of information.
status: needs more info
We need more information before we can continue work on this issue.
Please check the following before submitting a new issue.
Please select affected platform(s)
Steps to reproduce
When I use the add photos only permission, the returned permission is always isGranted
Expected results
The expectation is that it should return normal, and that it should return isDenied when I reject it.
Actual results
flutter: The permissions obtained are=========PermissionStatus.granted
flutter: Allow photo saving permissions
Code sample
Permission permission;
if (await Permission.photosAddOnly.isRestricted ||
await Permission.photosAddOnly.isPermanentlyDenied) {
permission = Permission.photosAddOnly;
} else {
permission = Permission.storage;
}
// 检查权限状态
var status = await permission.status;
if (status.isDenied) {
// 如果权限被拒绝,请求权限
status = await permission.request();
}
print('The permissions obtained are=========$status');
if (status.isGranted) {
print('Allow photo saving permissions');
onJumpTab();
SensorsUtil.instance.track(
eventName: "permission_accept", properties: {"type": "选取手机照片授权"});
} else if (status.isDenied) {
// 权限被拒绝
print("Permission denied. Cannot save photos to the album.");
SensorsUtil.instance.track(
eventName: "permission_reject", properties: {"type": "选取手机照片授权"});
} else if (status.isPermanentlyDenied) {
// 权限被永久拒绝,需要去设置页面手动开启
SensorsUtil.instance.track(
eventName: "permission_reject", properties: {"type": "选取手机照片授权"});
openAppSettings();
}
Screenshots or video
Screenshots or video demonstration
[Upload media here]
Version
11.3.1
Flutter Doctor output
flutter: The permissions obtained are=========PermissionStatus.granted
flutter: Allow photo saving permissions
The text was updated successfully, but these errors were encountered: