@complexify/expo-mapbox-navigation 1.0.4 → 1.0.6
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.
- package/CHANGELOG.md +1 -1
- package/ios/ExpoMapboxNavigationView.swift +46 -43
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -392,51 +392,54 @@ class ExpoMapboxNavigationViewController: UIViewController {
|
|
392
392
|
onCancelNavigation?()
|
393
393
|
}
|
394
394
|
|
395
|
-
func onRoutesCalculated(navigationRoutes: NavigationRoutes){
|
395
|
+
func onRoutesCalculated(navigationRoutes: NavigationRoutes) {
|
396
396
|
onRoutesLoaded?()
|
397
397
|
|
398
|
+
let topBanner = TopBannerViewController()
|
399
|
+
topBanner.view.backgroundColor = topBannerBackgroundColor ?? UIColor(hex: "#FFFFFF")
|
400
|
+
topBanner.instructionsBannerView.backgroundColor = topBannerBackgroundColor ?? UIColor(hex: "#FFFFFF")
|
401
|
+
topBanner.instructionsBannerView.distanceFormatter.locale = currentLocale
|
402
|
+
|
403
|
+
let bottomBanner = BottomBannerViewController()
|
404
|
+
bottomBanner.view.backgroundColor = bottomBannerBackgroundColor ?? UIColor(hex: "#FFFFFF")
|
405
|
+
bottomBanner.distanceFormatter.locale = currentLocale
|
406
|
+
bottomBanner.dateFormatter.locale = currentLocale
|
407
|
+
|
408
|
+
let navigationOptions = NavigationOptions(
|
409
|
+
mapboxNavigation: self.mapboxNavigation!,
|
410
|
+
voiceController: ExpoMapboxNavigationViewController.navigationProvider.routeVoiceController,
|
411
|
+
eventsManager: ExpoMapboxNavigationViewController.navigationProvider.eventsManager(),
|
412
|
+
styles: nil,
|
413
|
+
topBanner: topBanner,
|
414
|
+
bottomBanner: bottomBanner,
|
415
|
+
predictiveCacheManager: nil,
|
416
|
+
navigationMapView: nil
|
417
|
+
)
|
418
|
+
|
398
419
|
let navigationViewController = NavigationViewController(
|
399
420
|
navigationRoutes: navigationRoutes,
|
400
|
-
navigationOptions:
|
401
|
-
styles: [.dayStyle],
|
402
|
-
navigationMapView: nil,
|
403
|
-
voiceController: ExpoMapboxNavigationViewController.navigationProvider.routeVoiceController,
|
404
|
-
eventsManager: ExpoMapboxNavigationViewController.navigationProvider.eventsManager()
|
405
|
-
)
|
421
|
+
navigationOptions: navigationOptions
|
406
422
|
)
|
407
423
|
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
topBanner.backgroundColor = topBannerBackgroundColor ?? UIColor(hex: "#FFFFFF")
|
413
|
-
let instructionsView = navigationView.instructionsBannerView
|
414
|
-
instructionsView.primaryLabel.textColor = topBannerPrimaryTextColor ?? UIColor(hex: "#000000")
|
415
|
-
instructionsView.secondaryLabel.textColor = topBannerSecondaryTextColor ?? UIColor(hex: "#666666")
|
416
|
-
instructionsView.distanceLabel.textColor = topBannerDistanceTextColor ?? UIColor(hex: "#666666")
|
417
|
-
instructionsView.separatorView.backgroundColor = topBannerSeparatorColor ?? UIColor(hex: "#EEEEEE")
|
424
|
+
topBanner.instructionsBannerView.primaryLabel.textColor = topBannerPrimaryTextColor ?? UIColor(hex: "#000000")
|
425
|
+
topBanner.instructionsBannerView.secondaryLabel.textColor = topBannerSecondaryTextColor ?? UIColor(hex: "#666666")
|
426
|
+
topBanner.instructionsBannerView.distanceLabel.textColor = topBannerDistanceTextColor ?? UIColor(hex: "#666666")
|
427
|
+
topBanner.instructionsBannerView.separatorView.backgroundColor = topBannerSeparatorColor ?? UIColor(hex: "#EEEEEE")
|
418
428
|
|
419
|
-
|
420
|
-
|
421
|
-
bottomBanner.
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
do {
|
434
|
-
try navigationMapView?.mapView.mapboxMap.localizeLabels(into: self.currentLocale)
|
435
|
-
} catch {
|
436
|
-
print("Failed to localize map labels: \(error)")
|
437
|
-
}
|
438
|
-
}
|
439
|
-
}
|
429
|
+
bottomBanner.timeRemainingLabel.textColor = bottomBannerTimeRemainingTextColor ?? UIColor(hex: "#000000")
|
430
|
+
bottomBanner.distanceRemainingLabel.textColor = bottomBannerDistanceRemainingTextColor ?? UIColor(hex: "#666666")
|
431
|
+
bottomBanner.arrivalTimeLabel.textColor = bottomBannerArrivalTimeTextColor ?? UIColor(hex: "#666666")
|
432
|
+
|
433
|
+
let navigationMapView = navigationViewController.navigationMapView
|
434
|
+
navigationMapView.puckType = .puck2D(.navigationDefault)
|
435
|
+
|
436
|
+
let style = currentMapStyle != nil ? StyleURI(rawValue: currentMapStyle!) : StyleURI.streets
|
437
|
+
navigationMapView!.mapView.mapboxMap.loadStyle(style!, completion: { _ in
|
438
|
+
navigationMapView!.localizeLabels(locale: self.currentLocale)
|
439
|
+
do{
|
440
|
+
try navigationMapView!.mapView.mapboxMap.localizeLabels(into: self.currentLocale)
|
441
|
+
} catch {}
|
442
|
+
})
|
440
443
|
|
441
444
|
let cancelButton = navigationView.bottomBannerContainerView.findViews(subclassOf: CancelButton.self).first
|
442
445
|
cancelButton?.addTarget(self, action: #selector(cancelButtonClicked), for: UIControl.Event.touchUpInside)
|
@@ -475,7 +478,7 @@ class ExpoMapboxNavigationViewController: UIViewController {
|
|
475
478
|
}
|
476
479
|
|
477
480
|
// 2. Information Stack
|
478
|
-
let infoStack = navigationView.informationStackView
|
481
|
+
let infoStack = navigationViewController.navigationView.informationStackView
|
479
482
|
infoStack.backgroundColor = informationStackBackgroundColor ?? UIColor(hex: "#FFFFFF")
|
480
483
|
for view in infoStack.arrangedSubviews {
|
481
484
|
if let label = view as? UILabel {
|
@@ -484,19 +487,19 @@ class ExpoMapboxNavigationViewController: UIViewController {
|
|
484
487
|
}
|
485
488
|
|
486
489
|
// 4. Resume Button
|
487
|
-
let resumeButton = navigationView.resumeButton
|
490
|
+
let resumeButton = navigationViewController.navigationView.resumeButton
|
488
491
|
resumeButton.backgroundColor = resumeButtonBackgroundColor ?? UIColor(hex: "#FFFFFF")
|
489
492
|
resumeButton.setTitleColor(resumeButtonTextColor ?? UIColor(hex: "#000000"), for: UIControl.State.normal)
|
490
493
|
|
491
494
|
// 5. Speed Limit View
|
492
|
-
let speedLimitView = navigationView.speedLimitView
|
495
|
+
let speedLimitView = navigationViewController.navigationView.speedLimitView
|
493
496
|
speedLimitView.backgroundColor = speedLimitBackgroundColor ?? UIColor(hex: "#FFFFFF")
|
494
497
|
if let speedLabel = speedLimitView.subviews.first as? UILabel {
|
495
498
|
speedLabel.textColor = speedLimitTextColor ?? UIColor(hex: "#000000")
|
496
499
|
}
|
497
500
|
|
498
501
|
// 6. Floating Stack
|
499
|
-
let floatingStack = navigationView.floatingStackView
|
502
|
+
let floatingStack = navigationViewController.navigationView.floatingStackView
|
500
503
|
floatingStack.backgroundColor = floatingStackBackgroundColor ?? UIColor(hex: "#FFFFFF")
|
501
504
|
for button in floatingStack.arrangedSubviews {
|
502
505
|
if let floatingButton = button as? UIButton {
|
@@ -505,7 +508,7 @@ class ExpoMapboxNavigationViewController: UIViewController {
|
|
505
508
|
}
|
506
509
|
|
507
510
|
// 8. Way Name Label
|
508
|
-
let wayNameView = navigationView.wayNameView
|
511
|
+
let wayNameView = navigationViewController.navigationView.wayNameView
|
509
512
|
wayNameView.backgroundColor = wayNameViewBackgroundColor ?? UIColor(hex: "#FFFFFF")
|
510
513
|
wayNameView.label.textColor = wayNameViewTextColor ?? UIColor(hex: "#000000")
|
511
514
|
}
|