@iternio/react-native-auto-play 0.1.10 → 0.1.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.
- package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/VirtualRenderer.kt +1 -1
- package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/template/MapTemplate.kt +9 -2
- package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/template/TripPreviewTemplate.kt +7 -4
- package/ios/scenes/HeadUnitSceneDelegate.swift +12 -0
- package/lib/specs/VoiceInput.nitro.d.ts +8 -0
- package/lib/specs/VoiceInput.nitro.js +1 -0
- package/package.json +1 -1
- package/lib/hooks/useIsAutoPlayFocused.d.ts +0 -7
- package/lib/hooks/useIsAutoPlayFocused.js +0 -20
- package/lib/hybrid.d.ts +0 -2
- package/lib/hybrid.js +0 -2
package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/VirtualRenderer.kt
CHANGED
|
@@ -250,7 +250,7 @@ class VirtualRenderer(
|
|
|
250
250
|
private fun getMapTemplateConfig(): MapTemplateConfig? {
|
|
251
251
|
val screenManager = AndroidAutoScreen.getScreen(moduleName)?.screenManager ?: return null
|
|
252
252
|
val marker = screenManager.top.marker ?: return null
|
|
253
|
-
return AndroidAutoTemplate.
|
|
253
|
+
return AndroidAutoTemplate.getTypedConfig<MapTemplateConfig>(marker)
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
private fun initRenderer() {
|
|
@@ -380,7 +380,7 @@ class MapTemplate(
|
|
|
380
380
|
AndroidAutoScreen.invalidateSurfaceScreens()
|
|
381
381
|
|
|
382
382
|
UiThreadUtil.runOnUiThread {
|
|
383
|
-
|
|
383
|
+
val trip = Trip.Builder().apply {
|
|
384
384
|
addStep(
|
|
385
385
|
currentStep, Parser.parseTravelEstimates(current.travelEstimates)
|
|
386
386
|
)
|
|
@@ -390,7 +390,14 @@ class MapTemplate(
|
|
|
390
390
|
getTripDestinations().forEach {
|
|
391
391
|
addDestination(it.key, it.value)
|
|
392
392
|
}
|
|
393
|
-
}.build()
|
|
393
|
+
}.build()
|
|
394
|
+
try {
|
|
395
|
+
navigationManager.updateTrip(trip)
|
|
396
|
+
} catch(exception: IllegalStateException) {
|
|
397
|
+
// Sometimes we get a "java.lang.IllegalStateException: Navigation is not started" here, although the navigation
|
|
398
|
+
// is started already (we check for isNavigating at the top). So i guess this is a race condition, that we start navigation
|
|
399
|
+
// and the AA app is not ready yet. Unfortunately we can not ask the AA app for it's state, so we just catch the error.
|
|
400
|
+
}
|
|
394
401
|
}
|
|
395
402
|
}
|
|
396
403
|
}
|
|
@@ -63,10 +63,13 @@ class TripPreviewTemplate(
|
|
|
63
63
|
|
|
64
64
|
return MapWithContentTemplate.Builder().apply {
|
|
65
65
|
val pane = Pane.Builder().apply {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
selectedRoute.additionalInformationVariants.firstOrNull()
|
|
67
|
+
?.takeIf { it.isNotEmpty() }?.let {
|
|
68
|
+
addRow(Row.Builder().apply {
|
|
69
|
+
setTitle(Parser.parseText(selectedRoute.additionalInformationVariants))
|
|
70
|
+
addText(Parser.parseText(selectedRoute.selectionSummaryVariants))
|
|
71
|
+
}.build())
|
|
72
|
+
}
|
|
70
73
|
addRow(Row.Builder().apply {
|
|
71
74
|
setTitle(
|
|
72
75
|
"${textConfig.travelEstimatesTitle} ${
|
|
@@ -37,6 +37,18 @@ class HeadUnitSceneDelegate: AutoPlayScene, CPTemplateApplicationSceneDelegate {
|
|
|
37
37
|
HybridAutoPlay.emit(event: .didconnect)
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
func templateApplicationScene(
|
|
41
|
+
_ templateApplicationScene: CPTemplateApplicationScene,
|
|
42
|
+
didConnect interfaceController: CPInterfaceController
|
|
43
|
+
) {
|
|
44
|
+
self.interfaceController = AutoPlayInterfaceController(
|
|
45
|
+
interfaceController: interfaceController
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
connect(props: [:])
|
|
49
|
+
HybridAutoPlay.emit(event: .didconnect)
|
|
50
|
+
}
|
|
51
|
+
|
|
40
52
|
func templateApplicationScene(
|
|
41
53
|
_ templateApplicationScene: CPTemplateApplicationScene,
|
|
42
54
|
didDisconnectInterfaceController interfaceController:
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { HybridObject } from 'react-native-nitro-modules';
|
|
2
|
+
import type { CleanupCallback } from '../types/Event';
|
|
3
|
+
export interface VoiceInput extends HybridObject<{
|
|
4
|
+
android: 'kotlin';
|
|
5
|
+
ios: 'swift';
|
|
6
|
+
}> {
|
|
7
|
+
registerVoiceInputListener(callback: (voiceInputResult?: string, error?: string) => void): CleanupCallback;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A hook to determine if the CarPlay/Android Auto screen is currently focused (visible).
|
|
3
|
-
*
|
|
4
|
-
* @param moduleName The name of the module to listen to.
|
|
5
|
-
* @returns `true` if the screen is focused, `false` otherwise.
|
|
6
|
-
*/
|
|
7
|
-
export declare function useIsAutoPlayFocused(moduleName: string): boolean;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
2
|
-
import { HybridAutoPlay } from '..';
|
|
3
|
-
/**
|
|
4
|
-
* A hook to determine if the CarPlay/Android Auto screen is currently focused (visible).
|
|
5
|
-
*
|
|
6
|
-
* @param moduleName The name of the module to listen to.
|
|
7
|
-
* @returns `true` if the screen is focused, `false` otherwise.
|
|
8
|
-
*/
|
|
9
|
-
export function useIsAutoPlayFocused(moduleName) {
|
|
10
|
-
const [isFocused, setIsFocused] = useState(false);
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
const remove = HybridAutoPlay.addListenerRenderState(moduleName, (state) => {
|
|
13
|
-
setIsFocused(state === 'didAppear');
|
|
14
|
-
});
|
|
15
|
-
return () => {
|
|
16
|
-
remove();
|
|
17
|
-
};
|
|
18
|
-
}, [moduleName]);
|
|
19
|
-
return isFocused;
|
|
20
|
-
}
|
package/lib/hybrid.d.ts
DELETED
package/lib/hybrid.js
DELETED