Skip to content

Commit 6b827ee

Browse files
authored
vk-3180-cp-marks: reworked code marks for half of the Navigation module. Removed few unused InstructionsCardViewController methods. (#3400)
1 parent fe1b063 commit 6b827ee

19 files changed

+752
-694
lines changed

Sources/MapboxNavigation/AVAudioSession.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import AVFoundation
22

33
public extension AVAudioSession {
4+
5+
// MARK: Adjusting the Volume
6+
47
func tryDuckAudio() -> Error? {
58
do {
69
if #available(iOS 12.0, *) {

Sources/MapboxNavigation/ArrivalController.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class ArrivalController: NavigationComponentDelegate {
99

1010
typealias EndOfRouteDismissalHandler = (EndOfRouteFeedback?) -> ()
1111

12-
// MARK: - Properties
12+
// MARK: Properties
1313

1414
weak private(set) var navigationViewData: NavigationViewData!
1515

@@ -33,7 +33,7 @@ class ArrivalController: NavigationComponentDelegate {
3333
return viewController
3434
}()
3535

36-
// MARK: - Public methods
36+
// MARK: Public Methods
3737

3838
init(_ navigationViewData: NavigationViewData) {
3939
self.navigationViewData = navigationViewData
@@ -86,7 +86,7 @@ class ArrivalController: NavigationComponentDelegate {
8686
UIView.animate(withDuration: 0.3, animations: navigationViewData.containerViewController.view.layoutIfNeeded)
8787
}
8888

89-
// MARK: - Private methods
89+
// MARK: Private Methods
9090

9191
private func embedEndOfRoute(into viewController: UIViewController, onDismiss: EndOfRouteDismissalHandler? = nil) {
9292
let endOfRoute = endOfRouteViewController
@@ -107,7 +107,7 @@ class ArrivalController: NavigationComponentDelegate {
107107
return (stars - 1) * 25
108108
}
109109

110-
// MARK: - Keyboard handling
110+
// MARK: Keyboard Handling
111111

112112
fileprivate func subscribeToKeyboardNotifications() {
113113
NotificationCenter.default.addObserver(self, selector: #selector(ArrivalController.keyboardWillShow(notification:)), name:UIResponder.keyboardWillShowNotification, object: nil)
@@ -146,7 +146,7 @@ class ArrivalController: NavigationComponentDelegate {
146146
UIView.animate(withDuration: duration, delay: 0, options: options, animations: navigationViewData.navigationView.layoutIfNeeded, completion: nil)
147147
}
148148

149-
// MARK: - NavigationComponentDelegate implementation
149+
// MARK: NavigationComponentDelegate Implementation
150150

151151
func navigationViewWillAppear(_: Bool) {
152152
subscribeToKeyboardNotifications()

Sources/MapboxNavigation/BottomBannerViewController.swift

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,36 @@ public protocol BottomBannerViewControllerDelegate: AnyObject {
1919
*/
2020
@IBDesignable
2121
open class BottomBannerViewController: UIViewController, NavigationComponent {
22+
23+
var previousProgress: RouteProgress?
24+
var timer: DispatchTimer?
25+
26+
let dateFormatter = DateFormatter()
27+
let dateComponentsFormatter = DateComponentsFormatter()
28+
let distanceFormatter = DistanceFormatter()
29+
30+
var verticalCompactConstraints = [NSLayoutConstraint]()
31+
var verticalRegularConstraints = [NSLayoutConstraint]()
32+
33+
var congestionLevel: CongestionLevel = .unknown {
34+
didSet {
35+
switch congestionLevel {
36+
case .unknown:
37+
timeRemainingLabel.textColor = timeRemainingLabel.trafficUnknownColor
38+
case .low:
39+
timeRemainingLabel.textColor = timeRemainingLabel.trafficLowColor
40+
case .moderate:
41+
timeRemainingLabel.textColor = timeRemainingLabel.trafficModerateColor
42+
case .heavy:
43+
timeRemainingLabel.textColor = timeRemainingLabel.trafficHeavyColor
44+
case .severe:
45+
timeRemainingLabel.textColor = timeRemainingLabel.trafficSevereColor
46+
}
47+
}
48+
}
49+
50+
// MARK: Child Views Configuration
51+
2252
/**
2353
A padded spacer view that covers the bottom safe area of the device, if any.
2454
*/
@@ -59,39 +89,14 @@ open class BottomBannerViewController: UIViewController, NavigationComponent {
5989
*/
6090
open var horizontalDividerView: SeparatorView!
6191

92+
// MARK: Setup and Initialization
93+
6294
/**
6395
The delegate for the view controller.
6496
- seealso: BottomBannerViewControllerDelegate
6597
*/
6698
open weak var delegate: BottomBannerViewControllerDelegate?
6799

68-
var previousProgress: RouteProgress?
69-
var timer: DispatchTimer?
70-
71-
let dateFormatter = DateFormatter()
72-
let dateComponentsFormatter = DateComponentsFormatter()
73-
let distanceFormatter = DistanceFormatter()
74-
75-
var verticalCompactConstraints = [NSLayoutConstraint]()
76-
var verticalRegularConstraints = [NSLayoutConstraint]()
77-
78-
var congestionLevel: CongestionLevel = .unknown {
79-
didSet {
80-
switch congestionLevel {
81-
case .unknown:
82-
timeRemainingLabel.textColor = timeRemainingLabel.trafficUnknownColor
83-
case .low:
84-
timeRemainingLabel.textColor = timeRemainingLabel.trafficLowColor
85-
case .moderate:
86-
timeRemainingLabel.textColor = timeRemainingLabel.trafficModerateColor
87-
case .heavy:
88-
timeRemainingLabel.textColor = timeRemainingLabel.trafficHeavyColor
89-
case .severe:
90-
timeRemainingLabel.textColor = timeRemainingLabel.trafficSevereColor
91-
}
92-
}
93-
}
94-
95100
/**
96101
Initializes a `BottomBannerViewController` that provides ETA, Distance to arrival, and Time to arrival.
97102

@@ -156,6 +161,8 @@ open class BottomBannerViewController: UIViewController, NavigationComponent {
156161
arrivalTimeLabel.text = "10:09"
157162
}
158163

164+
// MARK: NavigationComponent support
165+
159166
public func navigationService(_ service: NavigationService, didRerouteAlong route: Route, at location: CLLocation?, proactive: Bool) {
160167
refreshETA()
161168
}

Sources/MapboxNavigation/Bundle.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import UIKit
22

33
extension Bundle {
4+
5+
// MARK: Accessing Mapbox-Specific Bundles
6+
47
/**
58
The Mapbox Navigation framework bundle.
69
*/

Sources/MapboxNavigation/CameraController.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import MapboxMaps
77
/// This class manages various scenarious from moving camera to a specific region on demand and handling device rotation, up to reacting to active guidance events.
88
class CameraController: NavigationComponent, NavigationComponentDelegate {
99

10-
// MARK: - Properties
10+
// MARK: Properties
1111

1212
weak private(set) var navigationViewData: NavigationViewData!
1313

@@ -25,7 +25,7 @@ class CameraController: NavigationComponent, NavigationComponentDelegate {
2525
return navigationViewData.navigationView.bottomBannerContainerView
2626
}
2727

28-
// MARK: - Methods
28+
// MARK: Methods
2929

3030
init(_ navigationViewData: NavigationViewData) {
3131
self.navigationViewData = navigationViewData
@@ -140,13 +140,13 @@ class CameraController: NavigationComponent, NavigationComponentDelegate {
140140
return insets
141141
}
142142

143-
// MARK: - NavigationComponent implementation
143+
// MARK: NavigationComponent Implementation
144144

145145
func navigationService(_ service: NavigationService, didUpdate progress: RouteProgress, with location: CLLocation, rawLocation: CLLocation) {
146146
updateNavigationCameraViewport()
147147
}
148148

149-
// MARK: - NavigationComponentDelegate implementation
149+
// MARK: NavigationComponentDelegate Implementation
150150

151151
func navigationViewDidLoad(_: UIView) {
152152
navigationViewData.navigationView.overviewButton.addTarget(self, action: #selector(overview(_:)), for: .touchUpInside)

Sources/MapboxNavigation/CameraStateTransition.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import MapboxMaps
99
*/
1010
public protocol CameraStateTransition: AnyObject {
1111

12+
// MARK: Updating the Camera
13+
1214
var mapView: MapView? { get }
1315

1416
/**

0 commit comments

Comments
 (0)