Skip to content

Commit daf38b1

Browse files
authored
[LocationPermission] Fix warning UI unresponsive in mainthread when c… (#1329)
* [LocationPermission] Fix warning UI unresponsive in mainthread when calling locationServicesEnabled * fix issue #1002: bump version, fix Xcode location check warning * fix issue #1002: Xcode warning of the unresponsive of main thread when checking location state * bump version to 11.3.2 * bump version to 11.3.2: update changelog and fix #1002 * update permission_handler_apple dependency to minimum 9.4.5 * revert permission_handler_apple dependency * revert CHANGELOG.md * revert pubspec.yaml
1 parent 724e327 commit daf38b1

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

permission_handler_apple/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 9.4.5
2+
3+
* Fixes issue #1002, Xcode warning of the unresponsive of main thread when checking isLocationEnabled.
4+
15
## 9.4.4
26

37
* Fixes potentially-nil return type of EventPermissionStrategy#getEntityType.

permission_handler_apple/ios/Classes/strategies/LocationPermissionStrategy.m

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,13 @@ - (PermissionStatus)checkPermissionStatus:(PermissionGroup)permission {
3636
}
3737

3838
- (void)checkServiceStatus:(PermissionGroup)permission completionHandler:(ServiceStatusHandler)completionHandler {
39-
completionHandler([CLLocationManager locationServicesEnabled] ? ServiceStatusEnabled : ServiceStatusDisabled);
39+
dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
40+
BOOL isEnabled = [CLLocationManager locationServicesEnabled];
41+
42+
dispatch_async(dispatch_get_main_queue(), ^(void) {
43+
completionHandler(isEnabled ? ServiceStatusEnabled : ServiceStatusDisabled);
44+
});
45+
});
4046
}
4147

4248
- (void)requestPermission:(PermissionGroup)permission completionHandler:(PermissionStatusHandler)completionHandler errorHandler:(PermissionErrorHandler)errorHandler {

permission_handler_apple/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: permission_handler_apple
22
description: Permission plugin for Flutter. This plugin provides the iOS API to request and check permissions.
33
repository: https://github.com/baseflow/flutter-permission-handler
44
issue_tracker: https://github.com/Baseflow/flutter-permission-handler/issues
5-
version: 9.4.4
5+
version: 9.4.5
66

77
environment:
88
sdk: ">=2.15.0 <4.0.0"

0 commit comments

Comments
 (0)