Skip to content

Made bluetooth an instance of PermissionWithService - #942

Closed
ChopinDavid wants to merge 2 commits into
Baseflow:mainfrom
ChopinDavid:master
Closed

ChopinDavid wants to merge 2 commits into
Baseflow:mainfrom
ChopinDavid:master

Conversation

@ChopinDavid

@ChopinDavid ChopinDavid commented Oct 18, 2022 •

Copy link
Copy Markdown

Closes #773.

✨ What kind of change does this PR introduce? (Bug fix, feature, docs update...)

This allows users to access Permission.bluetooth.serviceStatus

⤵️ What is the current behavior?

Users can only access Permission.bluetooth.status

🆕 What is the new behavior (if this is a feature change)?

Users can access both Permission.bluetooth.status and Permission.bluetooth.serviceStatus

💥 Does this PR introduce a breaking change?

Not that I know of

🐛 Recommendations for testing

Try determining iOS's CBManagerStatePoweredOn via Permission.bluetooth.serviceStatus

📝 Links to relevant issues/docs

On BluetoothPermissionStrategy.m line 36, there exists a means to view the iOS device's CBManagerStatePoweredOn. However, there doesn't appear to be a way to ever actually determine this status from the Flutter side as only PermissionWithServices can get serviceStatus (permission_handler.dart line 97). bluetooth is an instance of Permission, not PermissionWithService, thus we can never invoke serviceStatus, meaning we will never invoke a checkServiceStatus method to native iOS with bluetooth permission group.

🤔 Checklist before submitting

  • I made sure all projects build.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy.
  • I updated CHANGELOG.md to add a description of the change.
  • I followed the style guide lines (code style guide).
  • I updated the relevant documentation.
  • I rebased onto current master.

@codecov

codecov Bot commented Oct 18, 2022

Copy link
Copy Markdown

Codecov Report

Base: 86.51% // Head: 86.51% // No change to project coverage 👍

Coverage data is based on head (849a716) compared to base (f1efd8b).
Patch has no changes to coverable lines.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #942   +/-   ##
=======================================
  Coverage   86.51%   86.51%           
=======================================
  Files           6        6           
  Lines          89       89           
=======================================
  Hits           77       77           
  Misses         12       12           
Impacted Files Coverage Δ
...andler_platform_interface/lib/src/permissions.dart 91.66% <ø> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@ChopinDavid

Copy link
Copy Markdown
Author

Any chance of this getting pulled in? @Baseflow

@JeroenWeener
JeroenWeener self-requested a review July 3, 2023 13:46
@JeroenWeener

Copy link
Copy Markdown
Contributor

Hi @ChopinDavid, thank you for taking the time to create this PR for the permission handler!

First and foremost, my apologies for the late reply. We had a change in priorities for some months, which meant we were unable to keep up with issues and PRs such as yourself's. Luckily, that changed, and we can dedicate time to maintaining plugins such as the permission handler once again!

As I assumed that you might have moved on to different projects, I have pulled your code and made the necessary changes (mainly updating the version number). You can find these in #1099.
When testing the feature, I noticed that iOS always returned ServiceStatus.disabled. Due to a race condition in the Objective-C code, the service status was not resolved properly. This is fixed in #1100.
Once these two PRs are merged, we can merge #1102, making the feature available in flutter_permission_handler.

@JeroenWeener

Copy link
Copy Markdown
Contributor

Thanks again @ChopinDavid! We managed to land the feature just now. I will close this PR.

The feature is now available on the latest version of the plugin. To pull it in, just run flutter pub upgrade in your project that has a dependency on either permission_handler or permission_handler_apple. Check the pubspec.lock file to make sure the dependency to permission_handler_apple is 9.1.4. As permission_handler_apple is endorsed by permission_handler, you do not need to explicitly list it in your pubspec.yaml file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Check Bluetooth is Enable

2 participants