@iternio/react-native-auto-play 0.3.10 → 0.3.11

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.
@@ -55,6 +55,7 @@ class AndroidAutoSession(sessionInfo: SessionInfo) :
55
55
  null,
56
56
  arrayOf(action),
57
57
  null,
58
+ null,
58
59
  null
59
60
  )
60
61
 
@@ -66,6 +66,10 @@ class MapTemplate(
66
66
  navigationManager.setNavigationManagerCallback(navigationManagerCallback)
67
67
  }
68
68
  }
69
+
70
+ config.defaultGuidanceBackgroundColor?.let { nitroColor ->
71
+ MapTemplate.cardBackgroundColor = Parser.parseColor(nitroColor)
72
+ }
69
73
  }
70
74
 
71
75
  override fun parse(): Template {
@@ -329,7 +333,9 @@ class MapTemplate(
329
333
  }
330
334
 
331
335
  if (loadingInfo != null) {
336
+ cardBackgroundColor = Parser.parseColor(loadingInfo.cardBackgroundColor)
332
337
  navigationInfo = RoutingInfo.Builder().setLoading(true).build()
338
+ AndroidAutoScreen.invalidateSurfaceScreens()
333
339
  return
334
340
  }
335
341
 
@@ -138,12 +138,9 @@ class HybridMapTemplate: HybridMapTemplateSpec {
138
138
  {
139
139
  template.updateManeuvers(messageManeuver: messageManeuver)
140
140
  }()
141
- case .third(let loadingManeuver):
141
+ case .third(let loading):
142
142
  {
143
- template.navigationSession?.pauseTrip(
144
- for: .loading,
145
- description: nil
146
- )
143
+ template.updateManeuversLoading(loading: loading)
147
144
  }()
148
145
  }
149
146
 
@@ -50,6 +50,18 @@ class MapTemplate: AutoPlayHeaderProviding,
50
50
  visibleTravelEstimate = config.visibleTravelEstimate
51
51
 
52
52
  template = CPMapTemplate(id: config.id)
53
+ if let nitroColor = config.defaultGuidanceBackgroundColor,
54
+ let traitCollection = SceneStore.getRootTraitCollection()
55
+ {
56
+ let cardBackgroundColor = Parser.routingManeuverCardBackgroundUIColor(
57
+ color: nitroColor,
58
+ traitCollection: traitCollection
59
+ )
60
+ template.guidanceBackgroundColor = cardBackgroundColor
61
+ }
62
+ else {
63
+ template.guidanceBackgroundColor = .black
64
+ }
53
65
 
54
66
  if let initialProperties = SceneStore.getRootScene()?.initialProperties,
55
67
  let windowDict = initialProperties["window"] as? [String: Any],
@@ -607,6 +619,35 @@ class MapTemplate: AutoPlayHeaderProviding,
607
619
  updateVisibleTravelEstimate(visibleTravelEstimate: nil)
608
620
  }
609
621
 
622
+ func updateManeuversLoading(loading: NitroLoadingManeuver) {
623
+ guard let navigationSession = navigationSession else { return }
624
+
625
+ let description = loading.text
626
+
627
+ guard let traitCollection = SceneStore.getRootTraitCollection() else {
628
+ navigationSession.pauseTrip(for: .loading, description: description)
629
+ return
630
+ }
631
+
632
+ let cardBackgroundColor = Parser.routingManeuverCardBackgroundUIColor(
633
+ color: loading.cardBackgroundColor,
634
+ traitCollection: traitCollection
635
+ )
636
+
637
+ template.guidanceBackgroundColor = cardBackgroundColor
638
+
639
+ if #available(iOS 18.0, *) {
640
+ navigationSession.pauseTrip(
641
+ for: .loading,
642
+ description: description,
643
+ turnCardColor: cardBackgroundColor
644
+ )
645
+ }
646
+ else {
647
+ navigationSession.pauseTrip(for: .loading, description: description)
648
+ }
649
+ }
650
+
610
651
  func updateManeuvers(messageManeuver: NitroMessageManeuver) {
611
652
  guard let navigationSession = navigationSession else { return }
612
653
 
@@ -503,6 +503,21 @@ class Parser {
503
503
  )
504
504
  }
505
505
 
506
+ /// Card background `UIColor` for routing maneuvers and loading pause — same light/dark component pick as `parseManeuver`.
507
+ static func routingManeuverCardBackgroundUIColor(
508
+ color: NitroColor,
509
+ traitCollection: UITraitCollection
510
+ ) -> UIColor {
511
+ if #available(iOS 15.4, *) {
512
+ let component =
513
+ traitCollection.userInterfaceStyle == .dark
514
+ ? color.darkColor
515
+ : color.lightColor
516
+ return doubleToColor(value: component)
517
+ }
518
+ return parseColor(color: color)
519
+ }
520
+
506
521
  static func parseManeuver(
507
522
  nitroManeuver: NitroRoutingManeuver,
508
523
  traitCollection: UITraitCollection
@@ -528,13 +543,9 @@ class Parser {
528
543
  )
529
544
 
530
545
  if #available(iOS 15.4, *) {
531
- let cardBackgroundColor =
532
- traitCollection.userInterfaceStyle == .dark
533
- ? nitroManeuver.cardBackgroundColor.darkColor
534
- : nitroManeuver.cardBackgroundColor.lightColor
535
-
536
- maneuver.cardBackgroundColor = doubleToColor(
537
- value: cardBackgroundColor
546
+ maneuver.cardBackgroundColor = routingManeuverCardBackgroundUIColor(
547
+ color: nitroManeuver.cardBackgroundColor,
548
+ traitCollection: traitCollection
538
549
  )
539
550
  }
540
551
 
@@ -6,6 +6,7 @@ import type { ColorScheme, RootComponentInitialProps } from '../types/RootCompon
6
6
  import type { TripConfig, TripPoint, TripPreviewTextConfiguration, TripsConfig } from '../types/Trip';
7
7
  import { type NitroAction } from '../utils/NitroAction';
8
8
  import { type NavigationAlert } from '../utils/NitroAlert';
9
+ import { type NitroColor, type ThemedColor } from '../utils/NitroColor';
9
10
  import { NitroMapButton } from '../utils/NitroMapButton';
10
11
  import { type HeaderActionsIos, type NitroBaseMapTemplateConfig, Template, type TemplateConfig } from './Template';
11
12
  export type Point = {
@@ -53,6 +54,7 @@ export interface NitroMapTemplateConfig extends TemplateConfig, NitroBaseMapTemp
53
54
  onAutoDriveEnabled?: () => void;
54
55
  mapButtons?: Array<NitroMapButton>;
55
56
  headerActions?: Array<NitroAction>;
57
+ defaultGuidanceBackgroundColor?: NitroColor;
56
58
  /**
57
59
  * specify the percentage of screen height/width the pan button should scroll
58
60
  * @namespace iOS
@@ -78,7 +80,7 @@ export type BaseMapTemplateConfig<T> = {
78
80
  */
79
81
  headerActions?: MapHeaderActions<T>;
80
82
  };
81
- export type MapTemplateConfig = Omit<NitroMapTemplateConfig, 'mapButtons' | 'headerActions' | 'onStopNavigation' | 'onAutoDriveEnabled'> & BaseMapTemplateConfig<MapTemplate> & {
83
+ export type MapTemplateConfig = Omit<NitroMapTemplateConfig, 'mapButtons' | 'headerActions' | 'onStopNavigation' | 'onAutoDriveEnabled' | 'defaultGuidanceBackgroundColor'> & BaseMapTemplateConfig<MapTemplate> & {
82
84
  /**
83
85
  * react component that is rendered
84
86
  */
@@ -93,6 +95,10 @@ export type MapTemplateConfig = Omit<NitroMapTemplateConfig, 'mapButtons' | 'hea
93
95
  * @namespace Android
94
96
  */
95
97
  onAutoDriveEnabled?: (template: MapTemplate) => void;
98
+ /**
99
+ * Initial navigation maneuver background color. Mainly useful, when in CarPlay the default loading maneuver does not have the right color.
100
+ */
101
+ defaultGuidanceBackgroundColor?: ThemedColor | string;
96
102
  };
97
103
  export interface TripSelectorCallback {
98
104
  setSelectedTrip: (id: string) => void;
@@ -7,6 +7,7 @@ import { SafeAreaInsetsProvider } from '../components/SafeAreaInsetsContext';
7
7
  import { HybridAutoPlay } from '../hybrid/HybridAutoPlay';
8
8
  import { NitroActionUtil } from '../utils/NitroAction';
9
9
  import { NitroAlertUtil } from '../utils/NitroAlert';
10
+ import { NitroColorUtil } from '../utils/NitroColor';
10
11
  import { NitroManeuverUtil } from '../utils/NitroManeuver';
11
12
  import { NitroMapButton } from '../utils/NitroMapButton';
12
13
  import { Template, } from './Template';
@@ -16,7 +17,7 @@ export class MapTemplate extends Template {
16
17
  template = this;
17
18
  constructor(config) {
18
19
  super(config);
19
- const { component, mapButtons, headerActions, onStopNavigation, onAutoDriveEnabled, ...baseConfig } = config;
20
+ const { component, mapButtons, headerActions, onStopNavigation, onAutoDriveEnabled, defaultGuidanceBackgroundColor, ...baseConfig } = config;
20
21
  AppRegistry.registerComponent(this.id, () => (props) => React.createElement(MapTemplateProvider, {
21
22
  mapTemplate: this.template,
22
23
  // biome-ignore lint/correctness/noChildrenProp: there is no other way in a ts file
@@ -37,6 +38,9 @@ export class MapTemplate extends Template {
37
38
  mapButtons: NitroMapButton.convert(this.template, mapButtons),
38
39
  onStopNavigation: () => onStopNavigation(this.template),
39
40
  onAutoDriveEnabled: onAutoDriveEnabled ? () => onAutoDriveEnabled(this.template) : undefined,
41
+ defaultGuidanceBackgroundColor: defaultGuidanceBackgroundColor != null
42
+ ? NitroColorUtil.convert(defaultGuidanceBackgroundColor)
43
+ : undefined,
40
44
  };
41
45
  HybridMapTemplate.createMapTemplate(nitroConfig);
42
46
  }
@@ -111,7 +115,11 @@ export class MapTemplate extends Template {
111
115
  return;
112
116
  }
113
117
  if (maneuvers.type === 'loading') {
114
- HybridMapTemplate.updateManeuvers(this.id, { isLoading: true });
118
+ HybridMapTemplate.updateManeuvers(this.id, {
119
+ isLoading: true,
120
+ cardBackgroundColor: NitroColorUtil.convert(maneuvers.cardBackgroundColor),
121
+ text: maneuvers.text != null ? maneuvers.text : undefined,
122
+ });
115
123
  return;
116
124
  }
117
125
  const messageManeuver = NitroManeuverUtil.convert(maneuvers);
@@ -210,6 +210,12 @@ export type MessageManeuver = {
210
210
  };
211
211
  export type LoadingManeuver = {
212
212
  type: 'loading';
213
+ cardBackgroundColor: ThemedColor | string;
214
+ /**
215
+ * @namespace iOS CarPlay — shows text on the loading maneuver card
216
+ * @namespace Android Auto — not supported
217
+ */
218
+ text?: string;
213
219
  };
214
220
  export type AutoManeuver = (Array<RoutingManeuver> & {
215
221
  length: 0 | 1 | 2;
@@ -35,6 +35,8 @@ export interface NitroMessageManeuver {
35
35
  }
36
36
  interface NitroLoadingManeuver {
37
37
  isLoading: true;
38
+ cardBackgroundColor: NitroColor;
39
+ text?: string;
38
40
  }
39
41
  export type NitroManeuver = Array<NitroRoutingManeuver> | NitroMessageManeuver | NitroLoadingManeuver;
40
42
  declare function convert(autoManeuver: MessageManeuver): NitroMessageManeuver;
@@ -103,6 +103,8 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
103
103
  jni::local_ref<jni::JArrayClass<JNitroMapButton>> mapButtons = this->getFieldValue(fieldMapButtons);
104
104
  static const auto fieldHeaderActions = clazz->getField<jni::JArrayClass<JNitroAction>>("headerActions");
105
105
  jni::local_ref<jni::JArrayClass<JNitroAction>> headerActions = this->getFieldValue(fieldHeaderActions);
106
+ static const auto fieldDefaultGuidanceBackgroundColor = clazz->getField<JNitroColor>("defaultGuidanceBackgroundColor");
107
+ jni::local_ref<JNitroColor> defaultGuidanceBackgroundColor = this->getFieldValue(fieldDefaultGuidanceBackgroundColor);
106
108
  static const auto fieldPanButtonScrollPercentage = clazz->getField<jni::JDouble>("panButtonScrollPercentage");
107
109
  jni::local_ref<jni::JDouble> panButtonScrollPercentage = this->getFieldValue(fieldPanButtonScrollPercentage);
108
110
  static const auto fieldOnDidChangePanningInterface = clazz->getField<JFunc_void_bool::javaobject>("onDidChangePanningInterface");
@@ -239,6 +241,7 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
239
241
  }
240
242
  return __vector;
241
243
  }()) : std::nullopt,
244
+ defaultGuidanceBackgroundColor != nullptr ? std::make_optional(defaultGuidanceBackgroundColor->toCpp()) : std::nullopt,
242
245
  panButtonScrollPercentage != nullptr ? std::make_optional(panButtonScrollPercentage->value()) : std::nullopt,
243
246
  onDidChangePanningInterface != nullptr ? std::make_optional([&]() -> std::function<void(bool /* isPanningInterfaceVisible */)> {
244
247
  if (onDidChangePanningInterface->isInstanceOf(JFunc_void_bool_cxx::javaClassStatic())) [[likely]] {
@@ -258,7 +261,7 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
258
261
  */
259
262
  [[maybe_unused]]
260
263
  static jni::local_ref<JMapTemplateConfig::javaobject> fromCpp(const MapTemplateConfig& value) {
261
- using JSignature = JMapTemplateConfig(jni::alias_ref<jni::JString>, jni::alias_ref<JFunc_void_std__optional_bool_::javaobject>, jni::alias_ref<JFunc_void_std__optional_bool_::javaobject>, jni::alias_ref<JFunc_void_std__optional_bool_::javaobject>, jni::alias_ref<JFunc_void_std__optional_bool_::javaobject>, jni::alias_ref<JFunc_void::javaobject>, jni::alias_ref<jni::JDouble>, jni::alias_ref<JVisibleTravelEstimate>, jni::alias_ref<JFunc_void_Point_std__optional_Point_::javaobject>, jni::alias_ref<JFunc_void_Point_double::javaobject>, jni::alias_ref<JFunc_void_Point::javaobject>, jni::alias_ref<JFunc_void_Point::javaobject>, jni::alias_ref<JFunc_void_ColorScheme::javaobject>, jni::alias_ref<JFunc_void::javaobject>, jni::alias_ref<JFunc_void::javaobject>, jni::alias_ref<jni::JArrayClass<JNitroMapButton>>, jni::alias_ref<jni::JArrayClass<JNitroAction>>, jni::alias_ref<jni::JDouble>, jni::alias_ref<JFunc_void_bool::javaobject>);
264
+ using JSignature = JMapTemplateConfig(jni::alias_ref<jni::JString>, jni::alias_ref<JFunc_void_std__optional_bool_::javaobject>, jni::alias_ref<JFunc_void_std__optional_bool_::javaobject>, jni::alias_ref<JFunc_void_std__optional_bool_::javaobject>, jni::alias_ref<JFunc_void_std__optional_bool_::javaobject>, jni::alias_ref<JFunc_void::javaobject>, jni::alias_ref<jni::JDouble>, jni::alias_ref<JVisibleTravelEstimate>, jni::alias_ref<JFunc_void_Point_std__optional_Point_::javaobject>, jni::alias_ref<JFunc_void_Point_double::javaobject>, jni::alias_ref<JFunc_void_Point::javaobject>, jni::alias_ref<JFunc_void_Point::javaobject>, jni::alias_ref<JFunc_void_ColorScheme::javaobject>, jni::alias_ref<JFunc_void::javaobject>, jni::alias_ref<JFunc_void::javaobject>, jni::alias_ref<jni::JArrayClass<JNitroMapButton>>, jni::alias_ref<jni::JArrayClass<JNitroAction>>, jni::alias_ref<JNitroColor>, jni::alias_ref<jni::JDouble>, jni::alias_ref<JFunc_void_bool::javaobject>);
262
265
  static const auto clazz = javaClassStatic();
263
266
  static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
264
267
  return create(
@@ -298,6 +301,7 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
298
301
  }
299
302
  return __array;
300
303
  }() : nullptr,
304
+ value.defaultGuidanceBackgroundColor.has_value() ? JNitroColor::fromCpp(value.defaultGuidanceBackgroundColor.value()) : nullptr,
301
305
  value.panButtonScrollPercentage.has_value() ? jni::JDouble::valueOf(value.panButtonScrollPercentage.value()) : nullptr,
302
306
  value.onDidChangePanningInterface.has_value() ? JFunc_void_bool_cxx::fromCpp(value.onDidChangePanningInterface.value()) : nullptr
303
307
  );
@@ -10,7 +10,10 @@
10
10
  #include <fbjni/fbjni.h>
11
11
  #include "NitroLoadingManeuver.hpp"
12
12
 
13
-
13
+ #include "JNitroColor.hpp"
14
+ #include "NitroColor.hpp"
15
+ #include <optional>
16
+ #include <string>
14
17
 
15
18
  namespace margelo::nitro::swe::iternio::reactnativeautoplay {
16
19
 
@@ -33,8 +36,14 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
33
36
  static const auto clazz = javaClassStatic();
34
37
  static const auto fieldIsLoading = clazz->getField<jboolean>("isLoading");
35
38
  jboolean isLoading = this->getFieldValue(fieldIsLoading);
39
+ static const auto fieldCardBackgroundColor = clazz->getField<JNitroColor>("cardBackgroundColor");
40
+ jni::local_ref<JNitroColor> cardBackgroundColor = this->getFieldValue(fieldCardBackgroundColor);
41
+ static const auto fieldText = clazz->getField<jni::JString>("text");
42
+ jni::local_ref<jni::JString> text = this->getFieldValue(fieldText);
36
43
  return NitroLoadingManeuver(
37
- static_cast<bool>(isLoading)
44
+ static_cast<bool>(isLoading),
45
+ cardBackgroundColor->toCpp(),
46
+ text != nullptr ? std::make_optional(text->toStdString()) : std::nullopt
38
47
  );
39
48
  }
40
49
 
@@ -44,12 +53,14 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
44
53
  */
45
54
  [[maybe_unused]]
46
55
  static jni::local_ref<JNitroLoadingManeuver::javaobject> fromCpp(const NitroLoadingManeuver& value) {
47
- using JSignature = JNitroLoadingManeuver(jboolean);
56
+ using JSignature = JNitroLoadingManeuver(jboolean, jni::alias_ref<JNitroColor>, jni::alias_ref<jni::JString>);
48
57
  static const auto clazz = javaClassStatic();
49
58
  static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
50
59
  return create(
51
60
  clazz,
52
- value.isLoading
61
+ value.isLoading,
62
+ JNitroColor::fromCpp(value.cardBackgroundColor),
63
+ value.text.has_value() ? jni::make_jstring(value.text.value()) : nullptr
53
64
  );
54
65
  }
55
66
  };
@@ -70,6 +70,9 @@ data class MapTemplateConfig(
70
70
  val headerActions: Array<NitroAction>?,
71
71
  @DoNotStrip
72
72
  @Keep
73
+ val defaultGuidanceBackgroundColor: NitroColor?,
74
+ @DoNotStrip
75
+ @Keep
73
76
  val panButtonScrollPercentage: Double?,
74
77
  @DoNotStrip
75
78
  @Keep
@@ -78,8 +81,8 @@ data class MapTemplateConfig(
78
81
  /**
79
82
  * Create a new instance of MapTemplateConfig from Kotlin
80
83
  */
81
- constructor(id: String, onWillAppear: ((animated: Boolean?) -> Unit)?, onWillDisappear: ((animated: Boolean?) -> Unit)?, onDidAppear: ((animated: Boolean?) -> Unit)?, onDidDisappear: ((animated: Boolean?) -> Unit)?, onPopped: (() -> Unit)?, autoDismissMs: Double?, visibleTravelEstimate: VisibleTravelEstimate?, onDidPan: ((translation: Point, velocity: Point?) -> Unit)?, onDidUpdateZoomGestureWithCenter: ((center: Point, scale: Double) -> Unit)?, onClick: ((center: Point) -> Unit)?, onDoubleClick: ((center: Point) -> Unit)?, onAppearanceDidChange: ((colorScheme: ColorScheme) -> Unit)?, onStopNavigation: () -> Unit, onAutoDriveEnabled: (() -> Unit)?, mapButtons: Array<NitroMapButton>?, headerActions: Array<NitroAction>?, panButtonScrollPercentage: Double?, onDidChangePanningInterface: ((isPanningInterfaceVisible: Boolean) -> Unit)?):
82
- this(id, onWillAppear?.let { Func_void_std__optional_bool__java(it) }, onWillDisappear?.let { Func_void_std__optional_bool__java(it) }, onDidAppear?.let { Func_void_std__optional_bool__java(it) }, onDidDisappear?.let { Func_void_std__optional_bool__java(it) }, onPopped?.let { Func_void_java(it) }, autoDismissMs, visibleTravelEstimate, onDidPan?.let { Func_void_Point_std__optional_Point__java(it) }, onDidUpdateZoomGestureWithCenter?.let { Func_void_Point_double_java(it) }, onClick?.let { Func_void_Point_java(it) }, onDoubleClick?.let { Func_void_Point_java(it) }, onAppearanceDidChange?.let { Func_void_ColorScheme_java(it) }, Func_void_java(onStopNavigation), onAutoDriveEnabled?.let { Func_void_java(it) }, mapButtons, headerActions, panButtonScrollPercentage, onDidChangePanningInterface?.let { Func_void_bool_java(it) })
84
+ constructor(id: String, onWillAppear: ((animated: Boolean?) -> Unit)?, onWillDisappear: ((animated: Boolean?) -> Unit)?, onDidAppear: ((animated: Boolean?) -> Unit)?, onDidDisappear: ((animated: Boolean?) -> Unit)?, onPopped: (() -> Unit)?, autoDismissMs: Double?, visibleTravelEstimate: VisibleTravelEstimate?, onDidPan: ((translation: Point, velocity: Point?) -> Unit)?, onDidUpdateZoomGestureWithCenter: ((center: Point, scale: Double) -> Unit)?, onClick: ((center: Point) -> Unit)?, onDoubleClick: ((center: Point) -> Unit)?, onAppearanceDidChange: ((colorScheme: ColorScheme) -> Unit)?, onStopNavigation: () -> Unit, onAutoDriveEnabled: (() -> Unit)?, mapButtons: Array<NitroMapButton>?, headerActions: Array<NitroAction>?, defaultGuidanceBackgroundColor: NitroColor?, panButtonScrollPercentage: Double?, onDidChangePanningInterface: ((isPanningInterfaceVisible: Boolean) -> Unit)?):
85
+ this(id, onWillAppear?.let { Func_void_std__optional_bool__java(it) }, onWillDisappear?.let { Func_void_std__optional_bool__java(it) }, onDidAppear?.let { Func_void_std__optional_bool__java(it) }, onDidDisappear?.let { Func_void_std__optional_bool__java(it) }, onPopped?.let { Func_void_java(it) }, autoDismissMs, visibleTravelEstimate, onDidPan?.let { Func_void_Point_std__optional_Point__java(it) }, onDidUpdateZoomGestureWithCenter?.let { Func_void_Point_double_java(it) }, onClick?.let { Func_void_Point_java(it) }, onDoubleClick?.let { Func_void_Point_java(it) }, onAppearanceDidChange?.let { Func_void_ColorScheme_java(it) }, Func_void_java(onStopNavigation), onAutoDriveEnabled?.let { Func_void_java(it) }, mapButtons, headerActions, defaultGuidanceBackgroundColor, panButtonScrollPercentage, onDidChangePanningInterface?.let { Func_void_bool_java(it) })
83
86
 
84
87
  companion object {
85
88
  /**
@@ -89,8 +92,8 @@ data class MapTemplateConfig(
89
92
  @Keep
90
93
  @Suppress("unused")
91
94
  @JvmStatic
92
- private fun fromCpp(id: String, onWillAppear: Func_void_std__optional_bool_?, onWillDisappear: Func_void_std__optional_bool_?, onDidAppear: Func_void_std__optional_bool_?, onDidDisappear: Func_void_std__optional_bool_?, onPopped: Func_void?, autoDismissMs: Double?, visibleTravelEstimate: VisibleTravelEstimate?, onDidPan: Func_void_Point_std__optional_Point_?, onDidUpdateZoomGestureWithCenter: Func_void_Point_double?, onClick: Func_void_Point?, onDoubleClick: Func_void_Point?, onAppearanceDidChange: Func_void_ColorScheme?, onStopNavigation: Func_void, onAutoDriveEnabled: Func_void?, mapButtons: Array<NitroMapButton>?, headerActions: Array<NitroAction>?, panButtonScrollPercentage: Double?, onDidChangePanningInterface: Func_void_bool?): MapTemplateConfig {
93
- return MapTemplateConfig(id, onWillAppear, onWillDisappear, onDidAppear, onDidDisappear, onPopped, autoDismissMs, visibleTravelEstimate, onDidPan, onDidUpdateZoomGestureWithCenter, onClick, onDoubleClick, onAppearanceDidChange, onStopNavigation, onAutoDriveEnabled, mapButtons, headerActions, panButtonScrollPercentage, onDidChangePanningInterface)
95
+ private fun fromCpp(id: String, onWillAppear: Func_void_std__optional_bool_?, onWillDisappear: Func_void_std__optional_bool_?, onDidAppear: Func_void_std__optional_bool_?, onDidDisappear: Func_void_std__optional_bool_?, onPopped: Func_void?, autoDismissMs: Double?, visibleTravelEstimate: VisibleTravelEstimate?, onDidPan: Func_void_Point_std__optional_Point_?, onDidUpdateZoomGestureWithCenter: Func_void_Point_double?, onClick: Func_void_Point?, onDoubleClick: Func_void_Point?, onAppearanceDidChange: Func_void_ColorScheme?, onStopNavigation: Func_void, onAutoDriveEnabled: Func_void?, mapButtons: Array<NitroMapButton>?, headerActions: Array<NitroAction>?, defaultGuidanceBackgroundColor: NitroColor?, panButtonScrollPercentage: Double?, onDidChangePanningInterface: Func_void_bool?): MapTemplateConfig {
96
+ return MapTemplateConfig(id, onWillAppear, onWillDisappear, onDidAppear, onDidDisappear, onPopped, autoDismissMs, visibleTravelEstimate, onDidPan, onDidUpdateZoomGestureWithCenter, onClick, onDoubleClick, onAppearanceDidChange, onStopNavigation, onAutoDriveEnabled, mapButtons, headerActions, defaultGuidanceBackgroundColor, panButtonScrollPercentage, onDidChangePanningInterface)
94
97
  }
95
98
  }
96
99
  }
@@ -19,7 +19,13 @@ import com.facebook.proguard.annotations.DoNotStrip
19
19
  data class NitroLoadingManeuver(
20
20
  @DoNotStrip
21
21
  @Keep
22
- val isLoading: Boolean
22
+ val isLoading: Boolean,
23
+ @DoNotStrip
24
+ @Keep
25
+ val cardBackgroundColor: NitroColor,
26
+ @DoNotStrip
27
+ @Keep
28
+ val text: String?
23
29
  ) {
24
30
  /* primary constructor */
25
31
 
@@ -31,8 +37,8 @@ data class NitroLoadingManeuver(
31
37
  @Keep
32
38
  @Suppress("unused")
33
39
  @JvmStatic
34
- private fun fromCpp(isLoading: Boolean): NitroLoadingManeuver {
35
- return NitroLoadingManeuver(isLoading)
40
+ private fun fromCpp(isLoading: Boolean, cardBackgroundColor: NitroColor, text: String?): NitroLoadingManeuver {
41
+ return NitroLoadingManeuver(isLoading, cardBackgroundColor, text)
36
42
  }
37
43
  }
38
44
  }
@@ -18,7 +18,7 @@ public extension MapTemplateConfig {
18
18
  /**
19
19
  * Create a new instance of `MapTemplateConfig`.
20
20
  */
21
- init(id: String, onWillAppear: ((_ animated: Bool?) -> Void)?, onWillDisappear: ((_ animated: Bool?) -> Void)?, onDidAppear: ((_ animated: Bool?) -> Void)?, onDidDisappear: ((_ animated: Bool?) -> Void)?, onPopped: (() -> Void)?, autoDismissMs: Double?, visibleTravelEstimate: VisibleTravelEstimate?, onDidPan: ((_ translation: Point, _ velocity: Point?) -> Void)?, onDidUpdateZoomGestureWithCenter: ((_ center: Point, _ scale: Double) -> Void)?, onClick: ((_ center: Point) -> Void)?, onDoubleClick: ((_ center: Point) -> Void)?, onAppearanceDidChange: ((_ colorScheme: ColorScheme) -> Void)?, onStopNavigation: @escaping () -> Void, onAutoDriveEnabled: (() -> Void)?, mapButtons: [NitroMapButton]?, headerActions: [NitroAction]?, panButtonScrollPercentage: Double?, onDidChangePanningInterface: ((_ isPanningInterfaceVisible: Bool) -> Void)?) {
21
+ init(id: String, onWillAppear: ((_ animated: Bool?) -> Void)?, onWillDisappear: ((_ animated: Bool?) -> Void)?, onDidAppear: ((_ animated: Bool?) -> Void)?, onDidDisappear: ((_ animated: Bool?) -> Void)?, onPopped: (() -> Void)?, autoDismissMs: Double?, visibleTravelEstimate: VisibleTravelEstimate?, onDidPan: ((_ translation: Point, _ velocity: Point?) -> Void)?, onDidUpdateZoomGestureWithCenter: ((_ center: Point, _ scale: Double) -> Void)?, onClick: ((_ center: Point) -> Void)?, onDoubleClick: ((_ center: Point) -> Void)?, onAppearanceDidChange: ((_ colorScheme: ColorScheme) -> Void)?, onStopNavigation: @escaping () -> Void, onAutoDriveEnabled: (() -> Void)?, mapButtons: [NitroMapButton]?, headerActions: [NitroAction]?, defaultGuidanceBackgroundColor: NitroColor?, panButtonScrollPercentage: Double?, onDidChangePanningInterface: ((_ isPanningInterfaceVisible: Bool) -> Void)?) {
22
22
  self.init(std.string(id), { () -> bridge.std__optional_std__function_void_std__optional_bool_____animated______ in
23
23
  if let __unwrappedValue = onWillAppear {
24
24
  return bridge.create_std__optional_std__function_void_std__optional_bool_____animated______({ () -> bridge.Func_void_std__optional_bool_ in
@@ -157,6 +157,12 @@ public extension MapTemplateConfig {
157
157
  } else {
158
158
  return .init()
159
159
  }
160
+ }(), { () -> bridge.std__optional_NitroColor_ in
161
+ if let __unwrappedValue = defaultGuidanceBackgroundColor {
162
+ return bridge.create_std__optional_NitroColor_(__unwrappedValue)
163
+ } else {
164
+ return .init()
165
+ }
160
166
  }(), { () -> bridge.std__optional_double_ in
161
167
  if let __unwrappedValue = panButtonScrollPercentage {
162
168
  return bridge.create_std__optional_double_(__unwrappedValue)
@@ -448,6 +454,11 @@ public extension MapTemplateConfig {
448
454
  }()
449
455
  }
450
456
 
457
+ @inline(__always)
458
+ var defaultGuidanceBackgroundColor: NitroColor? {
459
+ return self.__defaultGuidanceBackgroundColor.value
460
+ }
461
+
451
462
  @inline(__always)
452
463
  var panButtonScrollPercentage: Double? {
453
464
  return { () -> Double? in
@@ -18,12 +18,35 @@ public extension NitroLoadingManeuver {
18
18
  /**
19
19
  * Create a new instance of `NitroLoadingManeuver`.
20
20
  */
21
- init(isLoading: Bool) {
22
- self.init(isLoading)
21
+ init(isLoading: Bool, cardBackgroundColor: NitroColor, text: String?) {
22
+ self.init(isLoading, cardBackgroundColor, { () -> bridge.std__optional_std__string_ in
23
+ if let __unwrappedValue = text {
24
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
25
+ } else {
26
+ return .init()
27
+ }
28
+ }())
23
29
  }
24
30
 
25
31
  @inline(__always)
26
32
  var isLoading: Bool {
27
33
  return self.__isLoading
28
34
  }
35
+
36
+ @inline(__always)
37
+ var cardBackgroundColor: NitroColor {
38
+ return self.__cardBackgroundColor
39
+ }
40
+
41
+ @inline(__always)
42
+ var text: String? {
43
+ return { () -> String? in
44
+ if bridge.has_value_std__optional_std__string_(self.__text) {
45
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__text)
46
+ return String(__unwrapped)
47
+ } else {
48
+ return nil
49
+ }
50
+ }()
51
+ }
29
52
  }
@@ -38,6 +38,8 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay { enum class ColorSc
38
38
  namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct NitroMapButton; }
39
39
  // Forward declaration of `NitroAction` to properly resolve imports.
40
40
  namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct NitroAction; }
41
+ // Forward declaration of `NitroColor` to properly resolve imports.
42
+ namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct NitroColor; }
41
43
 
42
44
  #include <string>
43
45
  #include <optional>
@@ -48,6 +50,7 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct NitroAction
48
50
  #include "NitroMapButton.hpp"
49
51
  #include <vector>
50
52
  #include "NitroAction.hpp"
53
+ #include "NitroColor.hpp"
51
54
 
52
55
  namespace margelo::nitro::swe::iternio::reactnativeautoplay {
53
56
 
@@ -73,12 +76,13 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
73
76
  std::optional<std::function<void()>> onAutoDriveEnabled SWIFT_PRIVATE;
74
77
  std::optional<std::vector<NitroMapButton>> mapButtons SWIFT_PRIVATE;
75
78
  std::optional<std::vector<NitroAction>> headerActions SWIFT_PRIVATE;
79
+ std::optional<NitroColor> defaultGuidanceBackgroundColor SWIFT_PRIVATE;
76
80
  std::optional<double> panButtonScrollPercentage SWIFT_PRIVATE;
77
81
  std::optional<std::function<void(bool /* isPanningInterfaceVisible */)>> onDidChangePanningInterface SWIFT_PRIVATE;
78
82
 
79
83
  public:
80
84
  MapTemplateConfig() = default;
81
- explicit MapTemplateConfig(std::string id, std::optional<std::function<void(std::optional<bool> /* animated */)>> onWillAppear, std::optional<std::function<void(std::optional<bool> /* animated */)>> onWillDisappear, std::optional<std::function<void(std::optional<bool> /* animated */)>> onDidAppear, std::optional<std::function<void(std::optional<bool> /* animated */)>> onDidDisappear, std::optional<std::function<void()>> onPopped, std::optional<double> autoDismissMs, std::optional<VisibleTravelEstimate> visibleTravelEstimate, std::optional<std::function<void(const Point& /* translation */, const std::optional<Point>& /* velocity */)>> onDidPan, std::optional<std::function<void(const Point& /* center */, double /* scale */)>> onDidUpdateZoomGestureWithCenter, std::optional<std::function<void(const Point& /* center */)>> onClick, std::optional<std::function<void(const Point& /* center */)>> onDoubleClick, std::optional<std::function<void(ColorScheme /* colorScheme */)>> onAppearanceDidChange, std::function<void()> onStopNavigation, std::optional<std::function<void()>> onAutoDriveEnabled, std::optional<std::vector<NitroMapButton>> mapButtons, std::optional<std::vector<NitroAction>> headerActions, std::optional<double> panButtonScrollPercentage, std::optional<std::function<void(bool /* isPanningInterfaceVisible */)>> onDidChangePanningInterface): id(id), onWillAppear(onWillAppear), onWillDisappear(onWillDisappear), onDidAppear(onDidAppear), onDidDisappear(onDidDisappear), onPopped(onPopped), autoDismissMs(autoDismissMs), visibleTravelEstimate(visibleTravelEstimate), onDidPan(onDidPan), onDidUpdateZoomGestureWithCenter(onDidUpdateZoomGestureWithCenter), onClick(onClick), onDoubleClick(onDoubleClick), onAppearanceDidChange(onAppearanceDidChange), onStopNavigation(onStopNavigation), onAutoDriveEnabled(onAutoDriveEnabled), mapButtons(mapButtons), headerActions(headerActions), panButtonScrollPercentage(panButtonScrollPercentage), onDidChangePanningInterface(onDidChangePanningInterface) {}
85
+ explicit MapTemplateConfig(std::string id, std::optional<std::function<void(std::optional<bool> /* animated */)>> onWillAppear, std::optional<std::function<void(std::optional<bool> /* animated */)>> onWillDisappear, std::optional<std::function<void(std::optional<bool> /* animated */)>> onDidAppear, std::optional<std::function<void(std::optional<bool> /* animated */)>> onDidDisappear, std::optional<std::function<void()>> onPopped, std::optional<double> autoDismissMs, std::optional<VisibleTravelEstimate> visibleTravelEstimate, std::optional<std::function<void(const Point& /* translation */, const std::optional<Point>& /* velocity */)>> onDidPan, std::optional<std::function<void(const Point& /* center */, double /* scale */)>> onDidUpdateZoomGestureWithCenter, std::optional<std::function<void(const Point& /* center */)>> onClick, std::optional<std::function<void(const Point& /* center */)>> onDoubleClick, std::optional<std::function<void(ColorScheme /* colorScheme */)>> onAppearanceDidChange, std::function<void()> onStopNavigation, std::optional<std::function<void()>> onAutoDriveEnabled, std::optional<std::vector<NitroMapButton>> mapButtons, std::optional<std::vector<NitroAction>> headerActions, std::optional<NitroColor> defaultGuidanceBackgroundColor, std::optional<double> panButtonScrollPercentage, std::optional<std::function<void(bool /* isPanningInterfaceVisible */)>> onDidChangePanningInterface): id(id), onWillAppear(onWillAppear), onWillDisappear(onWillDisappear), onDidAppear(onDidAppear), onDidDisappear(onDidDisappear), onPopped(onPopped), autoDismissMs(autoDismissMs), visibleTravelEstimate(visibleTravelEstimate), onDidPan(onDidPan), onDidUpdateZoomGestureWithCenter(onDidUpdateZoomGestureWithCenter), onClick(onClick), onDoubleClick(onDoubleClick), onAppearanceDidChange(onAppearanceDidChange), onStopNavigation(onStopNavigation), onAutoDriveEnabled(onAutoDriveEnabled), mapButtons(mapButtons), headerActions(headerActions), defaultGuidanceBackgroundColor(defaultGuidanceBackgroundColor), panButtonScrollPercentage(panButtonScrollPercentage), onDidChangePanningInterface(onDidChangePanningInterface) {}
82
86
 
83
87
  public:
84
88
  // MapTemplateConfig is not equatable because these properties are not equatable: onWillAppear, onWillDisappear, onDidAppear, onDidDisappear, onPopped, onDidPan, onDidUpdateZoomGestureWithCenter, onClick, onDoubleClick, onAppearanceDidChange, onStopNavigation, onAutoDriveEnabled, mapButtons, headerActions, onDidChangePanningInterface
@@ -111,6 +115,7 @@ namespace margelo::nitro {
111
115
  JSIConverter<std::optional<std::function<void()>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "onAutoDriveEnabled"))),
112
116
  JSIConverter<std::optional<std::vector<margelo::nitro::swe::iternio::reactnativeautoplay::NitroMapButton>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mapButtons"))),
113
117
  JSIConverter<std::optional<std::vector<margelo::nitro::swe::iternio::reactnativeautoplay::NitroAction>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "headerActions"))),
118
+ JSIConverter<std::optional<margelo::nitro::swe::iternio::reactnativeautoplay::NitroColor>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "defaultGuidanceBackgroundColor"))),
114
119
  JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "panButtonScrollPercentage"))),
115
120
  JSIConverter<std::optional<std::function<void(bool)>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "onDidChangePanningInterface")))
116
121
  );
@@ -134,6 +139,7 @@ namespace margelo::nitro {
134
139
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "onAutoDriveEnabled"), JSIConverter<std::optional<std::function<void()>>>::toJSI(runtime, arg.onAutoDriveEnabled));
135
140
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "mapButtons"), JSIConverter<std::optional<std::vector<margelo::nitro::swe::iternio::reactnativeautoplay::NitroMapButton>>>::toJSI(runtime, arg.mapButtons));
136
141
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "headerActions"), JSIConverter<std::optional<std::vector<margelo::nitro::swe::iternio::reactnativeautoplay::NitroAction>>>::toJSI(runtime, arg.headerActions));
142
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "defaultGuidanceBackgroundColor"), JSIConverter<std::optional<margelo::nitro::swe::iternio::reactnativeautoplay::NitroColor>>::toJSI(runtime, arg.defaultGuidanceBackgroundColor));
137
143
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "panButtonScrollPercentage"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.panButtonScrollPercentage));
138
144
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "onDidChangePanningInterface"), JSIConverter<std::optional<std::function<void(bool)>>>::toJSI(runtime, arg.onDidChangePanningInterface));
139
145
  return obj;
@@ -163,6 +169,7 @@ namespace margelo::nitro {
163
169
  if (!JSIConverter<std::optional<std::function<void()>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "onAutoDriveEnabled")))) return false;
164
170
  if (!JSIConverter<std::optional<std::vector<margelo::nitro::swe::iternio::reactnativeautoplay::NitroMapButton>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mapButtons")))) return false;
165
171
  if (!JSIConverter<std::optional<std::vector<margelo::nitro::swe::iternio::reactnativeautoplay::NitroAction>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "headerActions")))) return false;
172
+ if (!JSIConverter<std::optional<margelo::nitro::swe::iternio::reactnativeautoplay::NitroColor>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "defaultGuidanceBackgroundColor")))) return false;
166
173
  if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "panButtonScrollPercentage")))) return false;
167
174
  if (!JSIConverter<std::optional<std::function<void(bool)>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "onDidChangePanningInterface")))) return false;
168
175
  return true;
@@ -28,9 +28,12 @@
28
28
  #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
29
29
  #endif
30
30
 
31
+ // Forward declaration of `NitroColor` to properly resolve imports.
32
+ namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct NitroColor; }
31
33
 
32
-
33
-
34
+ #include "NitroColor.hpp"
35
+ #include <string>
36
+ #include <optional>
34
37
 
35
38
  namespace margelo::nitro::swe::iternio::reactnativeautoplay {
36
39
 
@@ -40,10 +43,12 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
40
43
  struct NitroLoadingManeuver final {
41
44
  public:
42
45
  bool isLoading SWIFT_PRIVATE;
46
+ NitroColor cardBackgroundColor SWIFT_PRIVATE;
47
+ std::optional<std::string> text SWIFT_PRIVATE;
43
48
 
44
49
  public:
45
50
  NitroLoadingManeuver() = default;
46
- explicit NitroLoadingManeuver(bool isLoading): isLoading(isLoading) {}
51
+ explicit NitroLoadingManeuver(bool isLoading, NitroColor cardBackgroundColor, std::optional<std::string> text): isLoading(isLoading), cardBackgroundColor(cardBackgroundColor), text(text) {}
47
52
 
48
53
  public:
49
54
  friend bool operator==(const NitroLoadingManeuver& lhs, const NitroLoadingManeuver& rhs) = default;
@@ -59,12 +64,16 @@ namespace margelo::nitro {
59
64
  static inline margelo::nitro::swe::iternio::reactnativeautoplay::NitroLoadingManeuver fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
60
65
  jsi::Object obj = arg.asObject(runtime);
61
66
  return margelo::nitro::swe::iternio::reactnativeautoplay::NitroLoadingManeuver(
62
- JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isLoading")))
67
+ JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isLoading"))),
68
+ JSIConverter<margelo::nitro::swe::iternio::reactnativeautoplay::NitroColor>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cardBackgroundColor"))),
69
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "text")))
63
70
  );
64
71
  }
65
72
  static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::swe::iternio::reactnativeautoplay::NitroLoadingManeuver& arg) {
66
73
  jsi::Object obj(runtime);
67
74
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "isLoading"), JSIConverter<bool>::toJSI(runtime, arg.isLoading));
75
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "cardBackgroundColor"), JSIConverter<margelo::nitro::swe::iternio::reactnativeautoplay::NitroColor>::toJSI(runtime, arg.cardBackgroundColor));
76
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "text"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.text));
68
77
  return obj;
69
78
  }
70
79
  static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
@@ -76,6 +85,8 @@ namespace margelo::nitro {
76
85
  return false;
77
86
  }
78
87
  if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isLoading")))) return false;
88
+ if (!JSIConverter<margelo::nitro::swe::iternio::reactnativeautoplay::NitroColor>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cardBackgroundColor")))) return false;
89
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "text")))) return false;
79
90
  return true;
80
91
  }
81
92
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iternio/react-native-auto-play",
3
- "version": "0.3.10",
3
+ "version": "0.3.11",
4
4
  "description": "Android Auto and Apple CarPlay for react-native",
5
5
  "main": "lib/index",
6
6
  "module": "lib/index",
@@ -18,6 +18,7 @@ import type {
18
18
  } from '../types/Trip';
19
19
  import { type NitroAction, NitroActionUtil } from '../utils/NitroAction';
20
20
  import { type NavigationAlert, NitroAlertUtil } from '../utils/NitroAlert';
21
+ import { type NitroColor, NitroColorUtil, type ThemedColor } from '../utils/NitroColor';
21
22
  import { NitroManeuverUtil, type NitroRoutingManeuver } from '../utils/NitroManeuver';
22
23
  import { NitroMapButton } from '../utils/NitroMapButton';
23
24
  import {
@@ -80,6 +81,8 @@ export interface NitroMapTemplateConfig extends TemplateConfig, NitroBaseMapTemp
80
81
  mapButtons?: Array<NitroMapButton>;
81
82
  headerActions?: Array<NitroAction>;
82
83
 
84
+ defaultGuidanceBackgroundColor?: NitroColor;
85
+
83
86
  /**
84
87
  * specify the percentage of screen height/width the pan button should scroll
85
88
  * @namespace iOS
@@ -131,7 +134,11 @@ export type BaseMapTemplateConfig<T> = {
131
134
 
132
135
  export type MapTemplateConfig = Omit<
133
136
  NitroMapTemplateConfig,
134
- 'mapButtons' | 'headerActions' | 'onStopNavigation' | 'onAutoDriveEnabled'
137
+ | 'mapButtons'
138
+ | 'headerActions'
139
+ | 'onStopNavigation'
140
+ | 'onAutoDriveEnabled'
141
+ | 'defaultGuidanceBackgroundColor'
135
142
  > &
136
143
  BaseMapTemplateConfig<MapTemplate> & {
137
144
  /**
@@ -150,6 +157,11 @@ export type MapTemplateConfig = Omit<
150
157
  * @namespace Android
151
158
  */
152
159
  onAutoDriveEnabled?: (template: MapTemplate) => void;
160
+
161
+ /**
162
+ * Initial navigation maneuver background color. Mainly useful, when in CarPlay the default loading maneuver does not have the right color.
163
+ */
164
+ defaultGuidanceBackgroundColor?: ThemedColor | string;
153
165
  };
154
166
 
155
167
  export interface TripSelectorCallback {
@@ -169,6 +181,7 @@ export class MapTemplate extends Template<MapTemplateConfig, MapTemplateConfig['
169
181
  headerActions,
170
182
  onStopNavigation,
171
183
  onAutoDriveEnabled,
184
+ defaultGuidanceBackgroundColor,
172
185
  ...baseConfig
173
186
  } = config;
174
187
 
@@ -197,6 +210,10 @@ export class MapTemplate extends Template<MapTemplateConfig, MapTemplateConfig['
197
210
  mapButtons: NitroMapButton.convert(this.template, mapButtons),
198
211
  onStopNavigation: () => onStopNavigation(this.template),
199
212
  onAutoDriveEnabled: onAutoDriveEnabled ? () => onAutoDriveEnabled(this.template) : undefined,
213
+ defaultGuidanceBackgroundColor:
214
+ defaultGuidanceBackgroundColor != null
215
+ ? NitroColorUtil.convert(defaultGuidanceBackgroundColor)
216
+ : undefined,
200
217
  };
201
218
 
202
219
  HybridMapTemplate.createMapTemplate(nitroConfig);
@@ -327,7 +344,11 @@ export class MapTemplate extends Template<MapTemplateConfig, MapTemplateConfig['
327
344
  }
328
345
 
329
346
  if (maneuvers.type === 'loading') {
330
- HybridMapTemplate.updateManeuvers(this.id, { isLoading: true });
347
+ HybridMapTemplate.updateManeuvers(this.id, {
348
+ isLoading: true,
349
+ cardBackgroundColor: NitroColorUtil.convert(maneuvers.cardBackgroundColor),
350
+ text: maneuvers.text != null ? maneuvers.text : undefined,
351
+ });
331
352
  return;
332
353
  }
333
354
 
@@ -252,6 +252,12 @@ export type MessageManeuver = {
252
252
 
253
253
  export type LoadingManeuver = {
254
254
  type: 'loading';
255
+ cardBackgroundColor: ThemedColor | string;
256
+ /**
257
+ * @namespace iOS CarPlay — shows text on the loading maneuver card
258
+ * @namespace Android Auto — not supported
259
+ */
260
+ text?: string;
255
261
  };
256
262
 
257
263
  export type AutoManeuver =
@@ -54,6 +54,8 @@ export interface NitroMessageManeuver {
54
54
 
55
55
  interface NitroLoadingManeuver {
56
56
  isLoading: true;
57
+ cardBackgroundColor: NitroColor;
58
+ text?: string;
57
59
  }
58
60
 
59
61
  export type NitroManeuver =