Conversation
Core Location has two iOS behaviours the plugin never surfaced, both of which matter to apps recording continuous tracks. `CLLocationManager.activityType` was left at Core Location's `.other` default, so an app had no way to describe the kind of movement it is recording. Apple documents the property as a hint for how fixes are acquired and processed: it informs when updates may be paused automatically, and for `automotiveNavigation` that reported positions may be adjusted towards nearby roads. Adds `Location.setActivityType()` and the `LocationActivityType` enum. The call returns the activity type actually in effect afterwards, read back from the native manager, so callers can confirm what was applied instead of assuming it (Lyokone#602). `locationManagerDidPauseLocationUpdates(_:)` was not implemented, so a pause Core Location decided on by itself was only ever visible as an absence of updates, which is indistinguishable from a location stream that has broken. Adds `Location.onLocationUpdatesPaused`, emitting `true` on pause and `false` on resume. Both are iOS-only: `setActivityType` returns `null` and `onLocationUpdatesPaused` stays empty on Android, macOS and web, which have no equivalent setting. The platform interface gives both members benign default implementations rather than throwing `UnimplementedError`, so third-party platform implementations keep compiling untouched. `LocationActivityType` crosses the method channel by index, so its declaration order mirrors `CLActivityType`'s raw values and is pinned by a test. Bumps location to 10.1.0 and location_platform_interface to 7.1.0, with CHANGELOG, README and docs updates, unit tests for both packages, and regenerated mockito mocks.
|
To preview the documentation for this pull request, visit the following URL: docs.page/lyokone/flutterlocation~1103
|
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.
Core Location has two iOS behaviours the plugin never surfaced, both of which matter to apps recording continuous tracks.
CLLocationManager.activityTypewas left at Core Location's.otherdefault, so an app had no way to describe the kind of movement it is recording. Apple documents the property as a hint for how fixes are acquired and processed: it informs when updates may be paused automatically, and forautomotiveNavigationthat reported positions may be adjusted towards nearby roads. AddsLocation.setActivityType()and theLocationActivityTypeenum. The call returns the activity type actually in effect afterwards, read back from the native manager, so callers can confirm what was applied instead of assuming it (#602).locationManagerDidPauseLocationUpdates(_:)was not implemented, so a pause Core Location decided on by itself was only ever visible as an absence of updates, which is indistinguishable from a location stream that has broken. AddsLocation.onLocationUpdatesPaused, emittingtrueon pause andfalseon resume.Both are iOS-only:
setActivityTypereturnsnullandonLocationUpdatesPausedstays empty on Android, macOS and web, which have no equivalent setting. The platform interface gives both members benign default implementations rather than throwingUnimplementedError, so third-party platform implementations keep compiling untouched.LocationActivityTypecrosses the method channel by index, so its declaration order mirrorsCLActivityType's raw values and is pinned by a test.Bumps location to 10.1.0 and location_platform_interface to 7.1.0, with CHANGELOG, README and docs updates, unit tests for both packages, and regenerated mockito mocks.