Skip to content

Commit 81c05b1

Browse files
committed
fix required permission not requested
1 parent c6f239c commit 81c05b1

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

lib/flutter_force_permission.dart

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,15 @@ class FlutterForcePermission {
4848
var needShow = false;
4949
for (final permConfig in config.permissionItemConfigs) {
5050
for (final perm in permConfig.permissions) {
51-
if (!(permissionStatuses[perm]?.requested ?? true)) {
52-
if (permissionStatuses[perm]?.status != PermissionStatus.granted &&
53-
permConfig.required) {
54-
needShow = true;
55-
break;
56-
}
57-
if (perm is PermissionWithService &&
58-
permissionStatuses[perm]?.serviceStatus == ServiceStatus.disabled &&
59-
permConfig.required) {
60-
needShow = true;
61-
break;
62-
}
51+
if (permissionStatuses[perm]?.status != PermissionStatus.granted &&
52+
(permConfig.required || !(permissionStatuses[perm]?.requested ?? true))) {
53+
needShow = true;
54+
break;
55+
}
56+
if (perm is PermissionWithService &&
57+
permissionStatuses[perm]?.serviceStatus == ServiceStatus.disabled &&
58+
permConfig.required) {
59+
needShow = true;
6360
break;
6461
}
6562
}

0 commit comments

Comments
 (0)