@iternio/react-native-auto-play 0.4.7 → 0.4.9

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 (80) hide show
  1. package/README.md +26 -0
  2. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridAutoPlay.kt +4 -89
  3. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridVoice.kt +97 -0
  4. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/VoiceInputManager.kt +286 -20
  5. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/utils/ThreadUtil.kt +6 -13
  6. package/ios/hybrid/HybridAutoPlay.swift +6 -47
  7. package/ios/hybrid/HybridVoice.swift +65 -0
  8. package/ios/utils/VoiceInputManager.swift +144 -40
  9. package/lib/HybridAutoPlay.d.ts +2 -0
  10. package/lib/HybridAutoPlay.js +2 -0
  11. package/lib/components/OnAppearedChildRenderer.d.ts +10 -0
  12. package/lib/components/OnAppearedChildRenderer.js +26 -0
  13. package/lib/hooks/useIsAutoPlayFocused.d.ts +7 -0
  14. package/lib/hooks/useIsAutoPlayFocused.js +20 -0
  15. package/lib/hybrid/HybridVoice.d.ts +52 -0
  16. package/lib/hybrid/HybridVoice.js +52 -0
  17. package/lib/hybrid.d.ts +2 -0
  18. package/lib/hybrid.js +2 -0
  19. package/lib/index.d.ts +3 -1
  20. package/lib/index.js +2 -1
  21. package/lib/scenes/CarPlayDashboardScene.d.ts +1 -0
  22. package/lib/scenes/CarPlayDashboardScene.js +13 -7
  23. package/lib/specs/AutoPlay.nitro.d.ts +6 -29
  24. package/lib/specs/AutomotivePermissionRequestTemplate.d.ts +11 -0
  25. package/lib/specs/AutomotivePermissionRequestTemplate.js +1 -0
  26. package/lib/specs/AutomotivePermissionRequestTemplate.nitro.d.ts +11 -0
  27. package/lib/specs/AutomotivePermissionRequestTemplate.nitro.js +1 -0
  28. package/lib/specs/Voice.nitro.d.ts +11 -0
  29. package/lib/specs/Voice.nitro.js +1 -0
  30. package/lib/templates/AutomotivePermissionRequestTemplate.d.ts +23 -0
  31. package/lib/templates/AutomotivePermissionRequestTemplate.js +18 -0
  32. package/lib/types/Glyphmap.d.ts +4105 -0
  33. package/lib/types/Glyphmap.js +4105 -0
  34. package/lib/types/Voice.d.ts +16 -0
  35. package/lib/types/Voice.js +1 -0
  36. package/nitro.json +10 -0
  37. package/nitrogen/generated/android/ReactNativeAutoPlay+autolinking.cmake +2 -0
  38. package/nitrogen/generated/android/ReactNativeAutoPlayOnLoad.cpp +18 -0
  39. package/nitrogen/generated/android/c++/JFunc_void_VoiceInputChunk.hpp +81 -0
  40. package/nitrogen/generated/android/c++/JHybridAutoPlaySpec.cpp +5 -43
  41. package/nitrogen/generated/android/c++/JHybridAutoPlaySpec.hpp +1 -4
  42. package/nitrogen/generated/android/c++/JHybridVoiceSpec.cpp +104 -0
  43. package/nitrogen/generated/android/c++/JHybridVoiceSpec.hpp +66 -0
  44. package/nitrogen/generated/android/c++/JVoiceInputChunk.hpp +64 -0
  45. package/nitrogen/generated/android/c++/JVoiceInputResult.hpp +64 -0
  46. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_VoiceInputChunk.kt +80 -0
  47. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridAutoPlaySpec.kt +4 -17
  48. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridVoiceSpec.kt +72 -0
  49. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/VoiceInputChunk.kt +41 -0
  50. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/VoiceInputResult.kt +41 -0
  51. package/nitrogen/generated/ios/ReactNativeAutoPlay-Swift-Cxx-Bridge.cpp +41 -16
  52. package/nitrogen/generated/ios/ReactNativeAutoPlay-Swift-Cxx-Bridge.hpp +201 -126
  53. package/nitrogen/generated/ios/ReactNativeAutoPlay-Swift-Cxx-Umbrella.hpp +11 -0
  54. package/nitrogen/generated/ios/ReactNativeAutoPlayAutolinking.mm +8 -0
  55. package/nitrogen/generated/ios/ReactNativeAutoPlayAutolinking.swift +12 -0
  56. package/nitrogen/generated/ios/c++/HybridAutoPlaySpecSwift.hpp +8 -34
  57. package/nitrogen/generated/ios/c++/HybridVoiceSpecSwift.cpp +11 -0
  58. package/nitrogen/generated/ios/c++/HybridVoiceSpecSwift.hpp +116 -0
  59. package/nitrogen/generated/ios/swift/Func_void_VoiceInputChunk.swift +46 -0
  60. package/nitrogen/generated/ios/swift/{Func_void_std__shared_ptr_ArrayBuffer_.swift → Func_void_VoiceInputResult.swift} +10 -10
  61. package/nitrogen/generated/ios/swift/Func_void_bool.swift +5 -5
  62. package/nitrogen/generated/ios/swift/HybridAutoPlaySpec.swift +1 -4
  63. package/nitrogen/generated/ios/swift/HybridAutoPlaySpec_cxx.swift +12 -82
  64. package/nitrogen/generated/ios/swift/HybridVoiceSpec.swift +58 -0
  65. package/nitrogen/generated/ios/swift/HybridVoiceSpec_cxx.swift +234 -0
  66. package/nitrogen/generated/ios/swift/VoiceInputChunk.swift +60 -0
  67. package/nitrogen/generated/ios/swift/VoiceInputResult.swift +60 -0
  68. package/nitrogen/generated/shared/c++/HybridAutoPlaySpec.cpp +1 -4
  69. package/nitrogen/generated/shared/c++/HybridAutoPlaySpec.hpp +1 -5
  70. package/nitrogen/generated/shared/c++/HybridVoiceSpec.cpp +24 -0
  71. package/nitrogen/generated/shared/c++/HybridVoiceSpec.hpp +73 -0
  72. package/nitrogen/generated/shared/c++/VoiceInputChunk.hpp +89 -0
  73. package/nitrogen/generated/shared/c++/VoiceInputResult.hpp +89 -0
  74. package/package.json +1 -1
  75. package/src/hybrid/HybridVoice.ts +79 -0
  76. package/src/index.ts +3 -1
  77. package/src/scenes/CarPlayDashboardScene.ts +18 -11
  78. package/src/specs/AutoPlay.nitro.ts +7 -37
  79. package/src/specs/Voice.nitro.ts +16 -0
  80. package/src/types/Voice.ts +18 -0
@@ -11,7 +11,6 @@ import androidx.annotation.Keep
11
11
  import com.facebook.jni.HybridData
12
12
  import com.facebook.proguard.annotations.DoNotStrip
13
13
  import com.margelo.nitro.core.Promise
14
- import com.margelo.nitro.core.ArrayBuffer
15
14
  import com.margelo.nitro.core.HybridObject
16
15
 
17
16
  /**
@@ -57,22 +56,6 @@ abstract class HybridAutoPlaySpec: HybridObject() {
57
56
  return Func_void_java(__result)
58
57
  }
59
58
 
60
- @DoNotStrip
61
- @Keep
62
- abstract fun hasVoiceInputPermission(): Boolean
63
-
64
- @DoNotStrip
65
- @Keep
66
- abstract fun requestVoiceInputPermission(): Promise<Boolean>
67
-
68
- @DoNotStrip
69
- @Keep
70
- abstract fun startVoiceInput(silenceThresholdMs: Double?, maxDurationMs: Double?, listeningText: String?): Promise<ArrayBuffer>
71
-
72
- @DoNotStrip
73
- @Keep
74
- abstract fun stopVoiceInput(): Unit
75
-
76
59
  @DoNotStrip
77
60
  @Keep
78
61
  abstract fun setRootTemplate(templateId: String): Promise<Unit>
@@ -109,6 +92,10 @@ abstract class HybridAutoPlaySpec: HybridObject() {
109
92
  @DoNotStrip
110
93
  @Keep
111
94
  abstract fun isConnected(): Boolean
95
+
96
+ @DoNotStrip
97
+ @Keep
98
+ abstract fun isCarServiceRunning(): Boolean
112
99
 
113
100
  // Default implementation of `HybridObject.toString()`
114
101
  override fun toString(): String {
@@ -0,0 +1,72 @@
1
+ ///
2
+ /// HybridVoiceSpec.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.swe.iternio.reactnativeautoplay
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.jni.HybridData
12
+ import com.facebook.proguard.annotations.DoNotStrip
13
+ import com.margelo.nitro.core.Promise
14
+ import com.margelo.nitro.core.HybridObject
15
+
16
+ /**
17
+ * A Kotlin class representing the Voice HybridObject.
18
+ * Implement this abstract class to create Kotlin-based instances of Voice.
19
+ */
20
+ @DoNotStrip
21
+ @Keep
22
+ @Suppress(
23
+ "KotlinJniMissingFunction", "unused",
24
+ "RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
25
+ "LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
26
+ )
27
+ abstract class HybridVoiceSpec: HybridObject() {
28
+ // Properties
29
+
30
+
31
+ // Methods
32
+ @DoNotStrip
33
+ @Keep
34
+ abstract fun hasVoiceInputPermission(): Boolean
35
+
36
+ @DoNotStrip
37
+ @Keep
38
+ abstract fun requestVoiceInputPermission(): Promise<Boolean>
39
+
40
+ abstract fun startVoiceInput(silenceThresholdMs: Double?, maxDurationMs: Double?, listeningText: String?, preferSpeechToText: Boolean?, onChunk: ((chunk: VoiceInputChunk) -> Unit)?, language: String?): Promise<VoiceInputResult>
41
+
42
+ @DoNotStrip
43
+ @Keep
44
+ private fun startVoiceInput_cxx(silenceThresholdMs: Double?, maxDurationMs: Double?, listeningText: String?, preferSpeechToText: Boolean?, onChunk: Func_void_VoiceInputChunk?, language: String?): Promise<VoiceInputResult> {
45
+ val __result = startVoiceInput(silenceThresholdMs, maxDurationMs, listeningText, preferSpeechToText, onChunk?.let { it }, language)
46
+ return __result
47
+ }
48
+
49
+ @DoNotStrip
50
+ @Keep
51
+ abstract fun stopVoiceInput(): Unit
52
+
53
+ // Default implementation of `HybridObject.toString()`
54
+ override fun toString(): String {
55
+ return "[HybridObject Voice]"
56
+ }
57
+
58
+ // C++ backing class
59
+ @DoNotStrip
60
+ @Keep
61
+ protected open class CxxPart(javaPart: HybridVoiceSpec): HybridObject.CxxPart(javaPart) {
62
+ // C++ JHybridVoiceSpec::CxxPart::initHybrid(...)
63
+ external override fun initHybrid(): HybridData
64
+ }
65
+ override fun createCxxPart(): CxxPart {
66
+ return CxxPart(this)
67
+ }
68
+
69
+ companion object {
70
+ protected const val TAG = "HybridVoiceSpec"
71
+ }
72
+ }
@@ -0,0 +1,41 @@
1
+ ///
2
+ /// VoiceInputChunk.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.swe.iternio.reactnativeautoplay
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+ import com.margelo.nitro.core.ArrayBuffer
13
+
14
+ /**
15
+ * Represents the JavaScript object/struct "VoiceInputChunk".
16
+ */
17
+ @DoNotStrip
18
+ @Keep
19
+ data class VoiceInputChunk(
20
+ @DoNotStrip
21
+ @Keep
22
+ val partial: String?,
23
+ @DoNotStrip
24
+ @Keep
25
+ val audio: ArrayBuffer?
26
+ ) {
27
+ /* primary constructor */
28
+
29
+ companion object {
30
+ /**
31
+ * Constructor called from C++
32
+ */
33
+ @DoNotStrip
34
+ @Keep
35
+ @Suppress("unused")
36
+ @JvmStatic
37
+ private fun fromCpp(partial: String?, audio: ArrayBuffer?): VoiceInputChunk {
38
+ return VoiceInputChunk(partial, audio)
39
+ }
40
+ }
41
+ }
@@ -0,0 +1,41 @@
1
+ ///
2
+ /// VoiceInputResult.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.swe.iternio.reactnativeautoplay
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+ import com.margelo.nitro.core.ArrayBuffer
13
+
14
+ /**
15
+ * Represents the JavaScript object/struct "VoiceInputResult".
16
+ */
17
+ @DoNotStrip
18
+ @Keep
19
+ data class VoiceInputResult(
20
+ @DoNotStrip
21
+ @Keep
22
+ val transcription: String?,
23
+ @DoNotStrip
24
+ @Keep
25
+ val audio: ArrayBuffer?
26
+ ) {
27
+ /* primary constructor */
28
+
29
+ companion object {
30
+ /**
31
+ * Constructor called from C++
32
+ */
33
+ @DoNotStrip
34
+ @Keep
35
+ @Suppress("unused")
36
+ @JvmStatic
37
+ private fun fromCpp(transcription: String?, audio: ArrayBuffer?): VoiceInputResult {
38
+ return VoiceInputResult(transcription, audio)
39
+ }
40
+ }
41
+ }
@@ -17,6 +17,7 @@
17
17
  #include "HybridMapTemplateSpecSwift.hpp"
18
18
  #include "HybridMessageTemplateSpecSwift.hpp"
19
19
  #include "HybridSearchTemplateSpecSwift.hpp"
20
+ #include "HybridVoiceSpecSwift.hpp"
20
21
  #include "ReactNativeAutoPlay-Swift-Cxx-Umbrella.hpp"
21
22
  #include <NitroModules/NitroDefines.hpp>
22
23
 
@@ -46,14 +47,6 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay::bridge::swift {
46
47
  };
47
48
  }
48
49
 
49
- // pragma MARK: std::function<void(bool /* result */)>
50
- Func_void_bool create_Func_void_bool(void* NON_NULL swiftClosureWrapper) noexcept {
51
- auto swiftClosure = ReactNativeAutoPlay::Func_void_bool::fromUnsafe(swiftClosureWrapper);
52
- return [swiftClosure = std::move(swiftClosure)](bool result) mutable -> void {
53
- swiftClosure.call(result);
54
- };
55
- }
56
-
57
50
  // pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
58
51
  Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept {
59
52
  auto swiftClosure = ReactNativeAutoPlay::Func_void_std__exception_ptr::fromUnsafe(swiftClosureWrapper);
@@ -62,14 +55,6 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay::bridge::swift {
62
55
  };
63
56
  }
64
57
 
65
- // pragma MARK: std::function<void(const std::shared_ptr<ArrayBuffer>& /* result */)>
66
- Func_void_std__shared_ptr_ArrayBuffer_ create_Func_void_std__shared_ptr_ArrayBuffer_(void* NON_NULL swiftClosureWrapper) noexcept {
67
- auto swiftClosure = ReactNativeAutoPlay::Func_void_std__shared_ptr_ArrayBuffer_::fromUnsafe(swiftClosureWrapper);
68
- return [swiftClosure = std::move(swiftClosure)](const std::shared_ptr<ArrayBuffer>& result) mutable -> void {
69
- swiftClosure.call(ArrayBufferHolder(result));
70
- };
71
- }
72
-
73
58
  // pragma MARK: std::function<void(const SafeAreaInsets& /* insets */)>
74
59
  Func_void_SafeAreaInsets create_Func_void_SafeAreaInsets(void* NON_NULL swiftClosureWrapper) noexcept {
75
60
  auto swiftClosure = ReactNativeAutoPlay::Func_void_SafeAreaInsets::fromUnsafe(swiftClosureWrapper);
@@ -174,6 +159,14 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay::bridge::swift {
174
159
  };
175
160
  }
176
161
 
162
+ // pragma MARK: std::function<void(bool /* isPanningInterfaceVisible */)>
163
+ Func_void_bool create_Func_void_bool(void* NON_NULL swiftClosureWrapper) noexcept {
164
+ auto swiftClosure = ReactNativeAutoPlay::Func_void_bool::fromUnsafe(swiftClosureWrapper);
165
+ return [swiftClosure = std::move(swiftClosure)](bool isPanningInterfaceVisible) mutable -> void {
166
+ swiftClosure.call(isPanningInterfaceVisible);
167
+ };
168
+ }
169
+
177
170
  // pragma MARK: std::shared_ptr<HybridGridTemplateSpec>
178
171
  std::shared_ptr<HybridGridTemplateSpec> create_std__shared_ptr_HybridGridTemplateSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
179
172
  ReactNativeAutoPlay::HybridGridTemplateSpec_cxx swiftPart = ReactNativeAutoPlay::HybridGridTemplateSpec_cxx::fromUnsafe(swiftUnsafePointer);
@@ -309,5 +302,37 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay::bridge::swift {
309
302
  ReactNativeAutoPlay::HybridSearchTemplateSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
310
303
  return swiftPart.toUnsafe();
311
304
  }
305
+
306
+ // pragma MARK: std::function<void(const VoiceInputResult& /* result */)>
307
+ Func_void_VoiceInputResult create_Func_void_VoiceInputResult(void* NON_NULL swiftClosureWrapper) noexcept {
308
+ auto swiftClosure = ReactNativeAutoPlay::Func_void_VoiceInputResult::fromUnsafe(swiftClosureWrapper);
309
+ return [swiftClosure = std::move(swiftClosure)](const VoiceInputResult& result) mutable -> void {
310
+ swiftClosure.call(result);
311
+ };
312
+ }
313
+
314
+ // pragma MARK: std::function<void(const VoiceInputChunk& /* chunk */)>
315
+ Func_void_VoiceInputChunk create_Func_void_VoiceInputChunk(void* NON_NULL swiftClosureWrapper) noexcept {
316
+ auto swiftClosure = ReactNativeAutoPlay::Func_void_VoiceInputChunk::fromUnsafe(swiftClosureWrapper);
317
+ return [swiftClosure = std::move(swiftClosure)](const VoiceInputChunk& chunk) mutable -> void {
318
+ swiftClosure.call(chunk);
319
+ };
320
+ }
321
+
322
+ // pragma MARK: std::shared_ptr<HybridVoiceSpec>
323
+ std::shared_ptr<HybridVoiceSpec> create_std__shared_ptr_HybridVoiceSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
324
+ ReactNativeAutoPlay::HybridVoiceSpec_cxx swiftPart = ReactNativeAutoPlay::HybridVoiceSpec_cxx::fromUnsafe(swiftUnsafePointer);
325
+ return std::make_shared<margelo::nitro::swe::iternio::reactnativeautoplay::HybridVoiceSpecSwift>(swiftPart);
326
+ }
327
+ void* NON_NULL get_std__shared_ptr_HybridVoiceSpec_(std__shared_ptr_HybridVoiceSpec_ cppType) {
328
+ std::shared_ptr<margelo::nitro::swe::iternio::reactnativeautoplay::HybridVoiceSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::swe::iternio::reactnativeautoplay::HybridVoiceSpecSwift>(cppType);
329
+ #ifdef NITRO_DEBUG
330
+ if (swiftWrapper == nullptr) [[unlikely]] {
331
+ throw std::runtime_error("Class \"HybridVoiceSpec\" is not implemented in Swift!");
332
+ }
333
+ #endif
334
+ ReactNativeAutoPlay::HybridVoiceSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
335
+ return swiftPart.toUnsafe();
336
+ }
312
337
 
313
338
  } // namespace margelo::nitro::swe::iternio::reactnativeautoplay::bridge::swift