-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
SwiftUI Optimisation #76
Changes from all commits
b0c1397
4111671
427721a
4030f4e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -214,6 +214,8 @@ | |
|
||
var currentStatusBarStyle: UIStatusBarStyle = .default { | ||
didSet { | ||
guard oldValue != self.currentStatusBarStyle else { return } | ||
|
||
self.mapViewController.instructionsBannerView.backgroundColor = InstructionsBannerView.appearance().backgroundColor | ||
self.mapViewController.instructionsBannerContentView.backgroundColor = InstructionsBannerContentView.appearance().backgroundColor | ||
} | ||
|
@@ -228,6 +230,8 @@ | |
*/ | ||
public var route: Route? { | ||
didSet { | ||
guard oldValue != self.route else { return } | ||
|
||
if let route { | ||
if self.routeController == nil { | ||
let routeController = RouteController(along: route, directions: self.directions, locationManager: self.locationManager) | ||
|
@@ -283,6 +287,8 @@ | |
*/ | ||
public var routeController: RouteController? { | ||
didSet { | ||
guard oldValue != self.routeController else { return } | ||
|
||
self.mapViewController.routeController = self.routeController | ||
} | ||
} | ||
|
@@ -313,6 +319,8 @@ | |
*/ | ||
public var automaticallyAdjustsStyleForTimeOfDay = true { | ||
didSet { | ||
guard oldValue != self.automaticallyAdjustsStyleForTimeOfDay else { return } | ||
|
||
self.styleManager.automaticallyAdjustsStyleForTimeOfDay = self.automaticallyAdjustsStyleForTimeOfDay | ||
} | ||
} | ||
|
@@ -427,10 +435,8 @@ | |
|
||
// MARK: - NavigationViewController | ||
|
||
public func startNavigation(with route: Route, animated: Bool, routeController: RouteController? = nil, locationManager: NavigationLocationManager? = nil) { | ||
if let locationManager { | ||
self.locationManager = locationManager | ||
} | ||
public func startNavigation(with route: Route, animated: Bool, routeController: RouteController? = nil, locationManager: NavigationLocationManager = NavigationLocationManager()) { | ||
self.locationManager = locationManager | ||
if let routeController { | ||
self.routeController = routeController | ||
} | ||
|
@@ -467,6 +473,7 @@ | |
|
||
self.voiceController = nil | ||
self.route = nil | ||
self.locationManager = NavigationLocationManager() | ||
|
||
self.mapViewController.navigationView.hideUI(animated: animated) | ||
self.mapView.tracksUserCourse = false | ||
|
@@ -649,7 +656,9 @@ | |
guard let self else { | ||
return | ||
} | ||
self.delegate?.navigationViewControllerDidFinishRouting?(self) | ||
self.mapViewController.hideEndOfRoute { _ in | ||
self.delegate?.navigationViewControllerDidFinishRouting?(self) | ||
} | ||
Comment on lines
+659
to
+661
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've verified that this is called regardless if |
||
}) | ||
} | ||
return advancesToNextLeg | ||
|
@@ -752,14 +761,14 @@ | |
guard UIApplication.shared.applicationState == .background else { return } | ||
guard let text = step.instructionsSpokenAlongStep?.last?.text else { return } | ||
|
||
let notification = UILocalNotification() | ||
notification.alertBody = text | ||
notification.fireDate = Date() | ||
|
||
self.clearStaleNotifications() | ||
|
||
UIApplication.shared.cancelAllLocalNotifications() | ||
Check warning on line 770 in MapboxNavigation/NavigationViewController.swift
|
||
UIApplication.shared.scheduleLocalNotification(notification) | ||
Check warning on line 771 in MapboxNavigation/NavigationViewController.swift
|
||
} | ||
|
||
func clearStaleNotifications() { | ||
|
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.
Resets LocationManager in case a
SimulatedLocationManager
was used