Skip to content

Allow querying Bluetooth service status on iOS (platform interface) - #1099

Merged
mvanbeusekom merged 2 commits into
Baseflow:mainfrom
JeroenWeener:773/platform-interface
Jul 12, 2023
Merged

mvanbeusekom merged 2 commits into
Baseflow:mainfrom
JeroenWeener:773/platform-interface

Conversation

@JeroenWeener

Copy link
Copy Markdown
Contributor

This PR updates the platform interface. It changes Permission.bluetooth from type Permission to type PermissionWithService, allowing iOS to provide the service's status.

Additionally, it cleans up the documentation of the permissions.

This PR is part of feature #773.

Pre-launch Checklist

  • I made sure the project builds.
  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is does not need version changes.
  • I updated CHANGELOG.md to add a description of the change.
  • I updated/added relevant documentation (doc comments with ///).
  • I rebased onto main.
  • I added new tests to check the change I am making, or this PR does not need tests.
  • I made sure all existing and new tests are passing.
  • I ran dart format . and committed any changes.
  • I ran flutter analyze and fixed any errors.

@mvanbeusekom mvanbeusekom left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throughout the PR there are some additional spaces injected and I was wondering why?

It looks like you are trying to improve the distinction between Android and iOS specific documentation. If this is the case maybe we should restructure the documentation and start using markdown lists.

Maybe we should always start the documentation with one general sentence and than split out into a list. For example the documentation for the locationAlways permission could be written like this (note that just like Dart code I tried to keep the max line length at 80 characters):

  /// Request permission to query location data when the application is running
  /// in the background.
  ///
  /// Depending on the platform and version the requirements are slightly 
  /// different:
  /// 
  /// **Android:**
  /// - When running on Android Q and above: Background Location Permission
  /// - When running on Android < Q: Fine and Coarse Location
  /// 
  /// **iOS:**
  /// - When requesting this permission the user needs to grant permission
  /// for the `locationWhenInUse` permission first, clicking on the 
  /// `Allow While Using App` option on the popup. After allowing the 
  /// permission the user can request the `locationAlways` permission and can
  /// click on the `Change To Always Allow` option.

Comment on lines +100 to +106
/// always returns `PermissionStatus.denied`, instead use
/// `Permission.photos`, `Permission.video`, `Permission.audio` or
/// `Permission.manageExternalStorage`. For more information see our
/// [FAQ](https://pub.dev/packages/permission_handler#faq).
/// On Android < TIRAMISU the `READ_EXTERNAL_STORAGE` and
/// `WRITE_EXTERNAL_STORAGE` permissions are requested (depending on the
/// definitions in the AndroidManifest.xml) file.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: what is the reason for the extra spaces here? It looks a bit strange as the first line is indented 2 spaces, while the second line (of the same sentence) is indented 4 spaces.

If the idea is to make it clear there are two different options lets convert it into a list using an dash (-) or asterisk (*).


/// Android: Allows an application a broad access to external storage in
/// scoped storage.
/// scoped storage.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: redundant spacing

Suggested change
/// scoped storage.
/// scoped storage.

Comment on lines +165 to +166
/// shares it with other companies for purposes of tracking across apps and
/// websites.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: redundant spacing

Suggested change
/// shares it with other companies for purposes of tracking across apps and
/// websites.
/// shares it with other companies for purposes of tracking across apps and
/// websites.

///(e.g. BLE peripherals).
///iOS: Nothing
/// Android: Allows the user to look for Bluetooth devices
/// (e.g. BLE peripherals).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: redundant spacing:

Suggested change
/// (e.g. BLE peripherals).
/// (e.g. BLE peripherals).

///Bluetooth devices.
///iOS: Nothing
/// Android: Allows the user to make this device discoverable to other
/// Bluetooth devices.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: redundant spacing:

Suggested change
/// Bluetooth devices.
/// Bluetooth devices.

@JeroenWeener
JeroenWeener force-pushed the 773/platform-interface branch from d63754f to ef17d12 Compare July 12, 2023 08:39
@codecov

codecov Bot commented Jul 12, 2023 •

Copy link
Copy Markdown

Codecov Report

Patch coverage has no change and project coverage change: -6.53 ⚠️

Comparison is base (934fe83) 100.00% compared to head (ef17d12) 93.47%.

Additional details and impacted files
@@             Coverage Diff             @@
##              main    #1099      +/-   ##
===========================================
- Coverage   100.00%   93.47%   -6.53%     
===========================================
  Files            1        6       +5     
  Lines           17       92      +75     
===========================================
+ Hits            17       86      +69     
- Misses           0        6       +6     
Flag Coverage Δ
unittests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...andler_platform_interface/lib/src/permissions.dart 91.66% <ø> (ø)

... and 6 files with indirect coverage changes

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

@mvanbeusekom mvanbeusekom left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it! Documentation is much better this way, thanks!

@mvanbeusekom
mvanbeusekom merged commit 0be05e5 into Baseflow:main Jul 12, 2023
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.

2 participants