@complexify/expo-mapbox-navigation 1.1.0 → 1.1.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.
@@ -1,13 +1,15 @@
1
- import MapboxNavigation
1
+ import Foundation
2
+ import MapboxMaps
3
+ import MapboxNavigationUIKit
2
4
  import UIKit
3
5
 
4
- class CustomNavigationStyle: DayStyle {
5
- var speedLimitTextColor: UIColor?
6
- var speedLimitBackgroundColor: UIColor?
7
- var speedLimitBorderColor: UIColor?
8
- var bottomBannerBackgroundColor: UIColor?
9
- var wayNameTextColor: UIColor?
10
- var wayNameBackgroundColor: UIColor?
6
+ class CustomDayStyle: StandardDayStyle {
7
+ var customSpeedLimitTextColor: UIColor?
8
+ var customSpeedLimitBackgroundColor: UIColor?
9
+ var customSpeedLimitBorderColor: UIColor?
10
+ var customBottomBannerBackgroundColor: UIColor?
11
+ var customWayNameTextColor: UIColor?
12
+ var customWayNameBackgroundColor: UIColor?
11
13
 
12
14
  required init() {
13
15
  super.init()
@@ -17,28 +19,30 @@ class CustomNavigationStyle: DayStyle {
17
19
  override func apply() {
18
20
  super.apply()
19
21
 
22
+ let traitCollection = UIScreen.main.traitCollection
23
+
20
24
  // Speed limit customization
21
- if let textColor = speedLimitTextColor {
22
- SpeedLimitView.appearance().textColor = textColor
25
+ if let textColor = customSpeedLimitTextColor {
26
+ SpeedLimitView.appearance(for: traitCollection).textColor = textColor
23
27
  }
24
- if let bgColor = speedLimitBackgroundColor {
25
- SpeedLimitView.appearance().signBackColor = bgColor
28
+ if let bgColor = customSpeedLimitBackgroundColor {
29
+ SpeedLimitView.appearance(for: traitCollection).signBackColor = bgColor
26
30
  }
27
- if let borderColor = speedLimitBorderColor {
28
- SpeedLimitView.appearance().regulatoryBorderColor = borderColor
31
+ if let borderColor = customSpeedLimitBorderColor {
32
+ SpeedLimitView.appearance(for: traitCollection).regulatoryBorderColor = borderColor
29
33
  }
30
34
 
31
35
  // Bottom banner customization
32
- if let bottomBannerBg = bottomBannerBackgroundColor {
33
- BottomBannerView.appearance().backgroundColor = bottomBannerBg
36
+ if let bottomBannerBg = customBottomBannerBackgroundColor {
37
+ BottomBannerView.appearance(for: traitCollection).backgroundColor = bottomBannerBg
34
38
  }
35
39
 
36
40
  // Way name customization
37
- if let textColor = wayNameTextColor {
38
- WayNameView.appearance().textColor = textColor
41
+ if let textColor = customWayNameTextColor {
42
+ WayNameView.appearance(for: traitCollection).textColor = textColor
39
43
  }
40
- if let bgColor = wayNameBackgroundColor {
41
- WayNameView.appearance().backgroundColor = bgColor.withAlphaComponent(0.8)
44
+ if let bgColor = customWayNameBackgroundColor {
45
+ WayNameView.appearance(for: traitCollection).backgroundColor = bgColor.withAlphaComponent(0.8)
42
46
  }
43
47
  }
44
- }
48
+ }
@@ -4,7 +4,6 @@ import MapboxMaps
4
4
  import MapboxNavigationUIKit
5
5
  import MapboxDirections
6
6
  import Combine
7
- import CustomNavigationStyle
8
7
 
9
8
 
10
9
  class ExpoMapboxNavigationView: ExpoView {
@@ -18,7 +17,7 @@ class ExpoMapboxNavigationView: ExpoView {
18
17
 
19
18
  let controller = ExpoMapboxNavigationViewController()
20
19
 
21
- let customStyle = CustomNavigationStyle()
20
+ let customDayStyle = CustomDayStyle()
22
21
 
23
22
  required init(appContext: AppContext? = nil) {
24
23
  super.init(appContext: appContext)
@@ -258,7 +257,7 @@ class ExpoMapboxNavigationViewController: UIViewController {
258
257
  }
259
258
 
260
259
  func setBottomBannerBackgroundColor(hexColor: String) {
261
- customStyle.bottomBannerBackgroundColor = UIColor(hex: hexColor)
260
+ customDayStyle.customBottomBannerBackgroundColor = UIColor(hex: hexColor)
262
261
  update()
263
262
  }
264
263
 
@@ -298,22 +297,22 @@ class ExpoMapboxNavigationViewController: UIViewController {
298
297
  }
299
298
 
300
299
  func setSpeedLimitBackgroundColor(hexColor: String) {
301
- customStyle.speedLimitBackgroundColor = UIColor(hex: hexColor)
300
+ customDayStyle.customSpeedLimitBackgroundColor = UIColor(hex: hexColor)
302
301
  update()
303
302
  }
304
303
 
305
304
  func setSpeedLimitTextColor(hexColor: String) {
306
- customStyle.speedLimitTextColor = UIColor(hex: hexColor)
305
+ customDayStyle.customSpeedLimitTextColor = UIColor(hex: hexColor)
307
306
  update()
308
307
  }
309
308
 
310
309
  func setWayNameViewBackgroundColor(hexColor: String) {
311
- customStyle.wayNameBackgroundColor = UIColor(hex: hexColor)
310
+ customDayStyle.customWayNameBackgroundColor = UIColor(hex: hexColor)
312
311
  update()
313
312
  }
314
313
 
315
314
  func setWayNameViewTextColor(hexColor: String) {
316
- customStyle.wayNameTextColor = UIColor(hex: hexColor)
315
+ customDayStyle.customWayNameTextColor = UIColor(hex: hexColor)
317
316
  update()
318
317
  }
319
318
 
@@ -328,7 +327,7 @@ class ExpoMapboxNavigationViewController: UIViewController {
328
327
  }
329
328
 
330
329
  func setSpeedLimitBorderColor(hexColor: String) {
331
- customStyle.speedLimitBorderColor = UIColor(hex: hexColor)
330
+ customDayStyle.customSpeedLimitBorderColor = UIColor(hex: hexColor)
332
331
  update()
333
332
  }
334
333
 
@@ -437,7 +436,7 @@ class ExpoMapboxNavigationViewController: UIViewController {
437
436
  }
438
437
 
439
438
  let navigationOptions = NavigationOptions(
440
- styles: [customStyle],
439
+ styles: [customDayStyle],
441
440
  mapboxNavigation: self.mapboxNavigation!,
442
441
  voiceController: ExpoMapboxNavigationViewController.navigationProvider.routeVoiceController,
443
442
  eventsManager: ExpoMapboxNavigationViewController.navigationProvider.eventsManager(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@complexify/expo-mapbox-navigation",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Expo module for Mapbox's Navigation SDK",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",