-
Notifications
You must be signed in to change notification settings - Fork 504
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
Conversation
* Added support for sideloading map tiles
This is great stuff @kayleg. Thank you for contributing! |
lib/src/controller.dart
Outdated
@@ -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 { |
There was a problem hiding this comment.
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
There was a problem hiding this 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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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]) |
There was a problem hiding this comment.
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
@TimothySealy would you be able to give this PR a review? |
* 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.
There was a problem hiding this 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 |
There was a problem hiding this comment.
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.
Requested changes have been made |
Added support for
myLocation
andmyLocationTrackingMode
for iOS.Added a new callback for
onCameraTrackingModeChanged
(iOS doesn't have a simple dismissed)Note:
I'm fairly new to Flutter and this was my first go at connecting to native code. I followed the existing setup.