@iternio/react-native-auto-play 0.0.2 → 0.0.3

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.
Files changed (72) hide show
  1. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/AndroidAutoSession.kt +2 -0
  2. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/{hybrid/HybridAutoPlay.kt → HybridAutoPlay.kt} +20 -20
  3. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/{hybrid/HybridSearchTemplate.kt → HybridSearchTemplate.kt} +3 -3
  4. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/VirtualRenderer.kt +1 -1
  5. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/template/GridTemplate.kt +1 -16
  6. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/template/InformationTemplate.kt +1 -14
  7. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/template/ListTemplate.kt +1 -16
  8. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/template/MapTemplate.kt +5 -1
  9. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/template/MessageTemplate.kt +1 -16
  10. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/template/Parser.kt +58 -17
  11. package/ios/Types.swift +1 -0
  12. package/ios/hybrid/HybridAutoPlay.swift +5 -4
  13. package/ios/hybrid/HybridGridTemplate.swift +3 -6
  14. package/ios/hybrid/HybridInformationTemplate.swift +9 -9
  15. package/ios/hybrid/HybridListTemplate.swift +3 -6
  16. package/ios/hybrid/HybridMapTemplate.swift +21 -16
  17. package/ios/hybrid/HybridSearchTemplate.swift +7 -11
  18. package/ios/templates/AutoPlayTemplate.swift +31 -48
  19. package/ios/templates/GridTemplate.swift +31 -22
  20. package/ios/templates/InformationTemplate.swift +29 -21
  21. package/ios/templates/ListTemplate.swift +29 -20
  22. package/ios/templates/MapTemplate.swift +162 -61
  23. package/ios/templates/MessageTemplate.swift +19 -12
  24. package/ios/templates/SearchTemplate.swift +17 -25
  25. package/ios/templates/TemplateStore.swift +3 -3
  26. package/ios/utils/RootModule.swift +36 -38
  27. package/lib/templates/MapTemplate.d.ts +14 -3
  28. package/lib/templates/Template.d.ts +1 -0
  29. package/lib/types/Button.d.ts +5 -4
  30. package/lib/types/Maneuver.d.ts +3 -1
  31. package/lib/utils/NitroMapButton.d.ts +2 -2
  32. package/lib/utils/NitroMapButton.js +4 -9
  33. package/nitrogen/generated/android/ReactNativeAutoPlayOnLoad.cpp +2 -0
  34. package/nitrogen/generated/android/c++/JFunc_void_bool.hpp +74 -0
  35. package/nitrogen/generated/android/c++/JGridTemplateConfig.hpp +1 -0
  36. package/nitrogen/generated/android/c++/JHybridGridTemplateSpec.cpp +1 -0
  37. package/nitrogen/generated/android/c++/JHybridInformationTemplateSpec.cpp +2 -0
  38. package/nitrogen/generated/android/c++/JHybridListTemplateSpec.cpp +2 -0
  39. package/nitrogen/generated/android/c++/JHybridMapTemplateSpec.cpp +3 -2
  40. package/nitrogen/generated/android/c++/JHybridMessageTemplateSpec.cpp +2 -0
  41. package/nitrogen/generated/android/c++/JInformationTemplateConfig.hpp +2 -0
  42. package/nitrogen/generated/android/c++/JListTemplateConfig.hpp +2 -0
  43. package/nitrogen/generated/android/c++/JMapTemplateConfig.hpp +31 -11
  44. package/nitrogen/generated/android/c++/JMessageTemplateConfig.hpp +2 -0
  45. package/nitrogen/generated/android/c++/JNitroBaseMapTemplateConfig.hpp +17 -1
  46. package/nitrogen/generated/android/c++/JNitroMapButton.hpp +9 -9
  47. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_bool.kt +80 -0
  48. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/MapTemplateConfig.kt +12 -6
  49. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroBaseMapTemplateConfig.kt +7 -4
  50. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroMapButton.kt +5 -5
  51. package/nitrogen/generated/ios/ReactNativeAutoPlay-Swift-Cxx-Bridge.cpp +8 -0
  52. package/nitrogen/generated/ios/ReactNativeAutoPlay-Swift-Cxx-Bridge.hpp +37 -0
  53. package/nitrogen/generated/ios/swift/Func_void_bool.swift +47 -0
  54. package/nitrogen/generated/ios/swift/MapTemplateConfig.swift +70 -6
  55. package/nitrogen/generated/ios/swift/NitroBaseMapTemplateConfig.swift +42 -1
  56. package/nitrogen/generated/ios/swift/NitroMapButton.swift +54 -54
  57. package/nitrogen/generated/shared/c++/MapTemplateConfig.hpp +14 -6
  58. package/nitrogen/generated/shared/c++/NitroBaseMapTemplateConfig.hpp +5 -1
  59. package/nitrogen/generated/shared/c++/NitroMapButton.hpp +10 -10
  60. package/package.json +1 -1
  61. package/src/templates/MapTemplate.ts +32 -12
  62. package/src/templates/Template.ts +1 -0
  63. package/src/types/Button.ts +5 -4
  64. package/src/types/Maneuver.ts +1 -1
  65. package/src/utils/NitroMapButton.ts +6 -14
  66. /package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/{hybrid/HybridAndroidAutoTelemetry.kt → HybridAndroidAutoTelemetry.kt} +0 -0
  67. /package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/{hybrid/HybridCluster.kt → HybridCluster.kt} +0 -0
  68. /package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/{hybrid/HybridGridTemplate.kt → HybridGridTemplate.kt} +0 -0
  69. /package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/{hybrid/HybridInformationTemplate.kt → HybridInformationTemplate.kt} +0 -0
  70. /package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/{hybrid/HybridListTemplate.kt → HybridListTemplate.kt} +0 -0
  71. /package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/{hybrid/HybridMapTemplate.kt → HybridMapTemplate.kt} +0 -0
  72. /package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/{hybrid/HybridMessageTemplate.kt → HybridMessageTemplate.kt} +0 -0
@@ -56,6 +56,8 @@ class AndroidAutoSession(sessionInfo: SessionInfo, private val reactApplication:
56
56
  null,
57
57
  null,
58
58
  arrayOf(action),
59
+ null,
60
+ null
59
61
  )
60
62
 
61
63
  val template = MapTemplate(context = carContext, config, initNavigationManager = false)
@@ -14,7 +14,7 @@ class HybridAutoPlay : HybridAutoPlaySpec() {
14
14
  val callbacks = listeners.getOrPut(eventType) { mutableListOf() }
15
15
  callbacks.add(callback)
16
16
 
17
- if (eventType == EventName.DIDCONNECT && AndroidAutoSession.Companion.getIsConnected()) {
17
+ if (eventType == EventName.DIDCONNECT && AndroidAutoSession.getIsConnected()) {
18
18
  callback()
19
19
  }
20
20
 
@@ -38,7 +38,7 @@ class HybridAutoPlay : HybridAutoPlaySpec() {
38
38
  if (moduleName == "main") {
39
39
  callback(ActivityRenderStateProvider.currentState)
40
40
  } else {
41
- AndroidAutoSession.Companion.getState(moduleName)?.let {
41
+ AndroidAutoSession.getState(moduleName)?.let {
42
42
  callback(it)
43
43
  }
44
44
  }
@@ -75,26 +75,26 @@ class HybridAutoPlay : HybridAutoPlaySpec() {
75
75
  templateId: String, headerActions: Array<NitroAction>?
76
76
  ) {
77
77
  val template =
78
- AndroidAutoTemplate.Companion.getTemplate(templateId) ?: throw IllegalArgumentException(
78
+ AndroidAutoTemplate.getTemplate(templateId) ?: throw IllegalArgumentException(
79
79
  "setTemplateHeaderActions failed, template $templateId not found"
80
80
  )
81
81
  template.setTemplateHeaderActions(headerActions)
82
82
  }
83
83
 
84
84
  override fun setRootTemplate(templateId: String): Promise<Unit> {
85
- return Promise.Companion.async {
86
- val template = AndroidAutoTemplate.Companion.getTemplate(templateId)
85
+ return Promise.async {
86
+ val template = AndroidAutoTemplate.getTemplate(templateId)
87
87
  ?: throw IllegalArgumentException("setRootTemplate failed, $templateId template not found")
88
88
 
89
89
  if (template.isRenderTemplate) {
90
- val screen = AndroidAutoScreen.Companion.getScreen(templateId)
90
+ val screen = AndroidAutoScreen.getScreen(templateId)
91
91
  ?: throw IllegalArgumentException("setRootTemplate failed, $templateId screen not found")
92
- val carContext = AndroidAutoSession.Companion.getCarContext(templateId)
92
+ val carContext = AndroidAutoSession.getCarContext(templateId)
93
93
  ?: throw IllegalArgumentException("setRootTemplate failed, carContext for $templateId template not found")
94
94
 
95
95
  screen.applyConfigUpdate(invalidate = true)
96
96
 
97
- if (!VirtualRenderer.Companion.hasRenderer(templateId)) {
97
+ if (!VirtualRenderer.hasRenderer(templateId)) {
98
98
  val result = ThreadUtil.postOnUiAndAwait {
99
99
  VirtualRenderer(carContext, templateId)
100
100
  }
@@ -104,10 +104,10 @@ class HybridAutoPlay : HybridAutoPlaySpec() {
104
104
  }
105
105
  }
106
106
  } else {
107
- val screenManager = AndroidAutoScreen.Companion.getScreenManager()
107
+ val screenManager = AndroidAutoScreen.getScreenManager()
108
108
  ?: throw IllegalArgumentException("setRootTemplate failed, screenManager not found")
109
109
  val carContext =
110
- AndroidAutoSession.Companion.getCarContext(AndroidAutoSession.Companion.ROOT_SESSION)
110
+ AndroidAutoSession.getCarContext(AndroidAutoSession.ROOT_SESSION)
111
111
  ?: throw IllegalArgumentException("setRootTemplate failed, carContext for $templateId template not found")
112
112
 
113
113
  val result = ThreadUtil.postOnUiAndAwait {
@@ -129,12 +129,12 @@ class HybridAutoPlay : HybridAutoPlaySpec() {
129
129
  }
130
130
 
131
131
  override fun pushTemplate(templateId: String): Promise<Unit> {
132
- return Promise.Companion.async {
133
- val context = AndroidAutoSession.Companion.getRootContext()
132
+ return Promise.async {
133
+ val context = AndroidAutoSession.getRootContext()
134
134
  ?: throw IllegalArgumentException("pushTemplate failed, carContext not found")
135
- val template = AndroidAutoTemplate.Companion.getTemplate(templateId)
135
+ val template = AndroidAutoTemplate.getTemplate(templateId)
136
136
  ?: throw IllegalArgumentException("pushTemplate failed, template $templateId not found")
137
- val screenManager = AndroidAutoScreen.Companion.getScreenManager()
137
+ val screenManager = AndroidAutoScreen.getScreenManager()
138
138
  ?: throw IllegalArgumentException("pushTemplate failed, screenManager not found")
139
139
 
140
140
  val result = ThreadUtil.postOnUiAndAwait {
@@ -176,8 +176,8 @@ class HybridAutoPlay : HybridAutoPlaySpec() {
176
176
  }
177
177
 
178
178
  override fun popTemplate(animate: Boolean?): Promise<Unit> {
179
- return Promise.Companion.async {
180
- val screenManager = AndroidAutoScreen.Companion.getScreenManager()
179
+ return Promise.async {
180
+ val screenManager = AndroidAutoScreen.getScreenManager()
181
181
  ?: throw IllegalArgumentException("popTemplate failed, screenManager not found")
182
182
  if (screenManager.stackSize == 0) {
183
183
  return@async
@@ -194,8 +194,8 @@ class HybridAutoPlay : HybridAutoPlaySpec() {
194
194
  }
195
195
 
196
196
  override fun popToRootTemplate(animate: Boolean?): Promise<Unit> {
197
- return Promise.Companion.async {
198
- val screenManager = AndroidAutoScreen.Companion.getScreenManager()
197
+ return Promise.async {
198
+ val screenManager = AndroidAutoScreen.getScreenManager()
199
199
  ?: throw IllegalArgumentException("popToRootTemplate failed, screenManager not found")
200
200
  if (screenManager.stackSize == 0) {
201
201
  return@async
@@ -212,8 +212,8 @@ class HybridAutoPlay : HybridAutoPlaySpec() {
212
212
  }
213
213
 
214
214
  override fun popToTemplate(templateId: String, animate: Boolean?): Promise<Unit> {
215
- return Promise.Companion.async {
216
- val screenManager = AndroidAutoScreen.Companion.getScreenManager()
215
+ return Promise.async {
216
+ val screenManager = AndroidAutoScreen.getScreenManager()
217
217
  ?: throw IllegalArgumentException("popToTemplate failed, screenManager not found")
218
218
  if (screenManager.stackSize == 0) {
219
219
  return@async
@@ -6,15 +6,15 @@ import com.margelo.nitro.swe.iternio.reactnativeautoplay.template.SearchTemplate
6
6
  class HybridSearchTemplate : HybridSearchTemplateSpec() {
7
7
 
8
8
  override fun createSearchTemplate(config: SearchTemplateConfig) {
9
- val context = AndroidAutoSession.Companion.getRootContext()
9
+ val context = AndroidAutoSession.getRootContext()
10
10
  ?: throw IllegalArgumentException("createSearchTemplate failed, carContext not found")
11
11
 
12
12
  val template = SearchTemplate(context, config)
13
- AndroidAutoTemplate.Companion.setTemplate(config.id, template)
13
+ AndroidAutoTemplate.setTemplate(config.id, template)
14
14
  }
15
15
 
16
16
  override fun updateSearchResults(templateId: String, results: NitroSection) {
17
- val template = AndroidAutoTemplate.Companion.getTemplate<SearchTemplate>(templateId)
17
+ val template = AndroidAutoTemplate.getTemplate<SearchTemplate>(templateId)
18
18
  template.updateSearchResults(results)
19
19
  }
20
20
  }
@@ -98,7 +98,7 @@ class VirtualRenderer(
98
98
  }
99
99
 
100
100
  override fun onScroll(distanceX: Float, distanceY: Float) {
101
- getMapTemplateConfig()?.onDidUpdatePanGestureWithTranslation?.let {
101
+ getMapTemplateConfig()?.onDidPan?.let {
102
102
  it(
103
103
  Point((-distanceX / scale).toDouble(), (-distanceY / scale).toDouble()),
104
104
  null
@@ -41,22 +41,7 @@ class GridTemplate(context: CarContext, config: GridTemplateConfig) :
41
41
  }.build())
42
42
  }.build()
43
43
 
44
- return this.config.mapConfig?.let {
45
- MapWithContentTemplate.Builder().apply {
46
- setContentTemplate(template)
47
- it.mapButtons?.let { mapButtons ->
48
- setMapController(
49
- MapController.Builder()
50
- .setMapActionStrip(Parser.parseMapActions(context, mapButtons)).build()
51
- )
52
- }
53
- it.headerActions?.let { headerActions ->
54
- setActionStrip(Parser.parseMapHeaderActions(context, headerActions))
55
- }
56
- }.build()
57
- } ?: run {
58
- template
59
- }
44
+ return Parser.parseMapWithContentConfig(context, config.mapConfig, template)
60
45
  }
61
46
 
62
47
  override fun setTemplateHeaderActions(headerActions: Array<NitroAction>?) {
@@ -49,20 +49,7 @@ class InformationTemplate(context: CarContext, config: InformationTemplateConfig
49
49
  setHeader(Parser.parseHeader(context, config.title, config.headerActions))
50
50
  }.build()
51
51
 
52
- return this.config.mapConfig?.let {
53
- MapWithContentTemplate.Builder().apply {
54
- setContentTemplate(template)
55
- it.mapButtons?.let { mapButtons ->
56
- setMapController(
57
- MapController.Builder()
58
- .setMapActionStrip(Parser.parseMapActions(context, mapButtons)).build()
59
- )
60
- }
61
- it.headerActions?.let { headerActions ->
62
- setActionStrip(Parser.parseMapHeaderActions(context, headerActions))
63
- }
64
- }.build()
65
- } ?: template
52
+ return Parser.parseMapWithContentConfig(context, config.mapConfig, template)
66
53
  }
67
54
 
68
55
  override fun setTemplateHeaderActions(headerActions: Array<NitroAction>?) {
@@ -4,8 +4,6 @@ import androidx.car.app.CarContext
4
4
  import androidx.car.app.model.ListTemplate
5
5
  import androidx.car.app.model.SectionedItemList
6
6
  import androidx.car.app.model.Template
7
- import androidx.car.app.navigation.model.MapController
8
- import androidx.car.app.navigation.model.MapWithContentTemplate
9
7
  import com.margelo.nitro.swe.iternio.reactnativeautoplay.ListTemplateConfig
10
8
  import com.margelo.nitro.swe.iternio.reactnativeautoplay.NitroAction
11
9
  import com.margelo.nitro.swe.iternio.reactnativeautoplay.NitroSection
@@ -48,20 +46,7 @@ class ListTemplate(context: CarContext, config: ListTemplateConfig) :
48
46
  }
49
47
  }.build()
50
48
 
51
- return this.config.mapConfig?.let {
52
- MapWithContentTemplate.Builder().apply {
53
- setContentTemplate(template)
54
- it.mapButtons?.let { mapButtons ->
55
- setMapController(
56
- MapController.Builder()
57
- .setMapActionStrip(Parser.parseMapActions(context, mapButtons)).build()
58
- )
59
- }
60
- it.headerActions?.let { headerActions ->
61
- setActionStrip(Parser.parseMapHeaderActions(context, headerActions))
62
- }
63
- }.build()
64
- } ?: template
49
+ return Parser.parseMapWithContentConfig(context, config.mapConfig, template)
65
50
  }
66
51
 
67
52
  override fun setTemplateHeaderActions(headerActions: Array<NitroAction>?) {
@@ -43,7 +43,6 @@ class MapTemplate(
43
43
  private var alertPriority = 0
44
44
  private var alertIds: HashSet<Int> = HashSet()
45
45
 
46
-
47
46
  init {
48
47
  if (initNavigationManager) {
49
48
  val navigationManagerCallback = object : NavigationManagerCallback {
@@ -91,6 +90,11 @@ class MapTemplate(
91
90
  }.build())
92
91
  }
93
92
  }
93
+ config.onDidChangePanningInterface?.let {
94
+ setPanModeListener { isInPanMode ->
95
+ it(isInPanMode)
96
+ }
97
+ }
94
98
  }.build()
95
99
  }
96
100
 
@@ -33,22 +33,7 @@ class MessageTemplate(context: CarContext, config: MessageTemplateConfig) :
33
33
  }
34
34
  }.build()
35
35
 
36
- return this.config.mapConfig?.let {
37
- MapWithContentTemplate.Builder().apply {
38
- setContentTemplate(template)
39
- it.mapButtons?.let { mapButtons ->
40
- setMapController(
41
- MapController.Builder()
42
- .setMapActionStrip(Parser.parseMapActions(context, mapButtons)).build()
43
- )
44
- }
45
- it.headerActions?.let { headerActions ->
46
- setActionStrip(Parser.parseMapHeaderActions(context, headerActions))
47
- }
48
- }.build()
49
- } ?: run {
50
- template
51
- }
36
+ return Parser.parseMapWithContentConfig(context, config.mapConfig, template)
52
37
  }
53
38
 
54
39
  override fun onDidAppear() {
@@ -23,10 +23,13 @@ import androidx.car.app.model.DurationSpan
23
23
  import androidx.car.app.model.Header
24
24
  import androidx.car.app.model.ItemList
25
25
  import androidx.car.app.model.Row
26
+ import androidx.car.app.model.Template
26
27
  import androidx.car.app.model.Toggle
27
28
  import androidx.car.app.navigation.model.Lane
28
29
  import androidx.car.app.navigation.model.LaneDirection
29
30
  import androidx.car.app.navigation.model.Maneuver
31
+ import androidx.car.app.navigation.model.MapController
32
+ import androidx.car.app.navigation.model.MapWithContentTemplate
30
33
  import androidx.car.app.navigation.model.Step
31
34
  import androidx.car.app.navigation.model.TravelEstimate
32
35
  import androidx.core.graphics.createBitmap
@@ -53,6 +56,7 @@ import com.margelo.nitro.swe.iternio.reactnativeautoplay.NitroAction
53
56
  import com.margelo.nitro.swe.iternio.reactnativeautoplay.NitroActionType
54
57
  import com.margelo.nitro.swe.iternio.reactnativeautoplay.NitroAlignment
55
58
  import com.margelo.nitro.swe.iternio.reactnativeautoplay.NitroAttributedString
59
+ import com.margelo.nitro.swe.iternio.reactnativeautoplay.NitroBaseMapTemplateConfig
56
60
  import com.margelo.nitro.swe.iternio.reactnativeautoplay.NitroButtonStyle
57
61
  import com.margelo.nitro.swe.iternio.reactnativeautoplay.NitroColor
58
62
  import com.margelo.nitro.swe.iternio.reactnativeautoplay.NitroImage
@@ -116,12 +120,11 @@ object Parser {
116
120
  setTitle(it)
117
121
  }
118
122
  action.image?.let { image ->
119
- val icon = CarIcon.Builder(
123
+ setIcon(
120
124
  parseImage(
121
125
  context, image
122
126
  )
123
- ).build()
124
- setIcon(icon)
127
+ )
125
128
  }
126
129
  action.flags?.let {
127
130
  setFlags(it.toInt())
@@ -135,25 +138,36 @@ object Parser {
135
138
  }
136
139
 
137
140
  fun parseMapActions(context: CarContext, buttons: Array<NitroMapButton>): ActionStrip {
141
+ // make the pan button the first button so it can be access all the time
142
+ // when in pan mode AA locks onto this button
143
+ // once the buttons reappear after the hide timeout AA locks onto the first button
144
+ // in case the pan button is not the first button you can never get out of pan mode then
145
+ buttons.sortBy {
146
+ if (it.type == NitroMapButtonType.PAN) 0 else 1
147
+ }
138
148
  return ActionStrip.Builder().apply {
139
149
  buttons.forEach { button ->
140
150
  if (button.type == NitroMapButtonType.PAN) {
141
- addAction(Action.PAN)
151
+ addAction(
152
+ Action.Builder(Action.PAN).setIcon(
153
+ parseImage(
154
+ context, button.image
155
+ )
156
+ ).build()
157
+ )
142
158
  return@forEach
143
159
  }
144
160
 
145
- button.image?.let { image ->
146
- addAction(Action.Builder().apply {
147
- setOnClickListener(button.onPress)
148
- setIcon(
149
- CarIcon.Builder(
150
- parseImage(
151
- context, image
152
- )
153
- ).build()
161
+ addAction(Action.Builder().apply {
162
+ button.onPress?.let {
163
+ setOnClickListener(it)
164
+ }
165
+ setIcon(
166
+ parseImage(
167
+ context, button.image
154
168
  )
155
- }.build())
156
- }
169
+ )
170
+ }.build())
157
171
  }
158
172
  }.build()
159
173
  }
@@ -282,7 +296,7 @@ object Parser {
282
296
  addText(parseText(detailedText))
283
297
  }
284
298
  row.image?.let { image ->
285
- setImage(CarIcon.Builder(parseImage(context, image)).build())
299
+ setImage(parseImage(context, image))
286
300
  }
287
301
  row.onPress?.let {
288
302
  setOnClickListener {
@@ -335,7 +349,7 @@ object Parser {
335
349
  addText(parseText(detailedText))
336
350
  }
337
351
  row.image?.let { image ->
338
- setImage(CarIcon.Builder(parseImage(context, image)).build())
352
+ setImage(parseImage(context, image))
339
353
  }
340
354
  row.browsable?.let { browsable ->
341
355
  setBrowsable(browsable)
@@ -659,4 +673,31 @@ object Parser {
659
673
  else -> LaneDirection.SHAPE_UNKNOWN
660
674
  }
661
675
  }
676
+
677
+ fun parseMapWithContentConfig(
678
+ context: CarContext, mapConfig: NitroBaseMapTemplateConfig?, template: Template
679
+ ): Template {
680
+ if (mapConfig == null) {
681
+ return template
682
+ }
683
+
684
+ return MapWithContentTemplate.Builder().apply {
685
+ setContentTemplate(template)
686
+ mapConfig.mapButtons?.let { mapButtons ->
687
+ setMapController(
688
+ MapController.Builder().apply {
689
+ setMapActionStrip(Parser.parseMapActions(context, mapButtons)).build()
690
+ setPanModeListener { isInPanMode ->
691
+ mapConfig.onDidChangePanningInterface?.let {
692
+ it(isInPanMode)
693
+ }
694
+ }
695
+ }.build()
696
+ )
697
+ }
698
+ mapConfig.headerActions?.let { headerActions ->
699
+ setActionStrip(Parser.parseMapHeaderActions(context, headerActions))
700
+ }
701
+ }.build()
702
+ }
662
703
  }
package/ios/Types.swift CHANGED
@@ -17,4 +17,5 @@ enum AutoPlayError: Error {
17
17
  case invalidTemplateError(String)
18
18
  case propertyNotFoundError(String)
19
19
  case unsupportedVersion(String)
20
+ case invalidTemplateType(String)
20
21
  }
@@ -241,10 +241,11 @@ class HybridAutoPlay: HybridAutoPlaySpec {
241
241
  templateId: String,
242
242
  headerActions: [NitroAction]?
243
243
  ) throws {
244
- try RootModule.withTemplate(templateId: templateId) {
245
- template in
246
- template.barButtons = headerActions
247
- template.invalidate()
244
+ try RootModule.withAutoPlayTemplate(templateId: templateId) {
245
+ (template: AutoPlayTemplate) in
246
+ if var template = template as? AutoPlayHeaderProviding {
247
+ template.barButtons = headerActions
248
+ }
248
249
  }
249
250
  }
250
251
 
@@ -20,12 +20,9 @@ class HybridGridTemplate: HybridGridTemplateSpec {
20
20
  templateId: String,
21
21
  buttons: [NitroGridButton]
22
22
  ) throws {
23
- try RootModule.withScene { scene in
24
- if let template = scene.templateStore.getTemplate(
25
- templateId: templateId
26
- ) as? GridTemplate {
27
- template.updateButtons(buttons: buttons)
28
- }
23
+ try RootModule.withAutoPlayTemplate(templateId: templateId) {
24
+ (template: GridTemplate) in
25
+ template.updateButtons(buttons: buttons)
29
26
  }
30
27
  }
31
28
  }
@@ -5,7 +5,7 @@
5
5
  // Created by Samuel Brucksch on 05.11.25.
6
6
  //
7
7
 
8
- class HybridInformationTemplate : HybridInformationTemplateSpec {
8
+ class HybridInformationTemplate: HybridInformationTemplateSpec {
9
9
 
10
10
  func createInformationTemplate(config: InformationTemplateConfig) throws {
11
11
  let template = InformationTemplate(config: config)
@@ -16,14 +16,14 @@ class HybridInformationTemplate : HybridInformationTemplateSpec {
16
16
  )
17
17
  }
18
18
  }
19
-
20
- func updateInformationTemplateSections(templateId: String, section: NitroSection) throws {
21
- try RootModule.withScene { scene in
22
- if let template = scene.templateStore.getTemplate(
23
- templateId: templateId
24
- ) as? InformationTemplate {
25
- template.updateSection(section: section)
26
- }
19
+
20
+ func updateInformationTemplateSections(
21
+ templateId: String,
22
+ section: NitroSection
23
+ ) throws {
24
+ try RootModule.withAutoPlayTemplate(templateId: templateId) {
25
+ (template: InformationTemplate) in
26
+ template.updateSection(section: section)
27
27
  }
28
28
  }
29
29
  }
@@ -20,12 +20,9 @@ class HybridListTemplate: HybridListTemplateSpec {
20
20
  templateId: String,
21
21
  sections: [NitroSection]?
22
22
  ) throws {
23
- try RootModule.withScene { scene in
24
- if let template = scene.templateStore.getTemplate(
25
- templateId: templateId
26
- ) as? ListTemplate {
27
- template.updateSections(sections: sections)
28
- }
23
+ try RootModule.withAutoPlayTemplate(templateId: templateId) {
24
+ (template: ListTemplate) in
25
+ template.updateSections(sections: sections)
29
26
  }
30
27
  }
31
28
  }
@@ -5,6 +5,8 @@
5
5
  // Created by Manuel Auer on 15.10.25.
6
6
  //
7
7
 
8
+ import CarPlay
9
+
8
10
  class HybridMapTemplate: HybridMapTemplateSpec {
9
11
  func createMapTemplate(config: MapTemplateConfig) throws {
10
12
  let template = MapTemplate(config: config)
@@ -19,11 +21,8 @@ class HybridMapTemplate: HybridMapTemplateSpec {
19
21
  func setTemplateMapButtons(templateId: String, buttons: [NitroMapButton]?)
20
22
  throws
21
23
  {
22
- try RootModule.withTemplate(templateId: templateId) {
23
- template in
24
- guard let template = template as? MapTemplate else {
25
- return
26
- }
24
+ try RootModule.withAutoPlayTemplate(templateId: templateId) {
25
+ (template: MapTemplate) in
27
26
 
28
27
  template.config.mapButtons = buttons
29
28
  template.invalidate()
@@ -35,7 +34,8 @@ class HybridMapTemplate: HybridMapTemplateSpec {
35
34
  {
36
35
  var mapTemplate: MapTemplate?
37
36
 
38
- try RootModule.withMapTemplate(templateId: templateId) { template in
37
+ try RootModule.withAutoPlayTemplate(templateId: templateId) {
38
+ (template: MapTemplate) in
39
39
  template.showAlert(alertConfig: alert)
40
40
  mapTemplate = template
41
41
  }
@@ -66,8 +66,9 @@ class HybridMapTemplate: HybridMapTemplateSpec {
66
66
  ) throws -> TripSelectorCallback {
67
67
  var callback: TripSelectorCallback?
68
68
 
69
- try RootModule.withMapTemplate(templateId: templateId) { template in
70
- callback = try template.showTripSelector(
69
+ try RootModule.withAutoPlayTemplate(templateId: templateId) {
70
+ (template: MapTemplate) in
71
+ callback = template.showTripSelector(
71
72
  trips: trips,
72
73
  selectedTripId: selectedTripId,
73
74
  textConfig: textConfig,
@@ -86,7 +87,8 @@ class HybridMapTemplate: HybridMapTemplateSpec {
86
87
  }
87
88
 
88
89
  func hideTripSelector(templateId: String) throws {
89
- try RootModule.withMapTemplate(templateId: templateId) { template in
90
+ try RootModule.withAutoPlayTemplate(templateId: templateId) {
91
+ (template: MapTemplate) in
90
92
  template.hideTripSelector()
91
93
  }
92
94
  }
@@ -95,7 +97,8 @@ class HybridMapTemplate: HybridMapTemplateSpec {
95
97
  templateId: String,
96
98
  visibleTravelEstimate: VisibleTravelEstimate
97
99
  ) throws {
98
- try RootModule.withMapTemplate(templateId: templateId) { template in
100
+ try RootModule.withAutoPlayTemplate(templateId: templateId) {
101
+ (template: MapTemplate) in
99
102
  template.updateVisibleTravelEstimate(
100
103
  visibleTravelEstimate: visibleTravelEstimate
101
104
  )
@@ -103,14 +106,15 @@ class HybridMapTemplate: HybridMapTemplateSpec {
103
106
  }
104
107
 
105
108
  func updateTravelEstimates(templateId: String, steps: [TripPoint]) throws {
106
- try RootModule.withMapTemplate(templateId: templateId) { template in
109
+ try RootModule.withAutoPlayTemplate(templateId: templateId) {
110
+ (template: MapTemplate) in
107
111
  template.updateTravelEstimates(steps: steps)
108
112
  }
109
113
  }
110
114
 
111
115
  func updateManeuvers(templateId: String, maneuvers: NitroManeuver) throws {
112
- try RootModule.withMapTemplate(templateId: templateId) {
113
- template in
116
+ try RootModule.withAutoPlayTemplate(templateId: templateId) {
117
+ (template: MapTemplate) in
114
118
  switch maneuvers {
115
119
  case .first(let routingManeuvers):
116
120
  {
@@ -126,16 +130,17 @@ class HybridMapTemplate: HybridMapTemplateSpec {
126
130
  }
127
131
 
128
132
  func startNavigation(templateId: String, trip: TripConfig) throws {
129
- try RootModule.withMapTemplate(templateId: templateId) { template in
133
+ try RootModule.withAutoPlayTemplate(templateId: templateId) {
134
+ (template: MapTemplate) in
130
135
  let trip = Parser.parseTrip(tripConfig: trip)
131
136
  template.startNavigation(trip: trip)
132
137
  }
133
138
  }
134
139
 
135
140
  func stopNavigation(templateId: String) throws {
136
- try RootModule.withMapTemplate(templateId: templateId) { template in
141
+ try RootModule.withAutoPlayTemplate(templateId: templateId) {
142
+ (template: MapTemplate) in
137
143
  template.stopNavigation()
138
144
  }
139
145
  }
140
-
141
146
  }
@@ -1,4 +1,3 @@
1
-
2
1
  //
3
2
  // HybridSearchTemplate.swift
4
3
  // Pods
@@ -7,16 +6,6 @@
7
6
  //
8
7
 
9
8
  class HybridSearchTemplate: HybridSearchTemplateSpec {
10
- func updateSearchResults(templateId: String, results: NitroSection) throws {
11
- try RootModule.withScene { scene in
12
- if let template = scene.templateStore.getTemplate(
13
- templateId: templateId
14
- ) as? SearchTemplate {
15
- template.updateSearchResults(results: results)
16
- }
17
- }
18
- }
19
-
20
9
  func createSearchTemplate(config: SearchTemplateConfig) throws {
21
10
  let template = SearchTemplate(config: config)
22
11
  try RootModule.withScene { scene in
@@ -26,4 +15,11 @@ class HybridSearchTemplate: HybridSearchTemplateSpec {
26
15
  )
27
16
  }
28
17
  }
18
+
19
+ func updateSearchResults(templateId: String, results: NitroSection) throws {
20
+ try RootModule.withAutoPlayTemplate(templateId: templateId) {
21
+ (template: SearchTemplate) in
22
+ template.updateSearchResults(results: results)
23
+ }
24
+ }
29
25
  }