-
Notifications
You must be signed in to change notification settings - Fork 313
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
Use tunnel manager delegate for changing styles #1489
Conversation
Actually, this is still called on every location update: mapbox-navigation-ios/MapboxCoreNavigation/RouteController.swift Lines 652 to 661 in 36be300
We should figure out a way to call these delegate methods once per tunnel. |
@@ -586,7 +581,9 @@ extension RouteController: CLLocationManagerDelegate { | |||
self.rawLocation = lastLocation | |||
|
|||
// Check for a tunnel intersection at the current step we found the bad location update. | |||
checkForTunnelIntersection(at: lastLocation, for: manager) | |||
if tunnelSimulationEnabled { |
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.
@bsudekum we should probably let the TunnelIntersectionManager
maintain the status of the tunnelSimulationEnabled
. This will definitely come in handy for future maintenance efforts.
|
||
// `currentIntersection` is basically the intersection that you have last passed through. | ||
// While the upcoming intersection is the one you will be approaching next. | ||
// The user is essentially always between the current and upcoming intersection. |
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.
Nice 🎉
@@ -98,7 +109,7 @@ open class TunnelIntersectionManager: NSObject { | |||
isAnimationEnabled = true | |||
} | |||
|
|||
@objc public func suspendTunnelAnimation(for manager: CLLocationManager, at location: CLLocation, routeController: RouteController) { |
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.
@vincethecoder noting, I removed the manager from many functions here as they were unused.
@1ec5 there are a few name changes that occur in here that would be great to get your eyes on. |
@@ -47,31 +47,42 @@ open class TunnelIntersectionManager: NSObject { | |||
/** | |||
The flag that indicates whether simulated location manager is initialized. | |||
*/ | |||
@objc public var isAnimationEnabled: Bool = false | |||
@objc var isAnimationEnabled: Bool = false |
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.
@bsudekum Hmm 🤔 is there a reason why we deleted the public
access level declaration here?
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.
@vincethecoder it's not something the developer should be mutating, nor is it something they should be inspecting if they are using the delegate properly.
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.
LGTM 👍
As pointed out in #1486, calling
styleManager.timeOfDayChanged()
is expensive because we have to re-initSolar
on every call to check.Now with this change, we're only changing the style from/to day/night when the tunnel manager tells us we have entered/exited a tunnel.
/cc @mapbox/navigation-ios