Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added show user location and tracking for iOS #76

Merged
merged 10 commits into from
Nov 9, 2019

Conversation

kayleg
Copy link
Contributor

@kayleg kayleg commented May 9, 2019

Added support for myLocation and myLocationTrackingMode for iOS.
Added a new callback for onCameraTrackingModeChanged (iOS doesn't have a simple dismissed)

ezgif com-resize

Note:
I'm fairly new to Flutter and this was my first go at connecting to native code. I followed the existing setup.

@tobrun
Copy link
Collaborator

tobrun commented Jun 9, 2019

This is great stuff @kayleg. Thank you for contributing!

@tobrun tobrun added the ios label Jun 9, 2019
@tobrun tobrun added this to the v0.0.4 milestone Jun 9, 2019
@@ -37,21 +40,24 @@ class MapboxMapController extends ChangeNotifier {
static Future<MapboxMapController> init(
int id, CameraPosition initialCameraPosition,
{OnMapClickCallback onMapClick,
OnCameraTrackingDismissedCallback onCameraTrackingDismissed}) async {
OnCameraTrackingDismissedCallback onCameraTrackingDismissed,
onCameraTrackingChanged}) async {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add OnCameraTrackingChangedCallback type to onCameraTrackingChanged

Copy link
Collaborator

@andrea689 andrea689 left a comment

Choose a reason for hiding this comment

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

Fix indentation of swift file, you have used two space, but the code have four space indentation.

private func updateMyLocationEnabled() {
//TODO
mapView.showsUserLocation = self.myLocationEnabled
mapView.userTrackingMode = .followWithHeading
Copy link
Collaborator

@andrea689 andrea689 Jun 15, 2019

Choose a reason for hiding this comment

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

remove this line mapView.userTrackingMode = .followWithHeading

Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as @andrea689. The user tracking mode is set by a different method.


func mapView(_ mapView: MGLMapView, didChange mode:
MGLUserTrackingMode, animated: Bool) {
channel.invokeMethod("map#onCameraTrackingChanged", arguments: ["mode": mode.rawValue])
Copy link
Collaborator

Choose a reason for hiding this comment

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

Given that iOS don't have onCameraTrackingDismissed, to maintain compatibility with Android when mode is equals to MGLUserTrackingModeNone invoke this method map#onCameraTrackingDismissed

@tobrun
Copy link
Collaborator

tobrun commented Oct 28, 2019

@TimothySealy would you be able to give this PR a review?

TimothySealy and others added 2 commits October 28, 2019 11:27
* Passing map style to iOS map (MGLMapView).

* Moved map style lookup table to a separate file.

* Renamed style parameter to styleString.

* Moved the lookup behind a fromUrl function.

* Added checks for empty styleString and JSON styleStrings.

* Updated minimum Android SDK version to 20 (this required for flutter platform views).

* Updated mapbox SDK for Android. Updated code to make it compatible with the new SDK.

* Updated Mabox SDk for iOS

* Replaced zIndex with SymbolSortKey.
Copy link
Collaborator

@TimothySealy TimothySealy left a comment

Choose a reason for hiding this comment

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

Some minor changes are required on iOS. On Android the updateMyLocationEnabled method still needs to be implemented.

private func updateMyLocationEnabled() {
//TODO
mapView.showsUserLocation = self.myLocationEnabled
mapView.userTrackingMode = .followWithHeading
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as @andrea689. The user tracking mode is set by a different method.

@kayleg
Copy link
Contributor Author

kayleg commented Nov 9, 2019

Requested changes have been made

@TimothySealy TimothySealy merged commit 0862f28 into flutter-mapbox-gl:master Nov 9, 2019
@tobrun tobrun modified the milestones: v0.0.4, v0.0.5 Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants