Repository navigation
Allow querying Bluetooth service status on iOS (Apple) - #1100
Merged
Merged
Conversation
9 of 10 tasks
This was referenced Jul 11, 2023
mvanbeusekom
requested changes
Jul 12, 2023
mvanbeusekom
left a comment
Member
There was a problem hiding this comment.
The update to use a completion block looks really useful. The current implementation however does contain a bug (see comment).
Additionally I feel the BluetoothPermissionStrategy.checkServiceStatus might not cover all cases where the service is enabled.
9 of 10 tasks
Makes `checkServiceStatus` async. Keeps track of `PermissionStrategy` in `PermissionManager`. Updates example app's displayed permissions.
3 of 5 tasks
10 tasks done
mvanbeusekom
added a commit
that referenced
this pull request
Oct 23, 2026
…in thread (#1573) `NotificationPermissionStrategy` and `CriticalAlertsPermissionStrategy` waited for `getNotificationSettingsWithCompletionHandler:` with `dispatch_semaphore_wait(DISPATCH_TIME_FOREVER)` on the platform (main) thread. When the settings are delivered on the main queue (iOS 27) the wait never ends and the app freezes, typically on the launch screen. Following the approach of #1100 for `checkServiceStatus`: - `PermissionStrategy` gains an optional asynchronous `checkPermissionStatus:completionHandler:`; every other strategy keeps its synchronous path. - `+[PermissionManager checkPermissionStatus:result:]` uses it when the strategy responds to the selector and calls `result` on the main queue. - Both strategies implement it on top of `getNotificationSettingsWithCompletionHandler:` without a semaphore and use the same asynchronous check in `requestPermission:`. The status mapping is unchanged. Adds a `RunnerTests` target to the example with a test that calls the plugin on the main thread and fails when the status is resolved synchronously. Fixes #1420 Co-authored-by: Maurits van Beusekom <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR updates the Apple implementation, fixing an issue where the Bluetooth service status was never resolved properly. To this end it
checkServiceStatusasyncPermissionStrategyinPermissionManager(hold the reference to guarantee that the callback fires)Additionally, it updates the displayed permission in the example app, as these were out of sync with the newest permissions.
This PR is part of feature #773.
Pre-launch Checklist
pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or this PR is does not need version changes.CHANGELOG.mdto add a description of the change.///).main.dart format .and committed any changes.flutter analyzeand fixed any errors.