diff options
author | jmkiley <jordan.kiley@mapbox.com> | 2019-01-23 17:21:15 -0800 |
---|---|---|
committer | jmkiley <jordan.kiley@mapbox.com> | 2019-01-23 17:21:15 -0800 |
commit | 21f78fd202e856b074397b31a2a744ff474f5b64 (patch) | |
tree | 4d7685a3d03cab8f0dfda086ffe65a51d6a837ea | |
parent | 24b4ddf41628a0b0f3f0d59ac00db57ccd99a39e (diff) | |
download | qtlocation-mapboxgl-upstream/jmkiley-usertrackingmode-completion.tar.gz |
[ios] Add completion handlerupstream/jmkiley-usertrackingmode-completion
-rw-r--r-- | platform/ios/src/MGLMapView.mm | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index e473bc1c0e..d6e3a18156 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -1437,7 +1437,7 @@ public: self.mbglMap.setGestureInProgress(false); if (self.userTrackingState == MGLUserTrackingStateBegan) { - [self setUserTrackingMode:MGLUserTrackingModeNone animated:NO]; + [self setUserTrackingMode:MGLUserTrackingModeNone animated:NO completionHandler:NULL]; } [self cancelTransitions]; @@ -5188,7 +5188,9 @@ public: [self.delegate mapViewDidStopLocatingUser:self]; } - [self setUserTrackingMode:MGLUserTrackingModeNone animated:YES]; + [self setUserTrackingMode:MGLUserTrackingModeNone animated:YES completionHandler:^{ + MGLLogInfo(@"All done with setting the user tracking mode!"); + }]; [self.userLocationAnnotationView removeFromSuperview]; self.userLocationAnnotationView = nil; @@ -5229,11 +5231,13 @@ public: - (void)setUserTrackingMode:(MGLUserTrackingMode)mode { MGLLogDebug(@"Setting userTrackingMode: %lu", mode); - [self setUserTrackingMode:mode animated:YES]; + [self setUserTrackingMode:mode animated:YES completionHandler:^{ + MGLLogDebug(@"Finished sertting userTrackingMode: %lu", mode); + }]; } - (void)setUserTrackingMode:(MGLUserTrackingMode)mode animated:(BOOL)animated -{ + completionHandler:(void (^)(void))completion { MGLLogDebug(@"Setting userTrackingMode: %lu animated: %@", mode, MGLStringFromBOOL(animated)); if (mode == _userTrackingMode) return; @@ -5292,6 +5296,10 @@ public: if (location && self.userLocationAnnotationView) { [self locationManager:self.locationManager didUpdateLocations:@[location] animated:animated]; + if (completion) { + MGLLogInfo(@"Animation is done, userTrackingMode = %lu", mode); + completion(); + } } } |