@iternio/react-native-auto-play 0.4.11 → 0.4.12

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 (77) hide show
  1. package/README.md +26 -0
  2. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridAutoPlay.kt +0 -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 +2 -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/specs/AutoPlay.nitro.d.ts +0 -29
  22. package/lib/specs/AutomotivePermissionRequestTemplate.d.ts +11 -0
  23. package/lib/specs/AutomotivePermissionRequestTemplate.js +1 -0
  24. package/lib/specs/AutomotivePermissionRequestTemplate.nitro.d.ts +11 -0
  25. package/lib/specs/AutomotivePermissionRequestTemplate.nitro.js +1 -0
  26. package/lib/specs/Voice.nitro.d.ts +11 -0
  27. package/lib/specs/Voice.nitro.js +1 -0
  28. package/lib/templates/AutomotivePermissionRequestTemplate.d.ts +23 -0
  29. package/lib/templates/AutomotivePermissionRequestTemplate.js +18 -0
  30. package/lib/types/Glyphmap.d.ts +4105 -0
  31. package/lib/types/Glyphmap.js +4105 -0
  32. package/lib/types/Voice.d.ts +16 -0
  33. package/lib/types/Voice.js +1 -0
  34. package/nitro.json +10 -0
  35. package/nitrogen/generated/android/ReactNativeAutoPlay+autolinking.cmake +2 -0
  36. package/nitrogen/generated/android/ReactNativeAutoPlayOnLoad.cpp +18 -0
  37. package/nitrogen/generated/android/c++/JFunc_void_VoiceInputChunk.hpp +81 -0
  38. package/nitrogen/generated/android/c++/JHybridAutoPlaySpec.cpp +0 -43
  39. package/nitrogen/generated/android/c++/JHybridAutoPlaySpec.hpp +0 -4
  40. package/nitrogen/generated/android/c++/JHybridVoiceSpec.cpp +104 -0
  41. package/nitrogen/generated/android/c++/JHybridVoiceSpec.hpp +66 -0
  42. package/nitrogen/generated/android/c++/JVoiceInputChunk.hpp +64 -0
  43. package/nitrogen/generated/android/c++/JVoiceInputResult.hpp +64 -0
  44. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_VoiceInputChunk.kt +80 -0
  45. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridAutoPlaySpec.kt +0 -17
  46. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridVoiceSpec.kt +72 -0
  47. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/VoiceInputChunk.kt +56 -0
  48. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/VoiceInputResult.kt +56 -0
  49. package/nitrogen/generated/ios/ReactNativeAutoPlay-Swift-Cxx-Bridge.cpp +41 -16
  50. package/nitrogen/generated/ios/ReactNativeAutoPlay-Swift-Cxx-Bridge.hpp +201 -126
  51. package/nitrogen/generated/ios/ReactNativeAutoPlay-Swift-Cxx-Umbrella.hpp +11 -0
  52. package/nitrogen/generated/ios/ReactNativeAutoPlayAutolinking.mm +8 -0
  53. package/nitrogen/generated/ios/ReactNativeAutoPlayAutolinking.swift +12 -0
  54. package/nitrogen/generated/ios/c++/HybridAutoPlaySpecSwift.hpp +0 -34
  55. package/nitrogen/generated/ios/c++/HybridVoiceSpecSwift.cpp +11 -0
  56. package/nitrogen/generated/ios/c++/HybridVoiceSpecSwift.hpp +116 -0
  57. package/nitrogen/generated/ios/swift/Func_void_VoiceInputChunk.swift +46 -0
  58. package/nitrogen/generated/ios/swift/{Func_void_std__shared_ptr_ArrayBuffer_.swift → Func_void_VoiceInputResult.swift} +10 -10
  59. package/nitrogen/generated/ios/swift/Func_void_bool.swift +5 -5
  60. package/nitrogen/generated/ios/swift/HybridAutoPlaySpec.swift +0 -4
  61. package/nitrogen/generated/ios/swift/HybridAutoPlaySpec_cxx.swift +0 -82
  62. package/nitrogen/generated/ios/swift/HybridVoiceSpec.swift +58 -0
  63. package/nitrogen/generated/ios/swift/HybridVoiceSpec_cxx.swift +234 -0
  64. package/nitrogen/generated/ios/swift/VoiceInputChunk.swift +60 -0
  65. package/nitrogen/generated/ios/swift/VoiceInputResult.swift +60 -0
  66. package/nitrogen/generated/shared/c++/HybridAutoPlaySpec.cpp +0 -4
  67. package/nitrogen/generated/shared/c++/HybridAutoPlaySpec.hpp +0 -5
  68. package/nitrogen/generated/shared/c++/HybridVoiceSpec.cpp +24 -0
  69. package/nitrogen/generated/shared/c++/HybridVoiceSpec.hpp +73 -0
  70. package/nitrogen/generated/shared/c++/VoiceInputChunk.hpp +89 -0
  71. package/nitrogen/generated/shared/c++/VoiceInputResult.hpp +89 -0
  72. package/package.json +1 -1
  73. package/src/hybrid/HybridVoice.ts +79 -0
  74. package/src/index.ts +3 -1
  75. package/src/specs/AutoPlay.nitro.ts +0 -37
  76. package/src/specs/Voice.nitro.ts +16 -0
  77. package/src/types/Voice.ts +18 -0
@@ -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,56 @@
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 java.util.Objects
13
+ import com.margelo.nitro.core.ArrayBuffer
14
+
15
+ /**
16
+ * Represents the JavaScript object/struct "VoiceInputChunk".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class VoiceInputChunk(
21
+ @DoNotStrip
22
+ @Keep
23
+ val partial: String?,
24
+ @DoNotStrip
25
+ @Keep
26
+ val audio: ArrayBuffer?
27
+ ) {
28
+ /* primary constructor */
29
+
30
+ override fun equals(other: Any?): Boolean {
31
+ if (this === other) return true
32
+ if (other !is VoiceInputChunk) return false
33
+ return Objects.deepEquals(this.partial, other.partial)
34
+ && Objects.deepEquals(this.audio, other.audio)
35
+ }
36
+
37
+ override fun hashCode(): Int {
38
+ return arrayOf<Any?>(
39
+ partial,
40
+ audio
41
+ ).contentDeepHashCode()
42
+ }
43
+
44
+ companion object {
45
+ /**
46
+ * Constructor called from C++
47
+ */
48
+ @DoNotStrip
49
+ @Keep
50
+ @Suppress("unused")
51
+ @JvmStatic
52
+ private fun fromCpp(partial: String?, audio: ArrayBuffer?): VoiceInputChunk {
53
+ return VoiceInputChunk(partial, audio)
54
+ }
55
+ }
56
+ }
@@ -0,0 +1,56 @@
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 java.util.Objects
13
+ import com.margelo.nitro.core.ArrayBuffer
14
+
15
+ /**
16
+ * Represents the JavaScript object/struct "VoiceInputResult".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class VoiceInputResult(
21
+ @DoNotStrip
22
+ @Keep
23
+ val transcription: String?,
24
+ @DoNotStrip
25
+ @Keep
26
+ val audio: ArrayBuffer?
27
+ ) {
28
+ /* primary constructor */
29
+
30
+ override fun equals(other: Any?): Boolean {
31
+ if (this === other) return true
32
+ if (other !is VoiceInputResult) return false
33
+ return Objects.deepEquals(this.transcription, other.transcription)
34
+ && Objects.deepEquals(this.audio, other.audio)
35
+ }
36
+
37
+ override fun hashCode(): Int {
38
+ return arrayOf<Any?>(
39
+ transcription,
40
+ audio
41
+ ).contentDeepHashCode()
42
+ }
43
+
44
+ companion object {
45
+ /**
46
+ * Constructor called from C++
47
+ */
48
+ @DoNotStrip
49
+ @Keep
50
+ @Suppress("unused")
51
+ @JvmStatic
52
+ private fun fromCpp(transcription: String?, audio: ArrayBuffer?): VoiceInputResult {
53
+ return VoiceInputResult(transcription, audio)
54
+ }
55
+ }
56
+ }
@@ -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