@iternio/react-native-auto-play 0.0.12 → 0.1.1
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 +16 -5
- package/ios/ReactHelpers/NitroSurface.h +10 -0
- package/ios/ReactHelpers/NitroSurface.m +51 -0
- package/ios/Types.swift +2 -0
- package/ios/hybrid/HybridAutoPlay.swift +2 -2
- package/ios/hybrid/HybridCarPlayDashboard.swift +7 -3
- package/ios/hybrid/HybridCluster.swift +1 -1
- package/ios/scenes/AutoPlayScene.swift +30 -51
- package/lib/specs/CarPlayDashboard.nitro.d.ts +1 -1
- package/lib/specs/HybridAndroidAutoTelemetry.nitro.d.ts +15 -0
- package/lib/specs/HybridAutoPlay.nitro.d.ts +64 -0
- package/lib/specs/HybridAutoPlay.nitro.js +1 -0
- package/lib/specs/HybridCarPlayDashboard.nitro.d.ts +22 -0
- package/lib/specs/HybridCarPlayDashboard.nitro.js +1 -0
- package/lib/specs/HybridCluster.nitro.d.ts +19 -0
- package/lib/specs/HybridCluster.nitro.js +1 -0
- package/lib/specs/HybridGridTemplate.nitro.d.ts +14 -0
- package/lib/specs/HybridGridTemplate.nitro.js +1 -0
- package/lib/specs/HybridInformationTemplate.nitro.d.ts +13 -0
- package/lib/specs/HybridInformationTemplate.nitro.js +1 -0
- package/lib/specs/HybridListTemplate.nitro.d.ts +13 -0
- package/lib/specs/HybridListTemplate.nitro.js +1 -0
- package/lib/specs/HybridMapTemplate.nitro.d.ts +25 -0
- package/lib/specs/HybridMapTemplate.nitro.js +1 -0
- package/lib/specs/HybridMessageTemplate.nitro.d.ts +12 -0
- package/lib/specs/HybridMessageTemplate.nitro.js +1 -0
- package/lib/specs/HybridSearchTemplate.nitro.d.ts +13 -0
- package/lib/specs/HybridSearchTemplate.nitro.js +1 -0
- package/lib/types/GestureEvents.d.ts +37 -0
- package/lib/types/GestureEvents.js +1 -0
- package/nitrogen/generated/ios/ReactNativeAutoPlay-Swift-Cxx-Bridge.hpp +9 -9
- package/nitrogen/generated/ios/c++/HybridCarPlayDashboardSpecSwift.hpp +3 -1
- package/nitrogen/generated/ios/swift/HybridCarPlayDashboardSpec.swift +1 -1
- package/nitrogen/generated/ios/swift/HybridCarPlayDashboardSpec_cxx.swift +12 -4
- package/nitrogen/generated/shared/c++/HybridCarPlayDashboardSpec.hpp +1 -1
- package/package.json +1 -1
- package/src/specs/CarPlayDashboard.nitro.ts +1 -1
- package/ios/ReactHelpers/RCTRootView.h +0 -29
- package/lib/specs/VoiceInput.nitro.d.ts +0 -8
- /package/lib/specs/{VoiceInput.nitro.js → HybridAndroidAutoTelemetry.nitro.js} +0 -0
package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/VirtualRenderer.kt
CHANGED
|
@@ -43,6 +43,10 @@ class VirtualRenderer(
|
|
|
43
43
|
private val isCluster: Boolean = false
|
|
44
44
|
) {
|
|
45
45
|
private lateinit var uiManager: FabricUIManager
|
|
46
|
+
private fun isUiManagerInitialized(): Boolean {
|
|
47
|
+
return ::uiManager.isInitialized
|
|
48
|
+
}
|
|
49
|
+
|
|
46
50
|
private lateinit var display: Display
|
|
47
51
|
private lateinit var reactContext: ReactContext
|
|
48
52
|
|
|
@@ -51,6 +55,9 @@ class VirtualRenderer(
|
|
|
51
55
|
private var reactSurfaceId: Int? = null
|
|
52
56
|
|
|
53
57
|
private lateinit var reactRootView: ReactRootView
|
|
58
|
+
private fun isReactRootViewInitialized(): Boolean {
|
|
59
|
+
return ::reactRootView.isInitialized
|
|
60
|
+
}
|
|
54
61
|
|
|
55
62
|
private var height: Int = 0
|
|
56
63
|
private var width: Int = 0
|
|
@@ -270,7 +277,7 @@ class VirtualRenderer(
|
|
|
270
277
|
val reactNativeScale = virtualScreenDensity / mainScreenDensity * BuildConfig.SCALE_FACTOR
|
|
271
278
|
|
|
272
279
|
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
|
|
273
|
-
if (!
|
|
280
|
+
if (!isUiManagerInitialized()) {
|
|
274
281
|
// this makes sure we have all required instances
|
|
275
282
|
// no matter if the app is launched on the phone or AA first
|
|
276
283
|
return
|
|
@@ -299,7 +306,7 @@ class VirtualRenderer(
|
|
|
299
306
|
|
|
300
307
|
var splashScreenView: View? = null
|
|
301
308
|
|
|
302
|
-
if (!
|
|
309
|
+
if (!isReactRootViewInitialized()) {
|
|
303
310
|
splashScreenView =
|
|
304
311
|
if (isCluster) getClusterSplashScreen(context, height, width) else null
|
|
305
312
|
|
|
@@ -470,11 +477,15 @@ class VirtualRenderer(
|
|
|
470
477
|
val renderer = virtualRenderer[moduleId]
|
|
471
478
|
|
|
472
479
|
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
|
|
473
|
-
renderer?.
|
|
474
|
-
renderer.
|
|
480
|
+
if (renderer?.isUiManagerInitialized() == true) {
|
|
481
|
+
renderer.reactSurfaceId?.let {
|
|
482
|
+
renderer.uiManager.stopSurface(it)
|
|
483
|
+
}
|
|
475
484
|
}
|
|
476
485
|
} else {
|
|
477
|
-
renderer?.
|
|
486
|
+
if (renderer?.isReactRootViewInitialized() == true) {
|
|
487
|
+
renderer.reactRootView.unmountReactApplication()
|
|
488
|
+
}
|
|
478
489
|
}
|
|
479
490
|
|
|
480
491
|
virtualRenderer.remove(moduleId)
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
//
|
|
2
|
+
// NitroSurface.m
|
|
3
|
+
// Pods
|
|
4
|
+
//
|
|
5
|
+
// Created by Manuel Auer on 28.11.25.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import "NitroSurface.h"
|
|
9
|
+
#import <React/RCTInvalidating.h>
|
|
10
|
+
#import <React/RCTRootView.h>
|
|
11
|
+
#import <React/RCTSurface.h>
|
|
12
|
+
#import <React/RCTSurfaceHostingProxyRootView.h>
|
|
13
|
+
|
|
14
|
+
@implementation NitroSurface
|
|
15
|
+
|
|
16
|
+
+ (void)stop:(nullable UIView *)view {
|
|
17
|
+
if (view == nil) {
|
|
18
|
+
NSLog(@"[AutoPlay] View is nil, ignoring");
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if ([view isKindOfClass:[RCTSurfaceHostingProxyRootView class]]) {
|
|
23
|
+
RCTSurfaceHostingProxyRootView *rootView =
|
|
24
|
+
(RCTSurfaceHostingProxyRootView *)view;
|
|
25
|
+
RCTSurface *surface = rootView.surface;
|
|
26
|
+
|
|
27
|
+
if (surface == nil) {
|
|
28
|
+
NSLog(@"[AutoPlay] surface == nil, cannot stop");
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
[surface stop];
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if ([view isKindOfClass:[RCTRootView class]]) {
|
|
37
|
+
RCTRootView *rootView = (RCTRootView *)view;
|
|
38
|
+
UIView<RCTInvalidating> *contentView = (UIView<RCTInvalidating> *)rootView.contentView;
|
|
39
|
+
|
|
40
|
+
if ([contentView conformsToProtocol:@protocol(RCTInvalidating)]) {
|
|
41
|
+
[contentView invalidate];
|
|
42
|
+
} else {
|
|
43
|
+
NSLog(@"[AutoPlay] contentView does not conform to RCTInvalidating");
|
|
44
|
+
}
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
NSLog(@"[AutoPlay] View is not recognized type, ignoring");
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@end
|
package/ios/Types.swift
CHANGED
|
@@ -131,8 +131,8 @@ class HybridAutoPlay: HybridAutoPlaySpec {
|
|
|
131
131
|
let carPlayTemplate = template.getTemplate()
|
|
132
132
|
|
|
133
133
|
if carPlayTemplate is CPMapTemplate {
|
|
134
|
-
await MainActor.run {
|
|
135
|
-
scene.initRootView()
|
|
134
|
+
try await MainActor.run {
|
|
135
|
+
try scene.initRootView()
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
|
|
@@ -30,9 +30,13 @@ class HybridCarPlayDashboard: HybridCarPlayDashboardSpec {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
func initRootView() throws {
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
func initRootView() throws -> Promise<Void> {
|
|
34
|
+
return Promise.async {
|
|
35
|
+
guard let scene = try SceneStore.getDashboardScene() else { return }
|
|
36
|
+
try await MainActor.run {
|
|
37
|
+
try scene.initRootView()
|
|
38
|
+
}
|
|
39
|
+
}
|
|
36
40
|
}
|
|
37
41
|
|
|
38
42
|
func setButtons(buttons: [NitroCarPlayDashboardButton]) throws -> Promise<
|
|
@@ -7,13 +7,9 @@
|
|
|
7
7
|
|
|
8
8
|
import CarPlay
|
|
9
9
|
|
|
10
|
-
#if RCT_NEW_ARCH_ENABLED
|
|
11
|
-
import React
|
|
12
|
-
#endif
|
|
13
|
-
|
|
14
10
|
class AutoPlayScene: UIResponder {
|
|
15
11
|
var initialProperties: [String: Any] = [:]
|
|
16
|
-
|
|
12
|
+
let moduleName: String
|
|
17
13
|
var window: UIWindow?
|
|
18
14
|
var isConnected = false
|
|
19
15
|
var interfaceController: AutoPlayInterfaceController?
|
|
@@ -21,7 +17,11 @@ class AutoPlayScene: UIResponder {
|
|
|
21
17
|
var traitCollection = UIScreen.main.traitCollection
|
|
22
18
|
var safeAreaInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
|
|
23
19
|
|
|
24
|
-
override init() {
|
|
20
|
+
override init() {
|
|
21
|
+
fatalError(
|
|
22
|
+
"init() should never be called - use init(moduleName: String) instead"
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
25
|
|
|
26
26
|
init(moduleName: String) {
|
|
27
27
|
self.moduleName = moduleName
|
|
@@ -46,62 +46,41 @@ class AutoPlayScene: UIResponder {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
func disconnect() {
|
|
49
|
-
|
|
50
|
-
if let rootView = self.window?.rootViewController?.view
|
|
51
|
-
as? RCTSurfaceHostingProxyRootView
|
|
52
|
-
{
|
|
53
|
-
rootView.surface.stop()
|
|
54
|
-
}
|
|
55
|
-
#else
|
|
56
|
-
if let rootView = self.window?.rootViewController?.view
|
|
57
|
-
as? RCTRootView
|
|
58
|
-
{
|
|
59
|
-
if let contentView = rootView.contentView as? RCTInvalidating {
|
|
60
|
-
contentView.invalidate()
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
#endif
|
|
64
|
-
|
|
49
|
+
NitroSurface.stop(self.window?.rootViewController?.view)
|
|
65
50
|
self.window = nil
|
|
66
51
|
isConnected = false
|
|
67
52
|
|
|
68
|
-
guard let moduleName = self.moduleName else {
|
|
69
|
-
return
|
|
70
|
-
}
|
|
71
|
-
|
|
72
53
|
SceneStore.removeScene(moduleName: moduleName)
|
|
73
54
|
}
|
|
74
55
|
|
|
75
56
|
func setState(state: VisibilityState) {
|
|
76
|
-
guard let moduleName = self.moduleName else {
|
|
77
|
-
return
|
|
78
|
-
}
|
|
79
|
-
|
|
80
57
|
SceneStore.setState(moduleName: moduleName, state: state)
|
|
81
58
|
}
|
|
82
59
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
window.rootViewController = AutoPlaySceneViewController(
|
|
100
|
-
view: rootView,
|
|
101
|
-
moduleName: moduleName
|
|
60
|
+
@MainActor
|
|
61
|
+
func initRootView() throws {
|
|
62
|
+
guard let window = self.window else {
|
|
63
|
+
throw AutoPlayError.noUiWindow(
|
|
64
|
+
"window nil for module: \(moduleName)"
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
guard
|
|
69
|
+
let rootView = ViewUtils.getRootView(
|
|
70
|
+
moduleName: moduleName,
|
|
71
|
+
initialProps: self.initialProperties
|
|
72
|
+
)
|
|
73
|
+
else {
|
|
74
|
+
throw AutoPlayError.initReactRootViewFailed(
|
|
75
|
+
"could not create react root view for module: \(moduleName)"
|
|
102
76
|
)
|
|
103
|
-
window.makeKeyAndVisible()
|
|
104
77
|
}
|
|
78
|
+
|
|
79
|
+
window.rootViewController = AutoPlaySceneViewController(
|
|
80
|
+
view: rootView,
|
|
81
|
+
moduleName: moduleName
|
|
82
|
+
)
|
|
83
|
+
window.makeKeyAndVisible()
|
|
105
84
|
}
|
|
106
85
|
|
|
107
86
|
open func traitCollectionDidChange(traitCollection: UITraitCollection) {
|
|
@@ -112,7 +91,7 @@ class AutoPlayScene: UIResponder {
|
|
|
112
91
|
open func safeAreaInsetsDidChange(safeAreaInsets: UIEdgeInsets) {
|
|
113
92
|
self.safeAreaInsets = safeAreaInsets
|
|
114
93
|
HybridAutoPlay.emitSafeAreaInsets(
|
|
115
|
-
moduleName: moduleName
|
|
94
|
+
moduleName: moduleName,
|
|
116
95
|
safeAreaInsets: safeAreaInsets
|
|
117
96
|
)
|
|
118
97
|
}
|
|
@@ -16,7 +16,7 @@ export interface CarPlayDashboard extends HybridObject<{
|
|
|
16
16
|
}> {
|
|
17
17
|
addListener(eventType: EventName, callback: () => void): CleanupCallback;
|
|
18
18
|
setButtons(buttons: Array<NitroCarPlayDashboardButton>): Promise<void>;
|
|
19
|
-
initRootView(): void
|
|
19
|
+
initRootView(): Promise<void>;
|
|
20
20
|
addListenerColorScheme(callback: (payload: ColorScheme) => void): CleanupCallback;
|
|
21
21
|
}
|
|
22
22
|
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { HybridObject } from 'react-native-nitro-modules';
|
|
2
|
+
import type { CleanupCallback } from '../types/Event';
|
|
3
|
+
import type { Telemetry } from '../types/Telemetry';
|
|
4
|
+
export interface HybridAndroidAutoTelemetry extends HybridObject<{
|
|
5
|
+
android: 'kotlin';
|
|
6
|
+
}> {
|
|
7
|
+
/**
|
|
8
|
+
* Register a listener for Android Auto telemetry data. Should be registered only after the telemetry permissions are granted otherwise no data will be received.
|
|
9
|
+
* @param callback the callback to receive the telemetry data
|
|
10
|
+
* @param error the error message if the telemetry listener failed to start
|
|
11
|
+
* @returns callback to remove the listener
|
|
12
|
+
* @namespace Android
|
|
13
|
+
*/
|
|
14
|
+
registerTelemetryListener(callback: (tlm?: Telemetry, error?: string) => void): CleanupCallback;
|
|
15
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { HybridObject } from 'react-native-nitro-modules';
|
|
2
|
+
import type { TemplateConfig } from '../templates/Template';
|
|
3
|
+
import type { CleanupCallback, EventName, SafeAreaInsets, VisibilityState } from '../types/Event';
|
|
4
|
+
import type { NitroAction } from '../utils/NitroAction';
|
|
5
|
+
export interface NitroTemplateConfig extends TemplateConfig {
|
|
6
|
+
id: string;
|
|
7
|
+
}
|
|
8
|
+
export interface HybridAutoPlay extends HybridObject<{
|
|
9
|
+
android: 'kotlin';
|
|
10
|
+
ios: 'swift';
|
|
11
|
+
}> {
|
|
12
|
+
/**
|
|
13
|
+
* attach a listener for didConnect and didDisconnect
|
|
14
|
+
* @namespace all
|
|
15
|
+
* @param eventType generic events
|
|
16
|
+
* @returns callback to remove the listener
|
|
17
|
+
*/
|
|
18
|
+
addListener(eventType: EventName, callback: () => void): CleanupCallback;
|
|
19
|
+
/**
|
|
20
|
+
* adds a listener for the session/scene state
|
|
21
|
+
* fires willAppear & didAppear when the scene/session is visible
|
|
22
|
+
* fires willDisappear & didDisappear when the scene/session is not visible
|
|
23
|
+
* @param moduleName on of @AutoPlayModules, a cluster scene uuid or your main for the WindowApplicationSceneDelegate
|
|
24
|
+
*/
|
|
25
|
+
addListenerRenderState(moduleName: string, callback: (payload: VisibilityState) => void): CleanupCallback;
|
|
26
|
+
/**
|
|
27
|
+
* sets the specified template as root template, initializes a new stack
|
|
28
|
+
* Promise might contain an error message in case setting root template failed
|
|
29
|
+
* can be used on any Android screen/iOS scene
|
|
30
|
+
*/
|
|
31
|
+
setRootTemplate(templateId: string): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* push a template to the AutoPlayRoot Android screen/iOS scene
|
|
34
|
+
*/
|
|
35
|
+
pushTemplate(templateId: string): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* remove the top template from the stack
|
|
38
|
+
* @param animate - defaults to true
|
|
39
|
+
*/
|
|
40
|
+
popTemplate(animate?: boolean): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* remove all templates from the stack except the root template
|
|
43
|
+
* @param animate - defaults to true
|
|
44
|
+
*/
|
|
45
|
+
popToRootTemplate(animate?: boolean): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* removes all templates until the specified one is the top template
|
|
48
|
+
*/
|
|
49
|
+
popToTemplate(templateId: string, animate?: boolean): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* callback for safe area insets changes
|
|
52
|
+
* @param insets the insets that you use to determine the safe area for this view.
|
|
53
|
+
*/
|
|
54
|
+
addSafeAreaInsetsListener(moduleName: string, callback: (insets: SafeAreaInsets) => void): CleanupCallback;
|
|
55
|
+
/**
|
|
56
|
+
* update a templates headerActions
|
|
57
|
+
*/
|
|
58
|
+
setTemplateHeaderActions(templateId: string, headerActions?: Array<NitroAction>): void;
|
|
59
|
+
/**
|
|
60
|
+
* Check if AutoPlay is connected.
|
|
61
|
+
* @returns true if AutoPlay is connected, false otherwise.
|
|
62
|
+
*/
|
|
63
|
+
isConnected(): boolean;
|
|
64
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { HybridObject } from 'react-native-nitro-modules';
|
|
2
|
+
import type { CleanupCallback, EventName } from '../types/Event';
|
|
3
|
+
import type { ColorScheme } from '../types/RootComponent';
|
|
4
|
+
import type { NitroImage } from '../utils/NitroImage';
|
|
5
|
+
export interface BaseCarPlayDashboardButton {
|
|
6
|
+
titleVariants: Array<string>;
|
|
7
|
+
subtitleVariants: Array<string>;
|
|
8
|
+
onPress: () => void;
|
|
9
|
+
launchHeadUnitScene?: boolean;
|
|
10
|
+
}
|
|
11
|
+
interface NitroCarPlayDashboardButton extends BaseCarPlayDashboardButton {
|
|
12
|
+
image: NitroImage;
|
|
13
|
+
}
|
|
14
|
+
export interface HybridCarPlayDashboard extends HybridObject<{
|
|
15
|
+
ios: 'swift';
|
|
16
|
+
}> {
|
|
17
|
+
addListener(eventType: EventName, callback: () => void): CleanupCallback;
|
|
18
|
+
setButtons(buttons: Array<NitroCarPlayDashboardButton>): Promise<void>;
|
|
19
|
+
initRootView(): void;
|
|
20
|
+
addListenerColorScheme(callback: (payload: ColorScheme) => void): CleanupCallback;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { HybridObject } from 'react-native-nitro-modules';
|
|
2
|
+
import type { CleanupCallback } from '../types/Event';
|
|
3
|
+
import type { ColorScheme } from '../types/RootComponent';
|
|
4
|
+
import type { NitroAttributedString } from '../utils/NitroAttributedString';
|
|
5
|
+
type ClusterEventName = 'didConnect' | 'didConnectWithWindow' | 'didDisconnect' | 'didDisconnectFromWindow';
|
|
6
|
+
export type ZoomEvent = 'in' | 'out';
|
|
7
|
+
export interface HybridCluster extends HybridObject<{
|
|
8
|
+
android: 'kotlin';
|
|
9
|
+
ios: 'swift';
|
|
10
|
+
}> {
|
|
11
|
+
addListener(eventType: ClusterEventName, callback: (clusterId: string) => void): CleanupCallback;
|
|
12
|
+
initRootView(clusterId: string): Promise<void>;
|
|
13
|
+
setAttributedInactiveDescriptionVariants(clusterId: string, attributedInactiveDescriptionVariants: Array<NitroAttributedString>): void;
|
|
14
|
+
addListenerColorScheme(callback: (clusterId: string, payload: ColorScheme) => void): CleanupCallback;
|
|
15
|
+
addListenerZoom(callback: (clusterId: string, payload: ZoomEvent) => void): CleanupCallback;
|
|
16
|
+
addListenerCompass(callback: (clusterId: string, payload: boolean) => void): CleanupCallback;
|
|
17
|
+
addListenerSpeedLimit(callback: (clusterId: string, payload: boolean) => void): CleanupCallback;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { HybridObject } from 'react-native-nitro-modules';
|
|
2
|
+
import type { NitroGridTemplateConfig } from '../templates/GridTemplate';
|
|
3
|
+
import type { NitroGridButton } from '../utils/NitroGrid';
|
|
4
|
+
import type { NitroTemplateConfig } from './HybridAutoPlay.nitro';
|
|
5
|
+
interface GridTemplateConfig extends NitroTemplateConfig, NitroGridTemplateConfig {
|
|
6
|
+
}
|
|
7
|
+
export interface HybridGridTemplate extends HybridObject<{
|
|
8
|
+
android: 'kotlin';
|
|
9
|
+
ios: 'swift';
|
|
10
|
+
}> {
|
|
11
|
+
createGridTemplate(config: GridTemplateConfig): void;
|
|
12
|
+
updateGridTemplateButtons(templateId: string, buttons: Array<NitroGridButton>): void;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { HybridObject } from 'react-native-nitro-modules';
|
|
2
|
+
import type { NitroInformationTemplateConfig } from '../templates/InformationTemplate';
|
|
3
|
+
import type { NitroTemplateConfig } from './HybridAutoPlay.nitro';
|
|
4
|
+
interface InformationTemplateConfig extends NitroTemplateConfig, NitroInformationTemplateConfig {
|
|
5
|
+
}
|
|
6
|
+
export interface HybridInformationTemplate extends HybridObject<{
|
|
7
|
+
android: 'kotlin';
|
|
8
|
+
ios: 'swift';
|
|
9
|
+
}> {
|
|
10
|
+
createInformationTemplate(config: InformationTemplateConfig): void;
|
|
11
|
+
updateInformationTemplateSections(templateId: string, section: NitroInformationTemplateConfig['section']): void;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { HybridObject } from 'react-native-nitro-modules';
|
|
2
|
+
import type { NitroListTemplateConfig } from '../templates/ListTemplate';
|
|
3
|
+
import type { NitroTemplateConfig } from './HybridAutoPlay.nitro';
|
|
4
|
+
interface ListTemplateConfig extends NitroTemplateConfig, NitroListTemplateConfig {
|
|
5
|
+
}
|
|
6
|
+
export interface HybridListTemplate extends HybridObject<{
|
|
7
|
+
android: 'kotlin';
|
|
8
|
+
ios: 'swift';
|
|
9
|
+
}> {
|
|
10
|
+
createListTemplate(config: ListTemplateConfig): void;
|
|
11
|
+
updateListTemplateSections(templateId: string, sections: NitroListTemplateConfig['sections']): void;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { HybridObject } from 'react-native-nitro-modules';
|
|
2
|
+
import type { NavigationAlertCallbacks, NitroMapTemplateConfig, TripSelectorCallback, VisibleTravelEstimate } from '../templates/MapTemplate';
|
|
3
|
+
import type { TripConfig, TripPoint, TripPreviewTextConfiguration, TripsConfig } from '../types/Trip';
|
|
4
|
+
import type { NitroNavigationAlert } from '../utils/NitroAlert';
|
|
5
|
+
import type { NitroManeuver } from '../utils/NitroManeuver';
|
|
6
|
+
import type { NitroMapButton } from '../utils/NitroMapButton';
|
|
7
|
+
import type { NitroTemplateConfig } from './HybridAutoPlay.nitro';
|
|
8
|
+
interface MapTemplateConfig extends NitroTemplateConfig, NitroMapTemplateConfig {
|
|
9
|
+
}
|
|
10
|
+
export interface HybridMapTemplate extends HybridObject<{
|
|
11
|
+
android: 'kotlin';
|
|
12
|
+
ios: 'swift';
|
|
13
|
+
}> {
|
|
14
|
+
createMapTemplate(config: MapTemplateConfig): void;
|
|
15
|
+
showNavigationAlert(templateId: string, alert: NitroNavigationAlert): NavigationAlertCallbacks;
|
|
16
|
+
showTripSelector(templateId: string, trips: Array<TripsConfig>, selectedTripId: string | undefined, textConfig: TripPreviewTextConfiguration, onTripSelected: (tripId: string, routeId: string) => void, onTripStarted: (tripId: string, routeId: string) => void, onBackPressed: () => void, mapButtons: Array<NitroMapButton>): TripSelectorCallback;
|
|
17
|
+
hideTripSelector(templateId: string): void;
|
|
18
|
+
setTemplateMapButtons(templateId: string, buttons?: Array<NitroMapButton>): void;
|
|
19
|
+
updateVisibleTravelEstimate(templateId: string, visibleTravelEstimate: VisibleTravelEstimate): void;
|
|
20
|
+
updateTravelEstimates(templateId: string, steps: Array<TripPoint>): void;
|
|
21
|
+
updateManeuvers(templateId: string, maneuvers: NitroManeuver): void;
|
|
22
|
+
startNavigation(templateId: string, trip: TripConfig): void;
|
|
23
|
+
stopNavigation(templateId: string): void;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { HybridObject } from 'react-native-nitro-modules';
|
|
2
|
+
import type { NitroMessageTemplateConfig } from '../templates/MessageTemplate';
|
|
3
|
+
import type { NitroTemplateConfig } from './HybridAutoPlay.nitro';
|
|
4
|
+
interface MessageTemplateConfig extends NitroTemplateConfig, NitroMessageTemplateConfig {
|
|
5
|
+
}
|
|
6
|
+
export interface HybridMessageTemplate extends HybridObject<{
|
|
7
|
+
android: 'kotlin';
|
|
8
|
+
ios: 'swift';
|
|
9
|
+
}> {
|
|
10
|
+
createMessageTemplate(config: MessageTemplateConfig): void;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { HybridObject } from 'react-native-nitro-modules';
|
|
2
|
+
import type { NitroSearchTemplateConfig } from '../templates/SearchTemplate';
|
|
3
|
+
import type { NitroTemplateConfig } from './HybridAutoPlay.nitro';
|
|
4
|
+
interface SearchTemplateConfig extends NitroTemplateConfig, NitroSearchTemplateConfig {
|
|
5
|
+
}
|
|
6
|
+
export interface HybridSearchTemplate extends HybridObject<{
|
|
7
|
+
android: 'kotlin';
|
|
8
|
+
ios: 'swift';
|
|
9
|
+
}> {
|
|
10
|
+
createSearchTemplate(config: SearchTemplateConfig): void;
|
|
11
|
+
updateSearchResults(templateId: string, results: NitroSearchTemplateConfig['results']): void;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
type Translation = {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
};
|
|
5
|
+
type Velocity = {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* @param translation screen coordinate offset
|
|
11
|
+
* @param velocity only reported on iOS/CarPlay
|
|
12
|
+
*/
|
|
13
|
+
export type PanGestureWithTranslationEventPayload = {
|
|
14
|
+
translation: Translation;
|
|
15
|
+
velocity?: Velocity;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* @param x screen coordinate of the pinch center
|
|
19
|
+
* @param y screen coordinate of the pinch center
|
|
20
|
+
* @param scaleFactor value > 0.0 and < 2.0 when 1.0 means no scaling, > 1.0 zoom in and < 1.0 zoom out, value == 2.0 is a double tap
|
|
21
|
+
* @namespace Android
|
|
22
|
+
*/
|
|
23
|
+
export type PinchGestureEventPayload = {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
scaleFactor: number;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* @param x screen coordinate of the press event
|
|
30
|
+
* @param y screen coordinate of the press event
|
|
31
|
+
* @namespace Android
|
|
32
|
+
*/
|
|
33
|
+
export type PressEventPayload = {
|
|
34
|
+
x: number;
|
|
35
|
+
y: number;
|
|
36
|
+
};
|
|
37
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -613,15 +613,6 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay::bridge::swift {
|
|
|
613
613
|
using std__weak_ptr_HybridCarPlayDashboardSpec_ = std::weak_ptr<HybridCarPlayDashboardSpec>;
|
|
614
614
|
inline std__weak_ptr_HybridCarPlayDashboardSpec_ weakify_std__shared_ptr_HybridCarPlayDashboardSpec_(const std::shared_ptr<HybridCarPlayDashboardSpec>& strong) noexcept { return strong; }
|
|
615
615
|
|
|
616
|
-
// pragma MARK: Result<void>
|
|
617
|
-
using Result_void_ = Result<void>;
|
|
618
|
-
inline Result_void_ create_Result_void_() noexcept {
|
|
619
|
-
return Result<void>::withValue();
|
|
620
|
-
}
|
|
621
|
-
inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
|
|
622
|
-
return Result<void>::withError(error);
|
|
623
|
-
}
|
|
624
|
-
|
|
625
616
|
// pragma MARK: std::function<void(const std::string& /* clusterId */)>
|
|
626
617
|
/**
|
|
627
618
|
* Specialized version of `std::function<void(const std::string&)>`.
|
|
@@ -759,6 +750,15 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay::bridge::swift {
|
|
|
759
750
|
using std__weak_ptr_HybridClusterSpec_ = std::weak_ptr<HybridClusterSpec>;
|
|
760
751
|
inline std__weak_ptr_HybridClusterSpec_ weakify_std__shared_ptr_HybridClusterSpec_(const std::shared_ptr<HybridClusterSpec>& strong) noexcept { return strong; }
|
|
761
752
|
|
|
753
|
+
// pragma MARK: Result<void>
|
|
754
|
+
using Result_void_ = Result<void>;
|
|
755
|
+
inline Result_void_ create_Result_void_() noexcept {
|
|
756
|
+
return Result<void>::withValue();
|
|
757
|
+
}
|
|
758
|
+
inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
|
|
759
|
+
return Result<void>::withError(error);
|
|
760
|
+
}
|
|
761
|
+
|
|
762
762
|
// pragma MARK: std::function<void(std::optional<bool> /* animated */)>
|
|
763
763
|
/**
|
|
764
764
|
* Specialized version of `std::function<void(std::optional<bool>)>`.
|
|
@@ -98,11 +98,13 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
|
|
|
98
98
|
auto __value = std::move(__result.value());
|
|
99
99
|
return __value;
|
|
100
100
|
}
|
|
101
|
-
inline void initRootView() override {
|
|
101
|
+
inline std::shared_ptr<Promise<void>> initRootView() override {
|
|
102
102
|
auto __result = _swiftPart.initRootView();
|
|
103
103
|
if (__result.hasError()) [[unlikely]] {
|
|
104
104
|
std::rethrow_exception(__result.error());
|
|
105
105
|
}
|
|
106
|
+
auto __value = std::move(__result.value());
|
|
107
|
+
return __value;
|
|
106
108
|
}
|
|
107
109
|
inline std::function<void()> addListenerColorScheme(const std::function<void(ColorScheme /* payload */)>& callback) override {
|
|
108
110
|
auto __result = _swiftPart.addListenerColorScheme(callback);
|
|
@@ -17,7 +17,7 @@ public protocol HybridCarPlayDashboardSpec_protocol: HybridObject {
|
|
|
17
17
|
// Methods
|
|
18
18
|
func addListener(eventType: EventName, callback: @escaping () -> Void) throws -> () -> Void
|
|
19
19
|
func setButtons(buttons: [NitroCarPlayDashboardButton]) throws -> Promise<Void>
|
|
20
|
-
func initRootView() throws -> Void
|
|
20
|
+
func initRootView() throws -> Promise<Void>
|
|
21
21
|
func addListenerColorScheme(callback: @escaping (_ payload: ColorScheme) -> Void) throws -> () -> Void
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -158,13 +158,21 @@ open class HybridCarPlayDashboardSpec_cxx {
|
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
@inline(__always)
|
|
161
|
-
public final func initRootView() -> bridge.
|
|
161
|
+
public final func initRootView() -> bridge.Result_std__shared_ptr_Promise_void___ {
|
|
162
162
|
do {
|
|
163
|
-
try self.__implementation.initRootView()
|
|
164
|
-
|
|
163
|
+
let __result = try self.__implementation.initRootView()
|
|
164
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_void__ in
|
|
165
|
+
let __promise = bridge.create_std__shared_ptr_Promise_void__()
|
|
166
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_void__(__promise)
|
|
167
|
+
__result
|
|
168
|
+
.then({ __result in __promiseHolder.resolve() })
|
|
169
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
170
|
+
return __promise
|
|
171
|
+
}()
|
|
172
|
+
return bridge.create_Result_std__shared_ptr_Promise_void___(__resultCpp)
|
|
165
173
|
} catch (let __error) {
|
|
166
174
|
let __exceptionPtr = __error.toCpp()
|
|
167
|
-
return bridge.
|
|
175
|
+
return bridge.create_Result_std__shared_ptr_Promise_void___(__exceptionPtr)
|
|
168
176
|
}
|
|
169
177
|
}
|
|
170
178
|
|
|
@@ -60,7 +60,7 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
|
|
|
60
60
|
// Methods
|
|
61
61
|
virtual std::function<void()> addListener(EventName eventType, const std::function<void()>& callback) = 0;
|
|
62
62
|
virtual std::shared_ptr<Promise<void>> setButtons(const std::vector<NitroCarPlayDashboardButton>& buttons) = 0;
|
|
63
|
-
virtual void initRootView() = 0;
|
|
63
|
+
virtual std::shared_ptr<Promise<void>> initRootView() = 0;
|
|
64
64
|
virtual std::function<void()> addListenerColorScheme(const std::function<void(ColorScheme /* payload */)>& callback) = 0;
|
|
65
65
|
|
|
66
66
|
protected:
|
package/package.json
CHANGED
|
@@ -17,6 +17,6 @@ interface NitroCarPlayDashboardButton extends BaseCarPlayDashboardButton {
|
|
|
17
17
|
export interface CarPlayDashboard extends HybridObject<{ ios: 'swift' }> {
|
|
18
18
|
addListener(eventType: EventName, callback: () => void): CleanupCallback;
|
|
19
19
|
setButtons(buttons: Array<NitroCarPlayDashboardButton>): Promise<void>;
|
|
20
|
-
initRootView(): void
|
|
20
|
+
initRootView(): Promise<void>;
|
|
21
21
|
addListenerColorScheme(callback: (payload: ColorScheme) => void): CleanupCallback;
|
|
22
22
|
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// RootView.h
|
|
3
|
-
// Pods
|
|
4
|
-
//
|
|
5
|
-
// Created by Manuel Auer on 07.11.25.
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
// this is required for old architecture support since the React pod can not be imported
|
|
9
|
-
|
|
10
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
11
|
-
|
|
12
|
-
#else
|
|
13
|
-
|
|
14
|
-
#import <Foundation/Foundation.h>
|
|
15
|
-
|
|
16
|
-
@protocol RCTInvalidating <NSObject>
|
|
17
|
-
|
|
18
|
-
- (void)invalidate;
|
|
19
|
-
|
|
20
|
-
@end
|
|
21
|
-
|
|
22
|
-
@interface RCTRootView : UIView
|
|
23
|
-
/**
|
|
24
|
-
* The React-managed contents view of the root view.
|
|
25
|
-
*/
|
|
26
|
-
@property(nonatomic, strong, readonly) UIView *contentView;
|
|
27
|
-
@end
|
|
28
|
-
|
|
29
|
-
#endif
|
|
@@ -1,8 +0,0 @@
|
|
|
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
|
-
}
|
|
File without changes
|