@iternio/react-native-auto-play 0.1.4 → 0.1.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.
|
@@ -41,6 +41,7 @@ class MapTemplate: NSObject, AutoPlayTemplate, AutoPlayHeaderProviding,
|
|
|
41
41
|
var onTripStarted: ((_ tripId: String, _ routeId: String) -> Void)?
|
|
42
42
|
var navigationSession: CPNavigationSession?
|
|
43
43
|
var navigationAlert: NavigationAlertWrapper?
|
|
44
|
+
var currentTripId: String?
|
|
44
45
|
|
|
45
46
|
var tripSelectorVisible = false
|
|
46
47
|
|
|
@@ -463,7 +464,7 @@ class MapTemplate: NSObject, AutoPlayTemplate, AutoPlayHeaderProviding,
|
|
|
463
464
|
let selectedTrip = selectedTripId.flatMap { tripId in
|
|
464
465
|
tripPreviews.first(where: { $0.id == tripId })
|
|
465
466
|
}
|
|
466
|
-
|
|
467
|
+
|
|
467
468
|
template.showTripPreviews(
|
|
468
469
|
tripPreviews,
|
|
469
470
|
selectedTrip: selectedTrip,
|
|
@@ -494,6 +495,7 @@ class MapTemplate: NSObject, AutoPlayTemplate, AutoPlayHeaderProviding,
|
|
|
494
495
|
}
|
|
495
496
|
|
|
496
497
|
func hideTripSelector() {
|
|
498
|
+
currentTripId = nil;
|
|
497
499
|
template.hideTripPreviews()
|
|
498
500
|
|
|
499
501
|
tripSelectorVisible = false
|
|
@@ -509,6 +511,13 @@ class MapTemplate: NSObject, AutoPlayTemplate, AutoPlayHeaderProviding,
|
|
|
509
511
|
using routeChoice: CPRouteChoice
|
|
510
512
|
) {
|
|
511
513
|
let tripId = trip.id
|
|
514
|
+
|
|
515
|
+
if (currentTripId != nil && currentTripId == tripId) {
|
|
516
|
+
return
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
currentTripId = trip.id
|
|
520
|
+
|
|
512
521
|
let routeId = routeChoice.id
|
|
513
522
|
self.onTripSelected?(tripId, routeId)
|
|
514
523
|
|
|
@@ -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
|
-
}
|