@iternio/react-native-auto-play 0.6.1 → 0.8.0
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/README.md +17 -4
- package/android/build.gradle +4 -2
- package/android/src/automotive/AndroidManifest-nonnav.xml +0 -2
- package/android/src/automotive/AndroidManifest.xml +0 -2
- package/android/src/main/AndroidManifest-nonnav.xml +0 -2
- package/android/src/main/AndroidManifest.xml +0 -2
- package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/AndroidAutoService.kt +3 -27
- package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/AutoPlayError.kt +4 -0
- package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridAutoPlayTiming.kt +122 -0
- package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridSignInTemplate.kt +23 -0
- package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/SignInWithGoogleActivity.kt +79 -27
- package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/template/Parser.kt +2 -2
- package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/template/SignInTemplate.kt +35 -21
- package/installTimers.ts +3 -0
- package/installTimers.web.ts +2 -0
- package/ios/hybrid/HybridAutoPlayTiming.swift +123 -0
- package/lib/components/SafeAreaView.js +1 -1
- package/lib/hybrid/HybridAutoPlayTiming.d.ts +2 -0
- package/lib/hybrid/HybridAutoPlayTiming.js +2 -0
- package/lib/hybrid/HybridVoice.js +2 -2
- package/lib/index.js +0 -2
- package/lib/index.web.d.ts +4 -2
- package/lib/installTimers.d.ts +1 -0
- package/lib/installTimers.js +8 -0
- package/lib/installTimers.web.d.ts +1 -0
- package/lib/installTimers.web.js +2 -0
- package/lib/scenes/CarPlayDashboardScene.d.ts +3 -3
- package/lib/specs/AutoPlayTiming.nitro.d.ts +27 -0
- package/lib/specs/AutoPlayTiming.nitro.js +1 -0
- package/lib/specs/SignInTemplate.nitro.d.ts +1 -0
- package/lib/templates/SignInTemplate.d.ts +5 -0
- package/lib/templates/SignInTemplate.js +7 -0
- package/lib/types/Telemetry.d.ts +1 -1
- package/lib/utils/AutoPlayTimers.d.ts +21 -0
- package/lib/utils/AutoPlayTimers.js +45 -0
- package/lib/utils/NitroImage.d.ts +5 -2
- package/lib/utils/NitroImage.js +1 -1
- package/lib-cjs/components/SafeAreaView.js +1 -1
- package/lib-cjs/hybrid/HybridVoice.js +2 -2
- package/lib-cjs/index.js +0 -5
- package/lib-cjs/templates/SignInTemplate.js +7 -0
- package/lib-cjs/utils/NitroImage.js +1 -1
- package/nitro.json +10 -0
- package/nitrogen/generated/android/ReactNativeAutoPlay+autolinking.cmake +2 -0
- package/nitrogen/generated/android/ReactNativeAutoPlayOnLoad.cpp +16 -0
- package/nitrogen/generated/android/c++/JActiveCarUxRestrictions.hpp +1 -1
- package/nitrogen/generated/android/c++/JAlertActionStyle.hpp +1 -1
- package/nitrogen/generated/android/c++/JAlertDismissalReason.hpp +1 -1
- package/nitrogen/generated/android/c++/JAppFocusState.hpp +1 -1
- package/nitrogen/generated/android/c++/JAssetImage.hpp +18 -18
- package/nitrogen/generated/android/c++/JAutoText.hpp +1 -1
- package/nitrogen/generated/android/c++/JBooleanTelemetryItem.hpp +1 -1
- package/nitrogen/generated/android/c++/JCarUxRestrictions.hpp +1 -1
- package/nitrogen/generated/android/c++/JChargingConnector.hpp +1 -1
- package/nitrogen/generated/android/c++/JClusterEventName.hpp +1 -1
- package/nitrogen/generated/android/c++/JColorScheme.hpp +1 -1
- package/nitrogen/generated/android/c++/JDistance.hpp +1 -1
- package/nitrogen/generated/android/c++/JDistanceUnits.hpp +1 -1
- package/nitrogen/generated/android/c++/JDurationWithTimeZone.hpp +1 -1
- package/nitrogen/generated/android/c++/JEventName.hpp +1 -1
- package/nitrogen/generated/android/c++/JForkType.hpp +1 -1
- package/nitrogen/generated/android/c++/JGlyphImage.hpp +1 -1
- package/nitrogen/generated/android/c++/JGoogleSignIn.hpp +1 -1
- package/nitrogen/generated/android/c++/JGoogleSignInAccount.hpp +1 -1
- package/nitrogen/generated/android/c++/JGridImageSize.hpp +1 -1
- package/nitrogen/generated/android/c++/JGridTemplateConfig.hpp +1 -1
- package/nitrogen/generated/android/c++/JHybridAutoPlayTimingSpec.cpp +59 -0
- package/nitrogen/generated/android/c++/JHybridAutoPlayTimingSpec.hpp +64 -0
- package/nitrogen/generated/android/c++/JHybridSignInTemplateSpec.cpp +5 -0
- package/nitrogen/generated/android/c++/JHybridSignInTemplateSpec.hpp +1 -0
- package/nitrogen/generated/android/c++/JImageLane.hpp +1 -1
- package/nitrogen/generated/android/c++/JInformationTemplateConfig.hpp +1 -1
- package/nitrogen/generated/android/c++/JInputSignIn.hpp +1 -1
- package/nitrogen/generated/android/c++/JKeepType.hpp +1 -1
- package/nitrogen/generated/android/c++/JKeyboardType.hpp +1 -1
- package/nitrogen/generated/android/c++/JLaneGuidance.hpp +1 -1
- package/nitrogen/generated/android/c++/JListImageType.hpp +1 -1
- package/nitrogen/generated/android/c++/JListTemplateConfig.hpp +1 -1
- package/nitrogen/generated/android/c++/JLocation.hpp +1 -1
- package/nitrogen/generated/android/c++/JManeuverState.hpp +1 -1
- package/nitrogen/generated/android/c++/JManeuverType.hpp +1 -1
- package/nitrogen/generated/android/c++/JMapTemplateConfig.hpp +1 -1
- package/nitrogen/generated/android/c++/JMessageTemplateConfig.hpp +1 -1
- package/nitrogen/generated/android/c++/JNavigationAlertAction.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroAction.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroActionType.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroAlignment.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroAttributedString.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroAttributedStringImage.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroBaseMapTemplateConfig.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroButtonStyle.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroChargerLocation.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroChargerOutlet.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroColor.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroGridButton.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroLoadingManeuver.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroMapButton.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroMapButtonType.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroMessageManeuver.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroNavigationAlert.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroOptionsPanelChargerSection.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroOptionsPanelConfig.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroOptionsPanelGridSection.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroRoutingManeuver.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroRow.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroSection.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroSectionType.hpp +1 -1
- package/nitrogen/generated/android/c++/JNumericTelemetryItem.hpp +1 -1
- package/nitrogen/generated/android/c++/JOffRampType.hpp +1 -1
- package/nitrogen/generated/android/c++/JOnRampType.hpp +1 -1
- package/nitrogen/generated/android/c++/JPermissionRequestResult.hpp +1 -1
- package/nitrogen/generated/android/c++/JPinSignIn.hpp +1 -1
- package/nitrogen/generated/android/c++/JPoint.hpp +1 -1
- package/nitrogen/generated/android/c++/JPreferredImageLane.hpp +1 -1
- package/nitrogen/generated/android/c++/JQrSignIn.hpp +1 -1
- package/nitrogen/generated/android/c++/JRemoteImage.hpp +1 -1
- package/nitrogen/generated/android/c++/JRouteChoice.hpp +1 -1
- package/nitrogen/generated/android/c++/JSafeAreaInsets.hpp +1 -1
- package/nitrogen/generated/android/c++/JSearchTemplateConfig.hpp +1 -1
- package/nitrogen/generated/android/c++/JSignInMethods.hpp +1 -1
- package/nitrogen/generated/android/c++/JSignInTemplateConfig.hpp +1 -1
- package/nitrogen/generated/android/c++/JStringTelemetryItem.hpp +1 -1
- package/nitrogen/generated/android/c++/JTelemetry.hpp +1 -1
- package/nitrogen/generated/android/c++/JTextInputType.hpp +1 -1
- package/nitrogen/generated/android/c++/JTrafficSide.hpp +1 -1
- package/nitrogen/generated/android/c++/JTravelEstimates.hpp +1 -1
- package/nitrogen/generated/android/c++/JTripConfig.hpp +1 -1
- package/nitrogen/generated/android/c++/JTripPoint.hpp +1 -1
- package/nitrogen/generated/android/c++/JTripPreviewTextConfiguration.hpp +1 -1
- package/nitrogen/generated/android/c++/JTripSelectorCallback.hpp +1 -1
- package/nitrogen/generated/android/c++/JTripsConfig.hpp +1 -1
- package/nitrogen/generated/android/c++/JTurnType.hpp +1 -1
- package/nitrogen/generated/android/c++/JVehicleTelemetryItem.hpp +1 -1
- package/nitrogen/generated/android/c++/JVisibilityState.hpp +1 -1
- package/nitrogen/generated/android/c++/JVisibleTravelEstimate.hpp +1 -1
- package/nitrogen/generated/android/c++/JVoiceAudioEncoding.hpp +1 -1
- package/nitrogen/generated/android/c++/JVoiceInputChunk.hpp +1 -1
- package/nitrogen/generated/android/c++/JVoiceInputResult.hpp +1 -1
- package/nitrogen/generated/android/c++/JWaypointCoordinate.hpp +1 -1
- package/nitrogen/generated/android/c++/JWindowInformation.hpp +1 -1
- package/nitrogen/generated/android/c++/JZoomEvent.hpp +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/AssetImage.kt +15 -15
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_ActiveCarUxRestrictions.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_AlertDismissalReason.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_AppFocusState.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_ColorScheme.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_Point.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_Point_double.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_Point_std__optional_Point_.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_SafeAreaInsets.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_VisibilityState.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_VoiceInputChunk.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_WindowInformation.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_bool.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_std__optional_Location__std__optional_std__string_.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_std__optional_Telemetry_.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_std__optional_bool_.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_std__optional_std__string__std__optional_GoogleSignInAccount_.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_std__string.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_std__string_ColorScheme.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_std__string_ZoomEvent.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_std__string_bool.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_std__string_std__string.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridAndroidAutoTelemetrySpec.kt +2 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridAndroidAutomotiveSpec.kt +2 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridAndroidWindowInformationSpec.kt +2 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridAutoPlaySpec.kt +2 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridAutoPlayTimingSpec.kt +65 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridClusterSpec.kt +2 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridGridTemplateSpec.kt +2 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridInformationTemplateSpec.kt +2 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridListTemplateSpec.kt +2 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridMapTemplateSpec.kt +2 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridMessageTemplateSpec.kt +2 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridSearchTemplateSpec.kt +2 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridSignInTemplateSpec.kt +6 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridVoiceSpec.kt +2 -0
- package/nitrogen/generated/ios/ReactNativeAutoPlay-Swift-Cxx-Bridge.cpp +17 -0
- package/nitrogen/generated/ios/ReactNativeAutoPlay-Swift-Cxx-Bridge.hpp +35 -9
- package/nitrogen/generated/ios/ReactNativeAutoPlay-Swift-Cxx-Umbrella.hpp +5 -0
- package/nitrogen/generated/ios/ReactNativeAutoPlayAutolinking.mm +8 -0
- package/nitrogen/generated/ios/ReactNativeAutoPlayAutolinking.swift +12 -0
- package/nitrogen/generated/ios/c++/HybridAutoPlayTimingSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridAutoPlayTimingSpecSwift.hpp +88 -0
- package/nitrogen/generated/ios/swift/AssetImage.swift +13 -13
- package/nitrogen/generated/ios/swift/HybridAutoPlayTimingSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/HybridAutoPlayTimingSpec_cxx.swift +154 -0
- package/nitrogen/generated/shared/c++/AssetImage.hpp +18 -18
- package/nitrogen/generated/shared/c++/HybridAutoPlayTimingSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridAutoPlayTimingSpec.hpp +63 -0
- package/nitrogen/generated/shared/c++/HybridSignInTemplateSpec.cpp +1 -0
- package/nitrogen/generated/shared/c++/HybridSignInTemplateSpec.hpp +1 -0
- package/package.json +6 -4
- package/src/components/SafeAreaView.tsx +1 -1
- package/src/hybrid/HybridAutoPlayTiming.ts +5 -0
- package/src/hybrid/HybridVoice.ts +2 -2
- package/src/index.ts +0 -3
- package/src/installTimers.ts +9 -0
- package/src/installTimers.web.ts +2 -0
- package/src/specs/AutoPlayTiming.nitro.ts +25 -0
- package/src/specs/SignInTemplate.nitro.ts +1 -0
- package/src/templates/SignInTemplate.ts +8 -0
- package/src/types/Telemetry.ts +1 -1
- package/src/utils/AutoPlayTimers.ts +60 -0
- package/src/utils/NitroImage.ts +13 -3
- package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/HeadlessTaskService.kt +0 -36
- package/lib/AutoPlayHeadlessJsTask.d.ts +0 -5
- package/lib/AutoPlayHeadlessJsTask.js +0 -14
- package/lib-cjs/AutoPlayHeadlessJsTask.js +0 -16
- package/src/AutoPlayHeadlessJsTask.ts +0 -22
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import NitroModules
|
|
3
|
+
|
|
4
|
+
private struct ScheduledTimer {
|
|
5
|
+
let callback: () -> Void
|
|
6
|
+
let interval: TimeInterval
|
|
7
|
+
let repeats: Bool
|
|
8
|
+
var target: TimeInterval
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Unlike ProcessInfo.systemUptime/mach_absolute_time(), keeps counting through sleep. RAW over
|
|
12
|
+
// plain CLOCK_MONOTONIC: also immune to NTP frequency-discipline adjustments.
|
|
13
|
+
private func now() -> TimeInterval {
|
|
14
|
+
TimeInterval(clock_gettime_nsec_np(CLOCK_MONOTONIC_RAW)) / 1_000_000_000
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/// Backs setTimeout/setInterval (see AutoPlayTimers.ts) with a plain `Timer` -- not tied to
|
|
18
|
+
/// `CADisplayLink`/screen refresh, so it keeps firing while the phone screen is locked and
|
|
19
|
+
/// CarPlay is actively driving the external screen. See AutoPlayTiming.nitro.ts.
|
|
20
|
+
///
|
|
21
|
+
/// Ticks at a fixed ~60Hz while any timer is pending and stops entirely once idle, rather than
|
|
22
|
+
/// scheduling a delay to the next due target: a `Timer`'s dispatch is gated on the run loop's
|
|
23
|
+
/// own monotonic clock, which (like `mach_absolute_time()`) pauses during sleep, so a long
|
|
24
|
+
/// pre-sleep delay would need that much *awake* time after waking. A short, repeated delay only
|
|
25
|
+
/// needs ~16ms of awake time, so it fires within about one frame of the device waking
|
|
26
|
+
/// regardless of sleep length.
|
|
27
|
+
class HybridAutoPlayTiming: HybridAutoPlayTimingSpec {
|
|
28
|
+
private static let frameDuration: TimeInterval = 1.0 / 60.0
|
|
29
|
+
|
|
30
|
+
// RN's TimerManager also numbers ids from 1; offsetting avoids collisions with ids a
|
|
31
|
+
// pre-install caller (e.g. React's own scheduler) still holds against the original
|
|
32
|
+
// clearTimeout, now replaced.
|
|
33
|
+
private static let idOffset: Double = 1_000_000_000
|
|
34
|
+
|
|
35
|
+
private let lock = NSLock()
|
|
36
|
+
private var timers = [Double: ScheduledTimer]()
|
|
37
|
+
private var nextId: Double = HybridAutoPlayTiming.idOffset
|
|
38
|
+
private var timer: Timer?
|
|
39
|
+
|
|
40
|
+
deinit {
|
|
41
|
+
timer?.invalidate()
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
private func withLock<T>(_ body: () -> T) -> T {
|
|
45
|
+
lock.lock()
|
|
46
|
+
defer { lock.unlock() }
|
|
47
|
+
return body()
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Must be called while already holding `lock`.
|
|
51
|
+
private func scheduleTick() {
|
|
52
|
+
let next = Timer(timeInterval: HybridAutoPlayTiming.frameDuration, repeats: false) { [weak self] _ in
|
|
53
|
+
self?.tick()
|
|
54
|
+
}
|
|
55
|
+
RunLoop.main.add(next, forMode: .common)
|
|
56
|
+
timer = next
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
private func tick() {
|
|
60
|
+
let currentTime = now()
|
|
61
|
+
|
|
62
|
+
// Sort by (target, id): Dictionary iteration order is unspecified, so
|
|
63
|
+
// setTimeout(a, 0); setTimeout(b, 0) could otherwise fire b before a.
|
|
64
|
+
let dueIds = withLock {
|
|
65
|
+
timers.filter { $0.value.target <= currentTime }
|
|
66
|
+
.sorted { lhs, rhs in
|
|
67
|
+
lhs.value.target != rhs.value.target
|
|
68
|
+
? lhs.value.target < rhs.value.target
|
|
69
|
+
: lhs.key < rhs.key
|
|
70
|
+
}
|
|
71
|
+
.map(\.key)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
for id in dueIds {
|
|
75
|
+
// Re-check membership: a same-tick callback may have cleared a later timer in
|
|
76
|
+
// this snapshotted list (e.g. `clearTimeout(t); t = setTimeout(...)`).
|
|
77
|
+
let callback: (() -> Void)? = withLock {
|
|
78
|
+
guard var entry = timers[id] else { return nil }
|
|
79
|
+
if entry.repeats {
|
|
80
|
+
entry.target = now() + entry.interval
|
|
81
|
+
timers[id] = entry
|
|
82
|
+
} else {
|
|
83
|
+
timers.removeValue(forKey: id)
|
|
84
|
+
}
|
|
85
|
+
return entry.callback
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
callback?()
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
withLock {
|
|
92
|
+
timer = nil
|
|
93
|
+
if !timers.isEmpty {
|
|
94
|
+
scheduleTick()
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
func createTimer(callback: @escaping () -> Void, durationMs: Double, repeats: Bool) throws -> Double {
|
|
100
|
+
let interval = max(durationMs, 0) / 1000.0
|
|
101
|
+
|
|
102
|
+
return withLock {
|
|
103
|
+
let id = nextId
|
|
104
|
+
nextId += 1
|
|
105
|
+
timers[id] = ScheduledTimer(
|
|
106
|
+
callback: callback,
|
|
107
|
+
interval: interval,
|
|
108
|
+
repeats: repeats,
|
|
109
|
+
target: now() + interval
|
|
110
|
+
)
|
|
111
|
+
if timer == nil {
|
|
112
|
+
scheduleTick()
|
|
113
|
+
}
|
|
114
|
+
return id
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
func deleteTimer(id: Double) throws {
|
|
119
|
+
withLock {
|
|
120
|
+
_ = timers.removeValue(forKey: id)
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
@@ -7,7 +7,7 @@ export const SafeAreaView = (props) => {
|
|
|
7
7
|
return (_jsx(View, { style: [
|
|
8
8
|
style,
|
|
9
9
|
{
|
|
10
|
-
...StyleSheet.
|
|
10
|
+
...StyleSheet.absoluteFill,
|
|
11
11
|
paddingTop: safeAreaInsets.top,
|
|
12
12
|
paddingBottom: safeAreaInsets.bottom,
|
|
13
13
|
paddingRight: safeAreaInsets.right,
|
|
@@ -5,8 +5,8 @@ const _native = NitroModules.createHybridObject('Voice');
|
|
|
5
5
|
const startVoiceInput = async (options) => {
|
|
6
6
|
const { onChunk, silenceThresholdMs, maxDurationMs, listeningText, listeningImage, preferSpeechToText, language, startSound, endSound, encoding, } = options ?? {};
|
|
7
7
|
const listeningImageRepeats = listeningImage?.type === 'asset' ? listeningImage.repeats : undefined;
|
|
8
|
-
const startSoundUri = startSound != null ? Image.resolveAssetSource(startSound)
|
|
9
|
-
const endSoundUri = endSound != null ? Image.resolveAssetSource(endSound)
|
|
8
|
+
const startSoundUri = startSound != null ? Image.resolveAssetSource(startSound)?.uri : undefined;
|
|
9
|
+
const endSoundUri = endSound != null ? Image.resolveAssetSource(endSound)?.uri : undefined;
|
|
10
10
|
return await _native.startVoiceInput(silenceThresholdMs, maxDurationMs, listeningText, NitroImageUtil.convert(listeningImage), listeningImageRepeats, preferSpeechToText, onChunk, language, startSoundUri, endSoundUri, encoding);
|
|
11
11
|
};
|
|
12
12
|
export const HybridVoice = {
|
package/lib/index.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { Platform } from 'react-native';
|
|
2
2
|
import { NitroModules } from 'react-native-nitro-modules';
|
|
3
|
-
import AutoPlayHeadlessJsTask from './AutoPlayHeadlessJsTask';
|
|
4
3
|
import { HybridAndroidAutoTelemetry } from './hybrid/HybridAndroidAutoTelemetry';
|
|
5
4
|
import { HybridAndroidWindowInformation } from './hybrid/HybridAndroidWindowInformation';
|
|
6
5
|
import { HybridAutoPlay } from './hybrid/HybridAutoPlay';
|
|
7
6
|
import { HybridVoice } from './hybrid/HybridVoice';
|
|
8
|
-
AutoPlayHeadlessJsTask.registerHeadlessTask(HybridAutoPlay);
|
|
9
7
|
export { HybridAndroidAutoTelemetry, HybridAndroidWindowInformation, HybridAutoPlay, HybridVoice };
|
|
10
8
|
export const HybridAndroidAutomotive = Platform.OS === 'android'
|
|
11
9
|
? NitroModules.createHybridObject('AndroidAutomotive')
|
package/lib/index.web.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type ViewProps } from 'react-native';
|
|
2
2
|
import type { AndroidAutomotive } from './specs/AndroidAutomotive.nitro';
|
|
3
3
|
import type { AutoPlay } from './specs/AutoPlay.nitro';
|
|
4
4
|
import type { Voice } from './specs/Voice.nitro';
|
|
@@ -44,7 +44,9 @@ export declare enum AutoPlayModules {
|
|
|
44
44
|
CarPlayDashboard = "CarPlayDashboard"
|
|
45
45
|
}
|
|
46
46
|
export declare const useSafeAreaInsets: () => SafeAreaInsets;
|
|
47
|
-
export declare const SafeAreaView: (props: ViewProps) => import("react").
|
|
47
|
+
export declare const SafeAreaView: (props: ViewProps) => import("react").FunctionComponentElement<Omit<ViewProps, "ref"> & {
|
|
48
|
+
ref?: import("react").Ref<import("react-native").ViewInstance> | undefined;
|
|
49
|
+
}>;
|
|
48
50
|
export declare function setIconFont(_name: string, _glyphMap?: Record<string, number>): void;
|
|
49
51
|
export declare const useFocusedEffect: () => void;
|
|
50
52
|
export declare const useVoiceInput: () => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Side-effect-only entry point, re-exported at the package root as `installTimers` (see
|
|
2
|
+
// ../installTimers.ts) for `import '@iternio/react-native-auto-play/installTimers';` as the
|
|
3
|
+
// app's first import. installAutoPlayTimers() itself isn't part of the public API -- funneling
|
|
4
|
+
// installation through this one module is what actually guarantees "runs before anything else
|
|
5
|
+
// captures the original globals" (see the README) instead of just documenting it as a rule
|
|
6
|
+
// callers have to get right.
|
|
7
|
+
import { installAutoPlayTimers } from './utils/AutoPlayTimers';
|
|
8
|
+
installAutoPlayTimers();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -28,9 +28,9 @@ declare class Dashboard {
|
|
|
28
28
|
* @param eventType generic events
|
|
29
29
|
* @returns callback to remove the listener
|
|
30
30
|
*/
|
|
31
|
-
addListener(event: EventName, callback: () => void): import("
|
|
32
|
-
addListenerRenderState(callback: (payload: VisibilityState) => void): import("
|
|
33
|
-
addListenerColorScheme(callback: (payload: ColorScheme) => void): import("
|
|
31
|
+
addListener(event: EventName, callback: () => void): import("..").CleanupCallback;
|
|
32
|
+
addListenerRenderState(callback: (payload: VisibilityState) => void): import("..").CleanupCallback;
|
|
33
|
+
addListenerColorScheme(callback: (payload: ColorScheme) => void): import("..").CleanupCallback;
|
|
34
34
|
}
|
|
35
35
|
export declare const CarPlayDashboard: Dashboard;
|
|
36
36
|
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { HybridObject } from 'react-native-nitro-modules';
|
|
2
|
+
/**
|
|
3
|
+
* Backs setTimeout/setInterval with a scheduler that never pauses -- unlike RN's own JS
|
|
4
|
+
* timers, which RN throttles or pauses whenever the app backgrounds, regardless of whether
|
|
5
|
+
* the process is actually still running.
|
|
6
|
+
*
|
|
7
|
+
* iOS: CarPlay keeps this app's process alive and driving the external screen even when the
|
|
8
|
+
* phone's own screen is off, but RN's own RCTTiming still pauses in that state regardless.
|
|
9
|
+
*
|
|
10
|
+
* Android: JavaTimerManager only keeps ticking while the host is resumed *or* a headless JS
|
|
11
|
+
* task is running -- previously satisfied by registering a permanent no-op headless task
|
|
12
|
+
* (see AutoPlayHeadlessJsTask), which this replaces.
|
|
13
|
+
*
|
|
14
|
+
* All due-time bookkeeping lives here natively (mirroring RCTTiming's/JavaTimerManager's own
|
|
15
|
+
* architecture) so JS only crosses the bridge when a timer actually fires, not on every tick.
|
|
16
|
+
*/
|
|
17
|
+
export interface AutoPlayTiming extends HybridObject<{
|
|
18
|
+
ios: 'swift';
|
|
19
|
+
android: 'kotlin';
|
|
20
|
+
}> {
|
|
21
|
+
/**
|
|
22
|
+
* Schedules `callback` to run after `durationMs`, repeating every `durationMs` if `repeats`
|
|
23
|
+
* is true. Returns an id to pass to `deleteTimer`.
|
|
24
|
+
*/
|
|
25
|
+
createTimer(callback: () => void, durationMs: number, repeats: boolean): number;
|
|
26
|
+
deleteTimer(id: number): void;
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -46,4 +46,9 @@ export declare class SignInTemplate extends Template<SignInTemplateConfig, SignI
|
|
|
46
46
|
* @returns A promise that resolves when the template is updated.
|
|
47
47
|
*/
|
|
48
48
|
updateTemplate(updatedConfig: SignInTemplateUpdateConfig): Promise<void> | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Whether "Sign in with Google" is usable, i.e. Google Play services 23.08+ is installed.
|
|
51
|
+
* Check this before creating a `SignInTemplate` with `GoogleSignIn` — creation throws otherwise.
|
|
52
|
+
*/
|
|
53
|
+
static isGoogleSignInAvailable(): boolean;
|
|
49
54
|
}
|
|
@@ -48,4 +48,11 @@ export class SignInTemplate extends Template {
|
|
|
48
48
|
}
|
|
49
49
|
return HybridSignInTemplate?.updateTemplate(this.id, nitroConfig);
|
|
50
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Whether "Sign in with Google" is usable, i.e. Google Play services 23.08+ is installed.
|
|
53
|
+
* Check this before creating a `SignInTemplate` with `GoogleSignIn` — creation throws otherwise.
|
|
54
|
+
*/
|
|
55
|
+
static isGoogleSignInAvailable() {
|
|
56
|
+
return HybridSignInTemplate?.isGoogleSignInAvailable() ?? false;
|
|
57
|
+
}
|
|
51
58
|
}
|
package/lib/types/Telemetry.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Permission } from 'react-native
|
|
1
|
+
import type { Permission } from 'react-native';
|
|
2
2
|
export type AndroidAutoPermissions = Permission | AndroidAutoTelemetryPermissions | AndroidAutomotiveTelemetryPermissions;
|
|
3
3
|
export declare enum AndroidAutoTelemetryPermissions {
|
|
4
4
|
Speed = "com.google.android.gms.permission.CAR_SPEED",
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replaces the global `setTimeout`/`setInterval`/`clearTimeout`/`clearInterval` and
|
|
3
|
+
* `requestAnimationFrame`/`cancelAnimationFrame` with implementations backed by the native
|
|
4
|
+
* `AutoPlayTiming` module, so they keep running while the app is actively driving a car
|
|
5
|
+
* surface even though the phone itself is backgrounded or its screen is locked. React
|
|
6
|
+
* Native's own timers throttle or pause in that state regardless of whether the process is
|
|
7
|
+
* actually still alive, which would otherwise stall ETA updates and telemetry polling.
|
|
8
|
+
*
|
|
9
|
+
* `requestIdleCallback`/`cancelIdleCallback` are deliberately not covered: bridgeless RN
|
|
10
|
+
* backs those with a separate native module unrelated to `setTimeout`/`requestAnimationFrame`
|
|
11
|
+
* (and its own callback delivery path is an unimplemented stub on iOS), so there is nothing
|
|
12
|
+
* for this library to intercept there.
|
|
13
|
+
*
|
|
14
|
+
* All due-time bookkeeping happens natively -- this is a thin pass-through, so JS only
|
|
15
|
+
* crosses the bridge when a timer actually fires, not on some fixed interval.
|
|
16
|
+
*
|
|
17
|
+
* Call this **once**, as early as possible in your app -- ideally the first line of your
|
|
18
|
+
* entry file, before any other import -- so nothing else has already captured a reference to
|
|
19
|
+
* the original globals. Safe to call more than once; only the first call has any effect.
|
|
20
|
+
*/
|
|
21
|
+
export declare function installAutoPlayTimers(): void;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { HybridAutoPlayTiming } from '../hybrid/HybridAutoPlayTiming';
|
|
2
|
+
let installed = false;
|
|
3
|
+
/**
|
|
4
|
+
* Replaces the global `setTimeout`/`setInterval`/`clearTimeout`/`clearInterval` and
|
|
5
|
+
* `requestAnimationFrame`/`cancelAnimationFrame` with implementations backed by the native
|
|
6
|
+
* `AutoPlayTiming` module, so they keep running while the app is actively driving a car
|
|
7
|
+
* surface even though the phone itself is backgrounded or its screen is locked. React
|
|
8
|
+
* Native's own timers throttle or pause in that state regardless of whether the process is
|
|
9
|
+
* actually still alive, which would otherwise stall ETA updates and telemetry polling.
|
|
10
|
+
*
|
|
11
|
+
* `requestIdleCallback`/`cancelIdleCallback` are deliberately not covered: bridgeless RN
|
|
12
|
+
* backs those with a separate native module unrelated to `setTimeout`/`requestAnimationFrame`
|
|
13
|
+
* (and its own callback delivery path is an unimplemented stub on iOS), so there is nothing
|
|
14
|
+
* for this library to intercept there.
|
|
15
|
+
*
|
|
16
|
+
* All due-time bookkeeping happens natively -- this is a thin pass-through, so JS only
|
|
17
|
+
* crosses the bridge when a timer actually fires, not on some fixed interval.
|
|
18
|
+
*
|
|
19
|
+
* Call this **once**, as early as possible in your app -- ideally the first line of your
|
|
20
|
+
* entry file, before any other import -- so nothing else has already captured a reference to
|
|
21
|
+
* the original globals. Safe to call more than once; only the first call has any effect.
|
|
22
|
+
*/
|
|
23
|
+
export function installAutoPlayTimers() {
|
|
24
|
+
if (installed || HybridAutoPlayTiming == null) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
installed = true;
|
|
28
|
+
const timing = HybridAutoPlayTiming;
|
|
29
|
+
const schedule = (repeats) => (callback, delay, ...args) => timing.createTimer(() => callback(...args), delay ?? 0, repeats);
|
|
30
|
+
const clear = (id) => {
|
|
31
|
+
if (typeof id === 'number') {
|
|
32
|
+
timing.deleteTimer(id);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
globalThis.setTimeout = schedule(false);
|
|
36
|
+
globalThis.setInterval = schedule(true);
|
|
37
|
+
globalThis.clearTimeout = clear;
|
|
38
|
+
globalThis.clearInterval = clear;
|
|
39
|
+
// Mirrors bridgeless RN's own implementation: requestAnimationFrame is setTimeout(0) with
|
|
40
|
+
// a performance.now() timestamp handed to the callback, and cancelAnimationFrame deletes
|
|
41
|
+
// the same underlying timer clearTimeout would.
|
|
42
|
+
const now = () => globalThis.performance?.now() ?? Date.now();
|
|
43
|
+
globalThis.requestAnimationFrame = ((callback) => timing.createTimer(() => callback(now()), 0, false));
|
|
44
|
+
globalThis.cancelAnimationFrame = clear;
|
|
45
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type ImageResolvedAssetSource } from 'react-native';
|
|
2
1
|
import type { AutoImage } from '../types/Image';
|
|
3
2
|
import { type NitroColor } from './NitroColor';
|
|
4
3
|
/**
|
|
@@ -22,7 +21,11 @@ import { type NitroColor } from './NitroColor';
|
|
|
22
21
|
* ```
|
|
23
22
|
*/
|
|
24
23
|
export declare function setIconFont(name: string, glyphMap?: Record<string, number>): void;
|
|
25
|
-
interface AssetImage
|
|
24
|
+
interface AssetImage {
|
|
25
|
+
uri: string;
|
|
26
|
+
width: number;
|
|
27
|
+
height: number;
|
|
28
|
+
scale: number;
|
|
26
29
|
color?: NitroColor;
|
|
27
30
|
packager_asset: boolean;
|
|
28
31
|
}
|
package/lib/utils/NitroImage.js
CHANGED
|
@@ -79,7 +79,7 @@ function convert(image) {
|
|
|
79
79
|
// so the input allows all optional parameters which are returned as is even though
|
|
80
80
|
// the return type claims to not have any optional parameters...
|
|
81
81
|
// we specify some default values to not crash because of proper typing required by nitro-modules
|
|
82
|
-
const { height = 0, scale = 0, uri, width = 0, ...rest } = Image.resolveAssetSource(image.image);
|
|
82
|
+
const { height = 0, scale = 0, uri = '', width = 0, ...rest } = Image.resolveAssetSource(image.image) ?? {};
|
|
83
83
|
const assetImage = {
|
|
84
84
|
height,
|
|
85
85
|
scale,
|
|
@@ -10,7 +10,7 @@ const SafeAreaView = (props) => {
|
|
|
10
10
|
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: [
|
|
11
11
|
style,
|
|
12
12
|
{
|
|
13
|
-
...react_native_1.StyleSheet.
|
|
13
|
+
...react_native_1.StyleSheet.absoluteFill,
|
|
14
14
|
paddingTop: safeAreaInsets.top,
|
|
15
15
|
paddingBottom: safeAreaInsets.bottom,
|
|
16
16
|
paddingRight: safeAreaInsets.right,
|
|
@@ -8,8 +8,8 @@ const _native = react_native_nitro_modules_1.NitroModules.createHybridObject('Vo
|
|
|
8
8
|
const startVoiceInput = async (options) => {
|
|
9
9
|
const { onChunk, silenceThresholdMs, maxDurationMs, listeningText, listeningImage, preferSpeechToText, language, startSound, endSound, encoding, } = options ?? {};
|
|
10
10
|
const listeningImageRepeats = listeningImage?.type === 'asset' ? listeningImage.repeats : undefined;
|
|
11
|
-
const startSoundUri = startSound != null ? react_native_1.Image.resolveAssetSource(startSound)
|
|
12
|
-
const endSoundUri = endSound != null ? react_native_1.Image.resolveAssetSource(endSound)
|
|
11
|
+
const startSoundUri = startSound != null ? react_native_1.Image.resolveAssetSource(startSound)?.uri : undefined;
|
|
12
|
+
const endSoundUri = endSound != null ? react_native_1.Image.resolveAssetSource(endSound)?.uri : undefined;
|
|
13
13
|
return await _native.startVoiceInput(silenceThresholdMs, maxDurationMs, listeningText, NitroImage_1.NitroImageUtil.convert(listeningImage), listeningImageRepeats, preferSpeechToText, onChunk, language, startSoundUri, endSoundUri, encoding);
|
|
14
14
|
};
|
|
15
15
|
exports.HybridVoice = {
|
package/lib-cjs/index.js
CHANGED
|
@@ -13,14 +13,10 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
-
};
|
|
19
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
17
|
exports.setIconFont = exports.CarUxRestrictions = exports.AutoPlayModules = exports.HybridAndroidAutomotive = exports.HybridVoice = exports.HybridAutoPlay = exports.HybridAndroidWindowInformation = exports.HybridAndroidAutoTelemetry = void 0;
|
|
21
18
|
const react_native_1 = require("react-native");
|
|
22
19
|
const react_native_nitro_modules_1 = require("react-native-nitro-modules");
|
|
23
|
-
const AutoPlayHeadlessJsTask_1 = __importDefault(require("./AutoPlayHeadlessJsTask"));
|
|
24
20
|
const HybridAndroidAutoTelemetry_1 = require("./hybrid/HybridAndroidAutoTelemetry");
|
|
25
21
|
Object.defineProperty(exports, "HybridAndroidAutoTelemetry", { enumerable: true, get: function () { return HybridAndroidAutoTelemetry_1.HybridAndroidAutoTelemetry; } });
|
|
26
22
|
const HybridAndroidWindowInformation_1 = require("./hybrid/HybridAndroidWindowInformation");
|
|
@@ -29,7 +25,6 @@ const HybridAutoPlay_1 = require("./hybrid/HybridAutoPlay");
|
|
|
29
25
|
Object.defineProperty(exports, "HybridAutoPlay", { enumerable: true, get: function () { return HybridAutoPlay_1.HybridAutoPlay; } });
|
|
30
26
|
const HybridVoice_1 = require("./hybrid/HybridVoice");
|
|
31
27
|
Object.defineProperty(exports, "HybridVoice", { enumerable: true, get: function () { return HybridVoice_1.HybridVoice; } });
|
|
32
|
-
AutoPlayHeadlessJsTask_1.default.registerHeadlessTask(HybridAutoPlay_1.HybridAutoPlay);
|
|
33
28
|
exports.HybridAndroidAutomotive = react_native_1.Platform.OS === 'android'
|
|
34
29
|
? react_native_nitro_modules_1.NitroModules.createHybridObject('AndroidAutomotive')
|
|
35
30
|
: null;
|
|
@@ -51,5 +51,12 @@ class SignInTemplate extends Template_1.Template {
|
|
|
51
51
|
}
|
|
52
52
|
return exports.HybridSignInTemplate?.updateTemplate(this.id, nitroConfig);
|
|
53
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Whether "Sign in with Google" is usable, i.e. Google Play services 23.08+ is installed.
|
|
56
|
+
* Check this before creating a `SignInTemplate` with `GoogleSignIn` — creation throws otherwise.
|
|
57
|
+
*/
|
|
58
|
+
static isGoogleSignInAvailable() {
|
|
59
|
+
return exports.HybridSignInTemplate?.isGoogleSignInAvailable() ?? false;
|
|
60
|
+
}
|
|
54
61
|
}
|
|
55
62
|
exports.SignInTemplate = SignInTemplate;
|
|
@@ -83,7 +83,7 @@ function convert(image) {
|
|
|
83
83
|
// so the input allows all optional parameters which are returned as is even though
|
|
84
84
|
// the return type claims to not have any optional parameters...
|
|
85
85
|
// we specify some default values to not crash because of proper typing required by nitro-modules
|
|
86
|
-
const { height = 0, scale = 0, uri, width = 0, ...rest } = react_native_1.Image.resolveAssetSource(image.image);
|
|
86
|
+
const { height = 0, scale = 0, uri = '', width = 0, ...rest } = react_native_1.Image.resolveAssetSource(image.image) ?? {};
|
|
87
87
|
const assetImage = {
|
|
88
88
|
height,
|
|
89
89
|
scale,
|
package/nitro.json
CHANGED
|
@@ -119,6 +119,16 @@
|
|
|
119
119
|
"language": "swift"
|
|
120
120
|
}
|
|
121
121
|
},
|
|
122
|
+
"AutoPlayTiming": {
|
|
123
|
+
"android": {
|
|
124
|
+
"implementationClassName": "HybridAutoPlayTiming",
|
|
125
|
+
"language": "kotlin"
|
|
126
|
+
},
|
|
127
|
+
"ios": {
|
|
128
|
+
"implementationClassName": "HybridAutoPlayTiming",
|
|
129
|
+
"language": "swift"
|
|
130
|
+
}
|
|
131
|
+
},
|
|
122
132
|
"Cluster": {
|
|
123
133
|
"android": {
|
|
124
134
|
"implementationClassName": "HybridCluster",
|
|
@@ -37,6 +37,7 @@ target_sources(
|
|
|
37
37
|
../nitrogen/generated/shared/c++/HybridAndroidAutoTelemetrySpec.cpp
|
|
38
38
|
../nitrogen/generated/shared/c++/HybridAndroidWindowInformationSpec.cpp
|
|
39
39
|
../nitrogen/generated/shared/c++/HybridAutoPlaySpec.cpp
|
|
40
|
+
../nitrogen/generated/shared/c++/HybridAutoPlayTimingSpec.cpp
|
|
40
41
|
../nitrogen/generated/shared/c++/HybridCarPlayDashboardSpec.cpp
|
|
41
42
|
../nitrogen/generated/shared/c++/HybridClusterSpec.cpp
|
|
42
43
|
../nitrogen/generated/shared/c++/HybridGridTemplateSpec.cpp
|
|
@@ -53,6 +54,7 @@ target_sources(
|
|
|
53
54
|
../nitrogen/generated/android/c++/JHybridAndroidWindowInformationSpec.cpp
|
|
54
55
|
../nitrogen/generated/android/c++/JHybridAutoPlaySpec.cpp
|
|
55
56
|
../nitrogen/generated/android/c++/JVariant_GlyphImage_AssetImage_RemoteImage.cpp
|
|
57
|
+
../nitrogen/generated/android/c++/JHybridAutoPlayTimingSpec.cpp
|
|
56
58
|
../nitrogen/generated/android/c++/JHybridClusterSpec.cpp
|
|
57
59
|
../nitrogen/generated/android/c++/JNitroImage.cpp
|
|
58
60
|
../nitrogen/generated/android/c++/JHybridGridTemplateSpec.cpp
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
#include "JFunc_void_VisibilityState.hpp"
|
|
28
28
|
#include "JFunc_void_std__optional_Location__std__optional_std__string_.hpp"
|
|
29
29
|
#include "JFunc_void_SafeAreaInsets.hpp"
|
|
30
|
+
#include "JHybridAutoPlayTimingSpec.hpp"
|
|
30
31
|
#include "JHybridClusterSpec.hpp"
|
|
31
32
|
#include "JFunc_void_std__string.hpp"
|
|
32
33
|
#include "JFunc_void_std__string_ColorScheme.hpp"
|
|
@@ -156,6 +157,14 @@ struct JHybridSearchTemplateSpecImpl: public jni::JavaClass<JHybridSearchTemplat
|
|
|
156
157
|
return javaPart->getJHybridSearchTemplateSpec();
|
|
157
158
|
}
|
|
158
159
|
};
|
|
160
|
+
struct JHybridAutoPlayTimingSpecImpl: public jni::JavaClass<JHybridAutoPlayTimingSpecImpl, JHybridAutoPlayTimingSpec::JavaPart> {
|
|
161
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/swe/iternio/reactnativeautoplay/HybridAutoPlayTiming;";
|
|
162
|
+
static std::shared_ptr<JHybridAutoPlayTimingSpec> create() {
|
|
163
|
+
static const auto constructorFn = javaClassStatic()->getConstructor<JHybridAutoPlayTimingSpecImpl::javaobject()>();
|
|
164
|
+
jni::local_ref<JHybridAutoPlayTimingSpec::JavaPart> javaPart = javaClassStatic()->newObject(constructorFn);
|
|
165
|
+
return javaPart->getJHybridAutoPlayTimingSpec();
|
|
166
|
+
}
|
|
167
|
+
};
|
|
159
168
|
struct JHybridClusterSpecImpl: public jni::JavaClass<JHybridClusterSpecImpl, JHybridClusterSpec::JavaPart> {
|
|
160
169
|
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/swe/iternio/reactnativeautoplay/HybridCluster;";
|
|
161
170
|
static std::shared_ptr<JHybridClusterSpec> create() {
|
|
@@ -182,6 +191,7 @@ void registerAllNatives() {
|
|
|
182
191
|
margelo::nitro::swe::iternio::reactnativeautoplay::JFunc_void_VisibilityState_cxx::registerNatives();
|
|
183
192
|
margelo::nitro::swe::iternio::reactnativeautoplay::JFunc_void_std__optional_Location__std__optional_std__string__cxx::registerNatives();
|
|
184
193
|
margelo::nitro::swe::iternio::reactnativeautoplay::JFunc_void_SafeAreaInsets_cxx::registerNatives();
|
|
194
|
+
margelo::nitro::swe::iternio::reactnativeautoplay::JHybridAutoPlayTimingSpec::CxxPart::registerNatives();
|
|
185
195
|
margelo::nitro::swe::iternio::reactnativeautoplay::JHybridClusterSpec::CxxPart::registerNatives();
|
|
186
196
|
margelo::nitro::swe::iternio::reactnativeautoplay::JFunc_void_std__string_cxx::registerNatives();
|
|
187
197
|
margelo::nitro::swe::iternio::reactnativeautoplay::JFunc_void_std__string_ColorScheme_cxx::registerNatives();
|
|
@@ -279,6 +289,12 @@ void registerAllNatives() {
|
|
|
279
289
|
return JHybridSearchTemplateSpecImpl::create();
|
|
280
290
|
}
|
|
281
291
|
);
|
|
292
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
293
|
+
"AutoPlayTiming",
|
|
294
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
295
|
+
return JHybridAutoPlayTimingSpecImpl::create();
|
|
296
|
+
}
|
|
297
|
+
);
|
|
282
298
|
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
283
299
|
"Cluster",
|
|
284
300
|
[]() -> std::shared_ptr<HybridObject> {
|
|
@@ -19,7 +19,7 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
|
|
|
19
19
|
using namespace facebook;
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
* The C++ JNI bridge between the C++ struct "ActiveCarUxRestrictions" and the
|
|
22
|
+
* The C++ JNI bridge between the C++ struct "ActiveCarUxRestrictions" and the Kotlin data class "ActiveCarUxRestrictions".
|
|
23
23
|
*/
|
|
24
24
|
struct JActiveCarUxRestrictions final: public jni::JavaClass<JActiveCarUxRestrictions> {
|
|
25
25
|
public:
|
|
@@ -15,7 +15,7 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
|
|
|
15
15
|
using namespace facebook;
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* The C++ JNI bridge between the C++ enum "AlertActionStyle" and the
|
|
18
|
+
* The C++ JNI bridge between the C++ enum "AlertActionStyle" and the Kotlin enum "AlertActionStyle".
|
|
19
19
|
*/
|
|
20
20
|
struct JAlertActionStyle final: public jni::JavaClass<JAlertActionStyle> {
|
|
21
21
|
public:
|
|
@@ -15,7 +15,7 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
|
|
|
15
15
|
using namespace facebook;
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* The C++ JNI bridge between the C++ enum "AlertDismissalReason" and the
|
|
18
|
+
* The C++ JNI bridge between the C++ enum "AlertDismissalReason" and the Kotlin enum "AlertDismissalReason".
|
|
19
19
|
*/
|
|
20
20
|
struct JAlertDismissalReason final: public jni::JavaClass<JAlertDismissalReason> {
|
|
21
21
|
public:
|
|
@@ -17,7 +17,7 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
|
|
|
17
17
|
using namespace facebook;
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* The C++ JNI bridge between the C++ struct "AppFocusState" and the
|
|
20
|
+
* The C++ JNI bridge between the C++ struct "AppFocusState" and the Kotlin data class "AppFocusState".
|
|
21
21
|
*/
|
|
22
22
|
struct JAppFocusState final: public jni::JavaClass<JAppFocusState> {
|
|
23
23
|
public:
|