@complexify/expo-mapbox-navigation 1.0.4 → 1.0.5
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 +34 -26
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -392,51 +392,59 @@ 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
424
|
let navigationView = navigationViewController.navigationView
|
409
|
-
|
410
|
-
//
|
411
|
-
let topBanner = navigationView.topBannerContainerView
|
412
|
-
topBanner.backgroundColor = topBannerBackgroundColor ?? UIColor(hex: "#FFFFFF")
|
425
|
+
|
426
|
+
// Then customize the properly initialized banners
|
413
427
|
let instructionsView = navigationView.instructionsBannerView
|
414
428
|
instructionsView.primaryLabel.textColor = topBannerPrimaryTextColor ?? UIColor(hex: "#000000")
|
415
429
|
instructionsView.secondaryLabel.textColor = topBannerSecondaryTextColor ?? UIColor(hex: "#666666")
|
416
430
|
instructionsView.distanceLabel.textColor = topBannerDistanceTextColor ?? UIColor(hex: "#666666")
|
417
431
|
instructionsView.separatorView.backgroundColor = topBannerSeparatorColor ?? UIColor(hex: "#EEEEEE")
|
418
432
|
|
419
|
-
// Customize bottom banner colors
|
420
|
-
let bottomBanner = navigationView.bottomBannerContainerView
|
421
|
-
bottomBanner.backgroundColor = bottomBannerBackgroundColor ?? UIColor(hex: "#FFFFFF")
|
422
433
|
let bottomView = navigationView.bottomBannerView
|
423
434
|
bottomView.timeRemainingLabel.textColor = bottomBannerTimeRemainingTextColor ?? UIColor(hex: "#000000")
|
424
435
|
bottomView.distanceRemainingLabel.textColor = bottomBannerDistanceRemainingTextColor ?? UIColor(hex: "#666666")
|
425
436
|
bottomView.arrivalTimeLabel.textColor = bottomBannerArrivalTimeTextColor ?? UIColor(hex: "#666666")
|
426
437
|
|
427
438
|
let navigationMapView = navigationView.navigationMapView
|
428
|
-
navigationMapView
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
}
|
438
|
-
}
|
439
|
-
}
|
439
|
+
navigationMapView!.puckType = .puck2D(.navigationDefault)
|
440
|
+
|
441
|
+
let style = currentMapStyle != nil ? StyleURI(rawValue: currentMapStyle!) : StyleURI.streets
|
442
|
+
navigationMapView!.mapView.mapboxMap.loadStyle(style!, completion: { _ in
|
443
|
+
navigationMapView!.localizeLabels(locale: self.currentLocale)
|
444
|
+
do{
|
445
|
+
try navigationMapView!.mapView.mapboxMap.localizeLabels(into: self.currentLocale)
|
446
|
+
} catch {}
|
447
|
+
})
|
440
448
|
|
441
449
|
let cancelButton = navigationView.bottomBannerContainerView.findViews(subclassOf: CancelButton.self).first
|
442
450
|
cancelButton?.addTarget(self, action: #selector(cancelButtonClicked), for: UIControl.Event.touchUpInside)
|