@complexify/expo-mapbox-navigation 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,559 @@
|
|
1
|
+
import MapboxMaps
|
2
|
+
import MapboxNavigationCore
|
3
|
+
import MapboxNavigationUIKit
|
4
|
+
import UIKit
|
5
|
+
|
6
|
+
class CustomDayStyle: Style {
|
7
|
+
// Speed Limit View
|
8
|
+
var customSpeedLimitTextColor: UIColor?
|
9
|
+
var customSpeedLimitBackgroundColor: UIColor?
|
10
|
+
var customSpeedLimitBorderColor: UIColor?
|
11
|
+
|
12
|
+
// Bottom Banner
|
13
|
+
var customBottomBannerBackgroundColor: UIColor?
|
14
|
+
var customBottomBannerTimeRemainingTextColor: UIColor?
|
15
|
+
var customBottomBannerDistanceRemainingTextColor: UIColor?
|
16
|
+
var customBottomBannerArrivalTimeTextColor: UIColor?
|
17
|
+
|
18
|
+
// Way Name View
|
19
|
+
var customWayNameBackgroundColor: UIColor?
|
20
|
+
var customWayNameTextColor: UIColor?
|
21
|
+
|
22
|
+
// Top Banner
|
23
|
+
var customTopBannerBackgroundColor: UIColor?
|
24
|
+
var customTopBannerPrimaryTextColor: UIColor?
|
25
|
+
var customTopBannerSecondaryTextColor: UIColor?
|
26
|
+
var customTopBannerDistanceTextColor: UIColor?
|
27
|
+
var customTopBannerSeparatorColor: UIColor?
|
28
|
+
|
29
|
+
// Resume Button
|
30
|
+
var customResumeButtonBackgroundColor: UIColor?
|
31
|
+
var customResumeButtonTextColor: UIColor?
|
32
|
+
var customResumeButtonBorderColor: UIColor?
|
33
|
+
|
34
|
+
// Floating Buttons
|
35
|
+
var customFloatingButtonsBackgroundColor: UIColor?
|
36
|
+
var customFloatingButtonsBorderColor: UIColor?
|
37
|
+
var customFloatingButtonsTextColor: UIColor?
|
38
|
+
|
39
|
+
// Maneuver View
|
40
|
+
var customManeuverViewPrimaryColor: UIColor?
|
41
|
+
var customManeuverViewSecondaryColor: UIColor?
|
42
|
+
var customManeuverViewPrimaryColorHighlighted: UIColor?
|
43
|
+
var customManeuverViewSecondaryColorHighlighted: UIColor?
|
44
|
+
|
45
|
+
// Steps List
|
46
|
+
var customStepsBackgroundColor: UIColor?
|
47
|
+
var customStepsPrimaryTextColor: UIColor?
|
48
|
+
var customStepsSecondaryTextColor: UIColor?
|
49
|
+
var customStepsManeuverViewPrimaryColor: UIColor?
|
50
|
+
var customStepsManeuverViewSecondaryColor: UIColor?
|
51
|
+
var customStepsSeparatorColor: UIColor?
|
52
|
+
|
53
|
+
// Lane View
|
54
|
+
var customLaneViewBackgroundColor: UIColor?
|
55
|
+
var customLaneViewForegroundColor: UIColor?
|
56
|
+
var customLaneViewSeparatorColor: UIColor?
|
57
|
+
|
58
|
+
// Next Banner View
|
59
|
+
var customNextBannerBackgroundColor: UIColor?
|
60
|
+
var customNextBannerPrimaryTextColor: UIColor?
|
61
|
+
var customNextBannerSecondaryTextColor: UIColor?
|
62
|
+
var customNextBannerDistanceTextColor: UIColor?
|
63
|
+
|
64
|
+
// Progress Bar
|
65
|
+
var customProgressBarProgressColor: UIColor?
|
66
|
+
var customProgressBarBackgroundColor: UIColor?
|
67
|
+
|
68
|
+
// Exit View
|
69
|
+
var customExitViewForegroundColor: UIColor?
|
70
|
+
var customExitViewBorderColor: UIColor?
|
71
|
+
var customExitViewHighlightColor: UIColor?
|
72
|
+
|
73
|
+
// Route Shield
|
74
|
+
var customRouteShieldForegroundColor: UIColor?
|
75
|
+
var customRouteShieldBorderColor: UIColor?
|
76
|
+
var customRouteShieldHighlightColor: UIColor?
|
77
|
+
|
78
|
+
// Distance Labels
|
79
|
+
var customDistanceRemainingColor: UIColor?
|
80
|
+
var customDistanceUnitColor: UIColor?
|
81
|
+
var customDistanceValueColor: UIColor?
|
82
|
+
|
83
|
+
// Navigation Map
|
84
|
+
var customRouteColor: UIColor?
|
85
|
+
var customRouteAlternateColor: UIColor?
|
86
|
+
var customRouteCasingColor: UIColor?
|
87
|
+
var customRouteAlternateCasingColor: UIColor?
|
88
|
+
var customTraversedRouteColor: UIColor?
|
89
|
+
var customManeuverArrowColor: UIColor?
|
90
|
+
var customRouteAnnotationSelectedColor: UIColor?
|
91
|
+
var customRouteAnnotationColor: UIColor?
|
92
|
+
var customRouteAnnotationTextColor: UIColor?
|
93
|
+
var customRouteAnnotationSelectedTextColor: UIColor?
|
94
|
+
var customRouteAnnotationMoreTimeTextColor: UIColor?
|
95
|
+
var customRouteAnnotationLessTimeTextColor: UIColor?
|
96
|
+
var customWaypointColor: UIColor?
|
97
|
+
var customWaypointStrokeColor: UIColor?
|
98
|
+
|
99
|
+
// Instructions Card
|
100
|
+
var customInstructionsCardBackgroundColor: UIColor?
|
101
|
+
var customInstructionsCardSeparatorColor: UIColor?
|
102
|
+
var customInstructionsCardHighlightedSeparatorColor: UIColor?
|
103
|
+
|
104
|
+
// Feedback
|
105
|
+
var customFeedbackBackgroundColor: UIColor?
|
106
|
+
var customFeedbackTextColor: UIColor?
|
107
|
+
var customFeedbackCellColor: UIColor?
|
108
|
+
var customFeedbackSubtypeCircleColor: UIColor?
|
109
|
+
var customFeedbackSubtypeCircleOutlineColor: UIColor?
|
110
|
+
|
111
|
+
// End of Route
|
112
|
+
var customEndOfRouteButtonTextColor: UIColor?
|
113
|
+
var customEndOfRouteCommentBackgroundColor: UIColor?
|
114
|
+
var customEndOfRouteCommentTextColor: UIColor?
|
115
|
+
var customEndOfRouteContentBackgroundColor: UIColor?
|
116
|
+
var customEndOfRouteTitleTextColor: UIColor?
|
117
|
+
|
118
|
+
// Road Shield Colors
|
119
|
+
var customRoadShieldBlackColor: UIColor?
|
120
|
+
var customRoadShieldBlueColor: UIColor?
|
121
|
+
var customRoadShieldGreenColor: UIColor?
|
122
|
+
var customRoadShieldRedColor: UIColor?
|
123
|
+
var customRoadShieldWhiteColor: UIColor?
|
124
|
+
var customRoadShieldYellowColor: UIColor?
|
125
|
+
var customRoadShieldDefaultColor: UIColor?
|
126
|
+
|
127
|
+
// Button Properties
|
128
|
+
var customButtonTextColor: UIColor?
|
129
|
+
var customCancelButtonTintColor: UIColor?
|
130
|
+
var customPreviewButtonTintColor: UIColor?
|
131
|
+
var customStartButtonTintColor: UIColor?
|
132
|
+
var customDismissButtonBackgroundColor: UIColor?
|
133
|
+
var customDismissButtonTextColor: UIColor?
|
134
|
+
var customBackButtonBackgroundColor: UIColor?
|
135
|
+
var customBackButtonTintColor: UIColor?
|
136
|
+
var customBackButtonTextColor: UIColor?
|
137
|
+
var customBackButtonBorderColor: UIColor?
|
138
|
+
|
139
|
+
// Navigation View
|
140
|
+
var customNavigationViewBackgroundColor: UIColor?
|
141
|
+
|
142
|
+
// Distance Label Properties
|
143
|
+
var customDistanceLabelUnitTextColor: UIColor?
|
144
|
+
var customDistanceLabelValueTextColor: UIColor?
|
145
|
+
|
146
|
+
// Rating Control
|
147
|
+
var customRatingControlNormalColor: UIColor?
|
148
|
+
var customRatingControlSelectedColor: UIColor?
|
149
|
+
|
150
|
+
// Steps Properties
|
151
|
+
var customStepsBackgroundViewColor: UIColor?
|
152
|
+
var customStepsTableHeaderTintColor: UIColor?
|
153
|
+
var customStepsTableHeaderTextColor: UIColor?
|
154
|
+
var customStepInstructionsBackgroundColor: UIColor?
|
155
|
+
var customStepTableViewCellBackgroundColor: UIColor?
|
156
|
+
|
157
|
+
// Next Instruction
|
158
|
+
var customNextInstructionNormalTextColor: UIColor?
|
159
|
+
var customNextInstructionContainedTextColor: UIColor?
|
160
|
+
|
161
|
+
// Secondary Label Properties
|
162
|
+
var customSecondaryLabelNormalTextColor: UIColor?
|
163
|
+
var customSecondaryLabelFont: UIFont?
|
164
|
+
|
165
|
+
// Stylable Label
|
166
|
+
var customStylableLabelNormalTextColor: UIColor?
|
167
|
+
|
168
|
+
// CarPlay Properties
|
169
|
+
var customCarPlayCompassBackgroundColor: UIColor?
|
170
|
+
|
171
|
+
required init() {
|
172
|
+
super.init()
|
173
|
+
styleType = .day
|
174
|
+
mapStyleURL = URL(string: StyleURI.light.rawValue)!
|
175
|
+
previewMapStyleURL = mapStyleURL
|
176
|
+
statusBarStyle = .darkContent
|
177
|
+
}
|
178
|
+
|
179
|
+
override func apply() {
|
180
|
+
super.apply()
|
181
|
+
|
182
|
+
let traitCollection = UIScreen.main.traitCollection
|
183
|
+
|
184
|
+
// Speed Limit View
|
185
|
+
if let textColor = customSpeedLimitTextColor {
|
186
|
+
SpeedLimitView.appearance(for: traitCollection).textColor = textColor
|
187
|
+
}
|
188
|
+
if let bgColor = customSpeedLimitBackgroundColor {
|
189
|
+
SpeedLimitView.appearance(for: traitCollection).signBackColor = bgColor
|
190
|
+
}
|
191
|
+
if let borderColor = customSpeedLimitBorderColor {
|
192
|
+
SpeedLimitView.appearance(for: traitCollection).regulatoryBorderColor = borderColor
|
193
|
+
}
|
194
|
+
|
195
|
+
// Bottom Banner
|
196
|
+
if let bottomBannerBg = customBottomBannerBackgroundColor {
|
197
|
+
BottomBannerView.appearance(for: traitCollection).backgroundColor = bottomBannerBg
|
198
|
+
}
|
199
|
+
if let timeRemainingColor = customBottomBannerTimeRemainingTextColor {
|
200
|
+
TimeRemainingLabel.appearance(for: traitCollection).textColor = timeRemainingColor
|
201
|
+
}
|
202
|
+
if let distanceRemainingColor = customBottomBannerDistanceRemainingTextColor {
|
203
|
+
DistanceRemainingLabel.appearance(for: traitCollection).textColor = distanceRemainingColor
|
204
|
+
}
|
205
|
+
if let arrivalTimeColor = customBottomBannerArrivalTimeTextColor {
|
206
|
+
ArrivalTimeLabel.appearance(for: traitCollection).textColor = arrivalTimeColor
|
207
|
+
}
|
208
|
+
|
209
|
+
// Way Name View
|
210
|
+
if let bgColor = customWayNameBackgroundColor {
|
211
|
+
WayNameLabel.appearance(for: traitCollection).backgroundColor = bgColor.withAlphaComponent(0.8)
|
212
|
+
}
|
213
|
+
if let textColor = customWayNameTextColor {
|
214
|
+
WayNameLabel.appearance(for: traitCollection).textColor = textColor
|
215
|
+
}
|
216
|
+
|
217
|
+
// Top Banner
|
218
|
+
if let topBannerBg = customTopBannerBackgroundColor {
|
219
|
+
InstructionsBannerView.appearance(for: traitCollection).backgroundColor = topBannerBg
|
220
|
+
}
|
221
|
+
if let primaryTextColor = customTopBannerPrimaryTextColor {
|
222
|
+
PrimaryLabel.appearance(for: traitCollection).textColor = primaryTextColor
|
223
|
+
}
|
224
|
+
if let secondaryTextColor = customTopBannerSecondaryTextColor {
|
225
|
+
SecondaryLabel.appearance(for: traitCollection).textColor = secondaryTextColor
|
226
|
+
}
|
227
|
+
if let distanceTextColor = customTopBannerDistanceTextColor {
|
228
|
+
DistanceLabel.appearance(for: traitCollection).textColor = distanceTextColor
|
229
|
+
}
|
230
|
+
if let separatorColor = customTopBannerSeparatorColor {
|
231
|
+
SeparatorView.appearance(for: traitCollection).backgroundColor = separatorColor
|
232
|
+
}
|
233
|
+
|
234
|
+
// Resume Button
|
235
|
+
if let resumeBgColor = customResumeButtonBackgroundColor {
|
236
|
+
ResumeButton.appearance(for: traitCollection).backgroundColor = resumeBgColor
|
237
|
+
}
|
238
|
+
if let resumeTextColor = customResumeButtonTextColor {
|
239
|
+
ResumeButton.appearance(for: traitCollection).tintColor = resumeTextColor
|
240
|
+
}
|
241
|
+
if let resumeBorderColor = customResumeButtonBorderColor {
|
242
|
+
ResumeButton.appearance(for: traitCollection).borderColor = resumeBorderColor
|
243
|
+
}
|
244
|
+
|
245
|
+
// Floating Buttons
|
246
|
+
if let floatingBgColor = customFloatingButtonsBackgroundColor {
|
247
|
+
FloatingButton.appearance(for: traitCollection).backgroundColor = floatingBgColor
|
248
|
+
}
|
249
|
+
if let floatingTextColor = customFloatingButtonsTextColor {
|
250
|
+
FloatingButton.appearance(for: traitCollection).tintColor = floatingTextColor
|
251
|
+
}
|
252
|
+
if let floatingBorderColor = customFloatingButtonsBorderColor {
|
253
|
+
FloatingButton.appearance(for: traitCollection).borderColor = floatingBorderColor
|
254
|
+
}
|
255
|
+
|
256
|
+
// Maneuver View
|
257
|
+
if let primaryColor = customManeuverViewPrimaryColor {
|
258
|
+
ManeuverView.appearance(for: traitCollection).primaryColor = primaryColor
|
259
|
+
}
|
260
|
+
if let secondaryColor = customManeuverViewSecondaryColor {
|
261
|
+
ManeuverView.appearance(for: traitCollection).secondaryColor = secondaryColor
|
262
|
+
}
|
263
|
+
if let primaryHighlightedColor = customManeuverViewPrimaryColorHighlighted {
|
264
|
+
ManeuverView.appearance(for: traitCollection).primaryColorHighlighted = primaryHighlightedColor
|
265
|
+
}
|
266
|
+
if let secondaryHighlightedColor = customManeuverViewSecondaryColorHighlighted {
|
267
|
+
ManeuverView.appearance(for: traitCollection).secondaryColorHighlighted = secondaryHighlightedColor
|
268
|
+
}
|
269
|
+
|
270
|
+
// Steps List
|
271
|
+
if let bgColor = customStepsBackgroundColor {
|
272
|
+
StepsBackgroundView.appearance(for: traitCollection).backgroundColor = bgColor
|
273
|
+
}
|
274
|
+
if let primaryTextColor = customStepsPrimaryTextColor {
|
275
|
+
StepInstructionsView.appearance(for: traitCollection).primaryLabel.textColor = primaryTextColor
|
276
|
+
}
|
277
|
+
if let secondaryTextColor = customStepsSecondaryTextColor {
|
278
|
+
StepInstructionsView.appearance(for: traitCollection).secondaryLabel.textColor = secondaryTextColor
|
279
|
+
}
|
280
|
+
|
281
|
+
// Lane View
|
282
|
+
if let bgColor = customLaneViewBackgroundColor {
|
283
|
+
LaneView.appearance(for: traitCollection).backgroundColor = bgColor
|
284
|
+
}
|
285
|
+
if let fgColor = customLaneViewForegroundColor {
|
286
|
+
LaneView.appearance(for: traitCollection).primaryColor = fgColor
|
287
|
+
}
|
288
|
+
if let separatorColor = customLaneViewSeparatorColor {
|
289
|
+
LaneView.appearance(for: traitCollection).backgroundColor = separatorColor.withAlphaComponent(0.5)
|
290
|
+
}
|
291
|
+
|
292
|
+
// Next Banner View
|
293
|
+
if let bgColor = customNextBannerBackgroundColor {
|
294
|
+
NextBannerView.appearance(for: traitCollection).backgroundColor = bgColor
|
295
|
+
}
|
296
|
+
if let primaryTextColor = customNextBannerPrimaryTextColor {
|
297
|
+
NextBannerView.appearance(for: traitCollection).primaryInstruction.textColor = primaryTextColor
|
298
|
+
}
|
299
|
+
if let secondaryTextColor = customNextBannerSecondaryTextColor {
|
300
|
+
NextBannerView.appearance(for: traitCollection).secondaryInstruction.textColor = secondaryTextColor
|
301
|
+
}
|
302
|
+
if let distanceTextColor = customNextBannerDistanceTextColor {
|
303
|
+
NextBannerView.appearance(for: traitCollection).distance.textColor = distanceTextColor
|
304
|
+
}
|
305
|
+
|
306
|
+
// Progress Bar
|
307
|
+
if let progressColor = customProgressBarProgressColor {
|
308
|
+
RouteProgressView.appearance(for: traitCollection).tintColor = progressColor
|
309
|
+
}
|
310
|
+
if let backgroundColor = customProgressBarBackgroundColor {
|
311
|
+
RouteProgressView.appearance(for: traitCollection).backgroundColor = backgroundColor
|
312
|
+
}
|
313
|
+
|
314
|
+
// Exit View
|
315
|
+
if let foregroundColor = customExitViewForegroundColor {
|
316
|
+
ExitView.appearance(for: traitCollection).foregroundColor = foregroundColor
|
317
|
+
}
|
318
|
+
if let borderColor = customExitViewBorderColor {
|
319
|
+
ExitView.appearance(for: traitCollection).borderColor = borderColor
|
320
|
+
}
|
321
|
+
if let highlightColor = customExitViewHighlightColor {
|
322
|
+
ExitView.appearance(for: traitCollection).highlightColor = highlightColor
|
323
|
+
}
|
324
|
+
|
325
|
+
// Route Shield
|
326
|
+
if let foregroundColor = customRouteShieldForegroundColor {
|
327
|
+
GenericRouteShield.appearance(for: traitCollection).foregroundColor = foregroundColor
|
328
|
+
}
|
329
|
+
if let borderColor = customRouteShieldBorderColor {
|
330
|
+
GenericRouteShield.appearance(for: traitCollection).borderColor = borderColor
|
331
|
+
}
|
332
|
+
if let highlightColor = customRouteShieldHighlightColor {
|
333
|
+
GenericRouteShield.appearance(for: traitCollection).highlightColor = highlightColor
|
334
|
+
}
|
335
|
+
|
336
|
+
// Instructions Card
|
337
|
+
if let bgColor = customInstructionsCardBackgroundColor {
|
338
|
+
InstructionsCardContainerView.appearance(
|
339
|
+
for: traitCollection,
|
340
|
+
whenContainedInInstancesOf: [InstructionsCardCell.self]
|
341
|
+
).customBackgroundColor = bgColor
|
342
|
+
}
|
343
|
+
if let separatorColor = customInstructionsCardSeparatorColor {
|
344
|
+
InstructionsCardContainerView.appearance(
|
345
|
+
for: traitCollection,
|
346
|
+
whenContainedInInstancesOf: [InstructionsCardCell.self]
|
347
|
+
).separatorColor = separatorColor
|
348
|
+
}
|
349
|
+
if let highlightedSeparatorColor = customInstructionsCardHighlightedSeparatorColor {
|
350
|
+
InstructionsCardContainerView.appearance(
|
351
|
+
for: traitCollection,
|
352
|
+
whenContainedInInstancesOf: [InstructionsCardCell.self]
|
353
|
+
).highlightedSeparatorColor = highlightedSeparatorColor
|
354
|
+
}
|
355
|
+
|
356
|
+
// Feedback
|
357
|
+
if let feedbackBgColor = customFeedbackBackgroundColor {
|
358
|
+
FeedbackStyleView.appearance(for: traitCollection).backgroundColor = feedbackBgColor
|
359
|
+
FeedbackCollectionView.appearance(for: traitCollection).backgroundColor = feedbackBgColor
|
360
|
+
}
|
361
|
+
if let feedbackTextColor = customFeedbackTextColor {
|
362
|
+
UILabel.appearance(
|
363
|
+
for: traitCollection,
|
364
|
+
whenContainedInInstancesOf: [FeedbackViewController.self]
|
365
|
+
).textColor = feedbackTextColor
|
366
|
+
}
|
367
|
+
if let feedbackCellColor = customFeedbackCellColor {
|
368
|
+
FeedbackCollectionView.appearance(for: traitCollection).cellColor = feedbackCellColor
|
369
|
+
}
|
370
|
+
|
371
|
+
// Road Shield Colors
|
372
|
+
if let blackColor = customRoadShieldBlackColor {
|
373
|
+
WayNameLabel.appearance(for: traitCollection).roadShieldBlackColor = blackColor
|
374
|
+
InstructionLabel.appearance(for: traitCollection).roadShieldBlackColor = blackColor
|
375
|
+
}
|
376
|
+
if let blueColor = customRoadShieldBlueColor {
|
377
|
+
WayNameLabel.appearance(for: traitCollection).roadShieldBlueColor = blueColor
|
378
|
+
InstructionLabel.appearance(for: traitCollection).roadShieldBlueColor = blueColor
|
379
|
+
}
|
380
|
+
if let greenColor = customRoadShieldGreenColor {
|
381
|
+
WayNameLabel.appearance(for: traitCollection).roadShieldGreenColor = greenColor
|
382
|
+
InstructionLabel.appearance(for: traitCollection).roadShieldGreenColor = greenColor
|
383
|
+
}
|
384
|
+
if let redColor = customRoadShieldRedColor {
|
385
|
+
WayNameLabel.appearance(for: traitCollection).roadShieldRedColor = redColor
|
386
|
+
InstructionLabel.appearance(for: traitCollection).roadShieldRedColor = redColor
|
387
|
+
}
|
388
|
+
if let whiteColor = customRoadShieldWhiteColor {
|
389
|
+
WayNameLabel.appearance(for: traitCollection).roadShieldWhiteColor = whiteColor
|
390
|
+
InstructionLabel.appearance(for: traitCollection).roadShieldWhiteColor = whiteColor
|
391
|
+
}
|
392
|
+
if let yellowColor = customRoadShieldYellowColor {
|
393
|
+
WayNameLabel.appearance(for: traitCollection).roadShieldYellowColor = yellowColor
|
394
|
+
InstructionLabel.appearance(for: traitCollection).roadShieldYellowColor = yellowColor
|
395
|
+
}
|
396
|
+
if let defaultColor = customRoadShieldDefaultColor {
|
397
|
+
WayNameLabel.appearance(for: traitCollection).roadShieldDefaultColor = defaultColor
|
398
|
+
InstructionLabel.appearance(for: traitCollection).roadShieldDefaultColor = defaultColor
|
399
|
+
}
|
400
|
+
|
401
|
+
Task { @MainActor in
|
402
|
+
// Navigation Map
|
403
|
+
if let routeColor = customRouteColor {
|
404
|
+
NavigationMapView.appearance(for: traitCollection).routeColor = routeColor
|
405
|
+
}
|
406
|
+
if let alternateColor = customRouteAlternateColor {
|
407
|
+
NavigationMapView.appearance(for: traitCollection).routeAlternateColor = alternateColor
|
408
|
+
}
|
409
|
+
if let casingColor = customRouteCasingColor {
|
410
|
+
NavigationMapView.appearance(for: traitCollection).routeCasingColor = casingColor
|
411
|
+
}
|
412
|
+
if let alternateCasingColor = customRouteAlternateCasingColor {
|
413
|
+
NavigationMapView.appearance(for: traitCollection).routeAlternateCasingColor = alternateCasingColor
|
414
|
+
}
|
415
|
+
if let traversedColor = customTraversedRouteColor {
|
416
|
+
NavigationMapView.appearance(for: traitCollection).traversedRouteColor = traversedColor
|
417
|
+
}
|
418
|
+
if let arrowColor = customManeuverArrowColor {
|
419
|
+
NavigationMapView.appearance(for: traitCollection).maneuverArrowColor = arrowColor
|
420
|
+
}
|
421
|
+
if let selectedColor = customRouteAnnotationSelectedColor {
|
422
|
+
NavigationMapView.appearance(for: traitCollection).routeAnnotationSelectedColor = selectedColor
|
423
|
+
}
|
424
|
+
if let annotationColor = customRouteAnnotationColor {
|
425
|
+
NavigationMapView.appearance(for: traitCollection).routeAnnotationColor = annotationColor
|
426
|
+
}
|
427
|
+
if let annotationTextColor = customRouteAnnotationTextColor {
|
428
|
+
NavigationMapView.appearance(for: traitCollection).routeAnnotationTextColor = annotationTextColor
|
429
|
+
}
|
430
|
+
if let selectedTextColor = customRouteAnnotationSelectedTextColor {
|
431
|
+
NavigationMapView.appearance(for: traitCollection).routeAnnotationSelectedTextColor = selectedTextColor
|
432
|
+
}
|
433
|
+
if let moreTimeTextColor = customRouteAnnotationMoreTimeTextColor {
|
434
|
+
NavigationMapView.appearance(for: traitCollection).routeAnnotationMoreTimeTextColor = moreTimeTextColor
|
435
|
+
}
|
436
|
+
if let lessTimeTextColor = customRouteAnnotationLessTimeTextColor {
|
437
|
+
NavigationMapView.appearance(for: traitCollection).routeAnnotationLessTimeTextColor = lessTimeTextColor
|
438
|
+
}
|
439
|
+
if let waypointColor = customWaypointColor {
|
440
|
+
NavigationMapView.appearance(for: traitCollection).waypointColor = waypointColor
|
441
|
+
}
|
442
|
+
if let waypointStrokeColor = customWaypointStrokeColor {
|
443
|
+
NavigationMapView.appearance(for: traitCollection).waypointStrokeColor = waypointStrokeColor
|
444
|
+
}
|
445
|
+
}
|
446
|
+
|
447
|
+
// Button Properties
|
448
|
+
if let textColor = customButtonTextColor {
|
449
|
+
Button.appearance(for: traitCollection).textColor = textColor
|
450
|
+
}
|
451
|
+
|
452
|
+
if let cancelTintColor = customCancelButtonTintColor {
|
453
|
+
CancelButton.appearance(for: traitCollection).tintColor = cancelTintColor
|
454
|
+
}
|
455
|
+
|
456
|
+
if let previewTintColor = customPreviewButtonTintColor {
|
457
|
+
PreviewButton.appearance(for: traitCollection).tintColor = previewTintColor
|
458
|
+
}
|
459
|
+
|
460
|
+
if let startTintColor = customStartButtonTintColor {
|
461
|
+
StartButton.appearance(for: traitCollection).tintColor = startTintColor
|
462
|
+
}
|
463
|
+
|
464
|
+
if let dismissBgColor = customDismissButtonBackgroundColor {
|
465
|
+
DismissButton.appearance(for: traitCollection).backgroundColor = dismissBgColor
|
466
|
+
}
|
467
|
+
|
468
|
+
if let dismissTextColor = customDismissButtonTextColor {
|
469
|
+
DismissButton.appearance(for: traitCollection).textColor = dismissTextColor
|
470
|
+
}
|
471
|
+
|
472
|
+
if let backBgColor = customBackButtonBackgroundColor {
|
473
|
+
BackButton.appearance(for: traitCollection).backgroundColor = backBgColor
|
474
|
+
}
|
475
|
+
|
476
|
+
if let backTintColor = customBackButtonTintColor {
|
477
|
+
BackButton.appearance(for: traitCollection).tintColor = backTintColor
|
478
|
+
}
|
479
|
+
|
480
|
+
if let backTextColor = customBackButtonTextColor {
|
481
|
+
BackButton.appearance(for: traitCollection).textColor = backTextColor
|
482
|
+
}
|
483
|
+
|
484
|
+
if let backBorderColor = customBackButtonBorderColor {
|
485
|
+
BackButton.appearance(for: traitCollection).borderColor = backBorderColor
|
486
|
+
}
|
487
|
+
|
488
|
+
// Navigation View
|
489
|
+
if let navBgColor = customNavigationViewBackgroundColor {
|
490
|
+
NavigationView.appearance(for: traitCollection).backgroundColor = navBgColor
|
491
|
+
}
|
492
|
+
|
493
|
+
// Distance Label Properties
|
494
|
+
if let unitTextColor = customDistanceLabelUnitTextColor {
|
495
|
+
DistanceLabel.appearance(for: traitCollection).unitTextColor = unitTextColor
|
496
|
+
}
|
497
|
+
|
498
|
+
if let valueTextColor = customDistanceLabelValueTextColor {
|
499
|
+
DistanceLabel.appearance(for: traitCollection).valueTextColor = valueTextColor
|
500
|
+
}
|
501
|
+
|
502
|
+
// Rating Control
|
503
|
+
if let normalColor = customRatingControlNormalColor {
|
504
|
+
RatingControl.appearance(for: traitCollection).normalColor = normalColor
|
505
|
+
}
|
506
|
+
|
507
|
+
if let selectedColor = customRatingControlSelectedColor {
|
508
|
+
RatingControl.appearance(for: traitCollection).selectedColor = selectedColor
|
509
|
+
}
|
510
|
+
|
511
|
+
// Steps Properties
|
512
|
+
if let bgViewColor = customStepsBackgroundViewColor {
|
513
|
+
StepsBackgroundView.appearance(for: traitCollection).backgroundColor = bgViewColor
|
514
|
+
}
|
515
|
+
|
516
|
+
if let headerTintColor = customStepsTableHeaderTintColor {
|
517
|
+
StepInstructionsView.appearance(for: traitCollection).tintColor = headerTintColor
|
518
|
+
}
|
519
|
+
|
520
|
+
if let headerTextColor = customStepsTableHeaderTextColor {
|
521
|
+
StepInstructionsView.appearance(for: traitCollection).textColor = headerTextColor
|
522
|
+
}
|
523
|
+
|
524
|
+
if let instructionsBgColor = customStepInstructionsBackgroundColor {
|
525
|
+
StepInstructionsView.appearance(for: traitCollection).backgroundColor = instructionsBgColor
|
526
|
+
}
|
527
|
+
|
528
|
+
if let cellBgColor = customStepTableViewCellBackgroundColor {
|
529
|
+
StepTableViewCell.appearance(for: traitCollection).backgroundColor = cellBgColor
|
530
|
+
}
|
531
|
+
|
532
|
+
// Next Instruction
|
533
|
+
if let normalTextColor = customNextInstructionNormalTextColor {
|
534
|
+
NextInstructionLabel.appearance(for: traitCollection).normalTextColor = normalTextColor
|
535
|
+
}
|
536
|
+
|
537
|
+
if let containedTextColor = customNextInstructionContainedTextColor {
|
538
|
+
NextInstructionLabel.appearance(
|
539
|
+
for: traitCollection,
|
540
|
+
whenContainedInInstancesOf: [NextBannerView.self]
|
541
|
+
).normalTextColor = containedTextColor
|
542
|
+
}
|
543
|
+
|
544
|
+
// Secondary Label Properties
|
545
|
+
if let normalTextColor = customSecondaryLabelNormalTextColor {
|
546
|
+
SecondaryLabel.appearance(for: traitCollection).normalTextColor = normalTextColor
|
547
|
+
}
|
548
|
+
|
549
|
+
// Stylable Label
|
550
|
+
if let normalTextColor = customStylableLabelNormalTextColor {
|
551
|
+
StylableLabel.appearance(for: traitCollection).normalTextColor = normalTextColor
|
552
|
+
}
|
553
|
+
|
554
|
+
// CarPlay Properties
|
555
|
+
if let compassBgColor = customCarPlayCompassBackgroundColor {
|
556
|
+
CarPlayCompassView.appearance(for: traitCollection).backgroundColor = compassBgColor
|
557
|
+
}
|
558
|
+
}
|
559
|
+
}
|
@@ -290,21 +290,21 @@ class CustomDayStyle: StandardDayStyle {
|
|
290
290
|
NextBannerView.appearance(for: traitCollection).backgroundColor = bgColor
|
291
291
|
}
|
292
292
|
if let primaryTextColor = customNextBannerPrimaryTextColor {
|
293
|
-
NextBannerView.appearance(for: traitCollection).textColor = primaryTextColor
|
293
|
+
NextBannerView.appearance(for: traitCollection).primaryInstruction.textColor = primaryTextColor
|
294
294
|
}
|
295
295
|
if let secondaryTextColor = customNextBannerSecondaryTextColor {
|
296
|
-
NextBannerView.appearance(for: traitCollection).
|
296
|
+
NextBannerView.appearance(for: traitCollection).secondaryInstruction.textColor = secondaryTextColor
|
297
297
|
}
|
298
298
|
if let distanceTextColor = customNextBannerDistanceTextColor {
|
299
|
-
NextBannerView.appearance(for: traitCollection).
|
299
|
+
NextBannerView.appearance(for: traitCollection).distance.textColor = distanceTextColor
|
300
300
|
}
|
301
301
|
|
302
302
|
// Progress Bar
|
303
303
|
if let progressColor = customProgressBarProgressColor {
|
304
|
-
|
304
|
+
RouteProgressView.appearance(for: traitCollection).tintColor = progressColor
|
305
305
|
}
|
306
306
|
if let backgroundColor = customProgressBarBackgroundColor {
|
307
|
-
|
307
|
+
RouteProgressView.appearance(for: traitCollection).backgroundColor = backgroundColor
|
308
308
|
}
|
309
309
|
|
310
310
|
// Exit View
|
@@ -491,11 +491,11 @@ class CustomDayStyle: StandardDayStyle {
|
|
491
491
|
}
|
492
492
|
|
493
493
|
if let headerTintColor = customStepsTableHeaderTintColor {
|
494
|
-
|
494
|
+
StepInstructionsView.appearance(for: traitCollection).tintColor = headerTintColor
|
495
495
|
}
|
496
496
|
|
497
497
|
if let headerTextColor = customStepsTableHeaderTextColor {
|
498
|
-
|
498
|
+
StepInstructionsView.appearance(for: traitCollection).textColor = headerTextColor
|
499
499
|
}
|
500
500
|
|
501
501
|
if let instructionsBgColor = customStepInstructionsBackgroundColor {
|
@@ -390,8 +390,6 @@ class ExpoMapboxNavigationViewController: UIViewController {
|
|
390
390
|
private var reroutingCancellable: AnyCancellable? = nil
|
391
391
|
private var sessionCancellable: AnyCancellable? = nil
|
392
392
|
|
393
|
-
var currentRouteColor: UIColor?
|
394
|
-
var currentRouteAlternateColor: UIColor?
|
395
393
|
var currentRouteCasingColor: UIColor?
|
396
394
|
var currentRouteAlternateCasingColor: UIColor?
|
397
395
|
var currentTraversedRouteColor: UIColor?
|
@@ -529,18 +527,8 @@ class ExpoMapboxNavigationViewController: UIViewController {
|
|
529
527
|
}
|
530
528
|
}
|
531
529
|
|
532
|
-
func setRouteColor(hexColor: String) {
|
533
|
-
currentRouteColor = UIColor(hex: hexColor)
|
534
|
-
update()
|
535
|
-
}
|
536
|
-
|
537
|
-
func setRouteAlternateColor(hexColor: String) {
|
538
|
-
currentRouteAlternateColor = UIColor(hex: hexColor)
|
539
|
-
update()
|
540
|
-
}
|
541
|
-
|
542
530
|
func setRouteCasingColor(hexColor: String) {
|
543
|
-
|
531
|
+
customDayStyle.customRouteCasingColor = UIColor(hex: hexColor)
|
544
532
|
update()
|
545
533
|
}
|
546
534
|
|
@@ -698,7 +686,7 @@ class ExpoMapboxNavigationViewController: UIViewController {
|
|
698
686
|
}
|
699
687
|
}
|
700
688
|
|
701
|
-
func calculateRoutes(waypoints: Array<Waypoint>){
|
689
|
+
func calculateRoutes(waypoints: Array<Waypoint>) {
|
702
690
|
let routeOptions = NavigationRouteOptions(
|
703
691
|
waypoints: waypoints,
|
704
692
|
profileIdentifier: currentRouteProfile != nil ? ProfileIdentifier(rawValue: currentRouteProfile!) : nil,
|
@@ -708,16 +696,21 @@ class ExpoMapboxNavigationViewController: UIViewController {
|
|
708
696
|
)
|
709
697
|
|
710
698
|
calculateRoutesTask = Task {
|
711
|
-
|
712
|
-
|
699
|
+
do {
|
700
|
+
let result = try await self.routingProvider!.calculateRoutes(options: routeOptions)
|
701
|
+
switch result.result {
|
702
|
+
case .success(let navigationRoutes):
|
703
|
+
onRoutesCalculated(navigationRoutes: navigationRoutes)
|
704
|
+
case .failure(let error):
|
705
|
+
print("Route calculation error: \(error.localizedDescription)")
|
706
|
+
}
|
707
|
+
} catch {
|
713
708
|
print("Failed to calculate routes: \(error.localizedDescription)")
|
714
|
-
case .success(let navigationRoutes):
|
715
|
-
onRoutesCalculated(navigationRoutes: navigationRoutes)
|
716
709
|
}
|
717
710
|
}
|
718
711
|
}
|
719
712
|
|
720
|
-
func calculateMapMatchingRoutes(waypoints: Array<Waypoint>){
|
713
|
+
func calculateMapMatchingRoutes(waypoints: Array<Waypoint>) {
|
721
714
|
let matchOptions = NavigationMatchOptions(
|
722
715
|
waypoints: waypoints,
|
723
716
|
profileIdentifier: currentRouteProfile != nil ? ProfileIdentifier(rawValue: currentRouteProfile!) : nil,
|
@@ -726,13 +719,17 @@ class ExpoMapboxNavigationViewController: UIViewController {
|
|
726
719
|
)
|
727
720
|
matchOptions.locale = currentLocale
|
728
721
|
|
729
|
-
|
730
722
|
calculateRoutesTask = Task {
|
731
|
-
|
732
|
-
|
723
|
+
do {
|
724
|
+
let result = try await self.routingProvider!.calculateRoutes(options: matchOptions)
|
725
|
+
switch result.result {
|
726
|
+
case .success(let navigationRoutes):
|
727
|
+
onRoutesCalculated(navigationRoutes: navigationRoutes)
|
728
|
+
case .failure(let error):
|
729
|
+
print("Map matching error: \(error.localizedDescription)")
|
730
|
+
}
|
731
|
+
} catch {
|
733
732
|
print("Failed to match routes: \(error.localizedDescription)")
|
734
|
-
case .success(let navigationRoutes):
|
735
|
-
onRoutesCalculated(navigationRoutes: navigationRoutes)
|
736
733
|
}
|
737
734
|
}
|
738
735
|
}
|
@@ -794,18 +791,9 @@ class ExpoMapboxNavigationViewController: UIViewController {
|
|
794
791
|
mapboxNavigation!.tripSession().startActiveGuidance(with: navigationRoutes, startLegIndex: 0)
|
795
792
|
|
796
793
|
// Apply custom colors if set
|
797
|
-
if let routeColor = currentRouteColor {
|
798
|
-
navigationMapView?.routeColor = routeColor
|
799
|
-
}
|
800
|
-
if let alternateColor = currentRouteAlternateColor {
|
801
|
-
navigationMapView?.routeAlternateColor = alternateColor
|
802
|
-
}
|
803
794
|
if let casingColor = currentRouteCasingColor {
|
804
795
|
navigationMapView?.routeCasingColor = casingColor
|
805
796
|
}
|
806
|
-
if let alternateCasingColor = currentRouteAlternateCasingColor {
|
807
|
-
navigationMapView?.routeAlternateCasingColor = alternateCasingColor
|
808
|
-
}
|
809
797
|
if let traversedColor = currentTraversedRouteColor {
|
810
798
|
navigationMapView?.traversedRouteColor = traversedColor
|
811
799
|
}
|