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

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 (165) hide show
  1. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridAutoPlay.kt +93 -0
  2. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/VoiceInputManager.kt +20 -286
  3. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/utils/ThreadUtil.kt +13 -6
  4. package/ios/hybrid/HybridAutoPlay.swift +51 -2
  5. package/ios/utils/VoiceInputManager.swift +40 -144
  6. package/lib/index.d.ts +1 -3
  7. package/lib/index.js +1 -2
  8. package/lib/scenes/CarPlayDashboardScene.d.ts +1 -0
  9. package/lib/scenes/CarPlayDashboardScene.js +13 -7
  10. package/lib/specs/AutoPlay.nitro.d.ts +35 -0
  11. package/nitro.json +0 -10
  12. package/nitrogen/generated/android/ReactNativeAutoPlay+autolinking.cmake +0 -2
  13. package/nitrogen/generated/android/ReactNativeAutoPlayOnLoad.cpp +0 -18
  14. package/nitrogen/generated/android/c++/JActiveCarUxRestrictions.hpp +8 -8
  15. package/nitrogen/generated/android/c++/JGridTemplateConfig.hpp +16 -16
  16. package/nitrogen/generated/android/c++/JHybridAndroidAutoTelemetrySpec.cpp +4 -4
  17. package/nitrogen/generated/android/c++/JHybridAutoPlaySpec.cpp +52 -4
  18. package/nitrogen/generated/android/c++/JHybridAutoPlaySpec.hpp +5 -0
  19. package/nitrogen/generated/android/c++/JHybridClusterSpec.cpp +4 -4
  20. package/nitrogen/generated/android/c++/JHybridGridTemplateSpec.cpp +4 -4
  21. package/nitrogen/generated/android/c++/JHybridListTemplateSpec.cpp +4 -4
  22. package/nitrogen/generated/android/c++/JHybridMapTemplateSpec.cpp +15 -15
  23. package/nitrogen/generated/android/c++/JInformationTemplateConfig.hpp +16 -16
  24. package/nitrogen/generated/android/c++/JLaneGuidance.hpp +16 -16
  25. package/nitrogen/generated/android/c++/JListTemplateConfig.hpp +16 -16
  26. package/nitrogen/generated/android/c++/JMapTemplateConfig.hpp +16 -16
  27. package/nitrogen/generated/android/c++/JMessageTemplateConfig.hpp +16 -16
  28. package/nitrogen/generated/android/c++/JNitroAttributedString.hpp +8 -8
  29. package/nitrogen/generated/android/c++/JNitroBaseMapTemplateConfig.hpp +16 -16
  30. package/nitrogen/generated/android/c++/JNitroManeuver.cpp +4 -4
  31. package/nitrogen/generated/android/c++/JNitroManeuver.hpp +4 -4
  32. package/nitrogen/generated/android/c++/JNitroRoutingManeuver.hpp +16 -16
  33. package/nitrogen/generated/android/c++/JNitroSection.hpp +8 -8
  34. package/nitrogen/generated/android/c++/JPermissionRequestResult.hpp +16 -16
  35. package/nitrogen/generated/android/c++/JRouteChoice.hpp +32 -32
  36. package/nitrogen/generated/android/c++/JSearchTemplateConfig.hpp +8 -8
  37. package/nitrogen/generated/android/c++/JSignInTemplateConfig.hpp +16 -16
  38. package/nitrogen/generated/android/c++/JTripsConfig.hpp +8 -8
  39. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/ActiveCarUxRestrictions.kt +19 -0
  40. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/AppFocusState.kt +15 -0
  41. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/AssetImage.kt +23 -0
  42. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/AutoText.kt +17 -0
  43. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/BooleanTelemetryItem.kt +15 -0
  44. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Distance.kt +15 -0
  45. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/DurationWithTimeZone.kt +15 -0
  46. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/GlyphImage.kt +21 -0
  47. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/GoogleSignIn.kt +19 -0
  48. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/GoogleSignInAccount.kt +27 -0
  49. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/GridTemplateConfig.kt +33 -0
  50. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridAutoPlaySpec.kt +21 -0
  51. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/ImageLane.kt +15 -0
  52. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/InformationTemplateConfig.kt +35 -0
  53. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/InputSignIn.kt +27 -0
  54. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/LaneGuidance.kt +15 -0
  55. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/ListTemplateConfig.kt +33 -0
  56. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Location.kt +15 -0
  57. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/MapTemplateConfig.kt +51 -0
  58. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/MessageTemplateConfig.kt +37 -0
  59. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NavigationAlertAction.kt +17 -0
  60. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroAction.kt +27 -0
  61. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroAttributedString.kt +15 -0
  62. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroAttributedStringImage.kt +15 -0
  63. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroBaseMapTemplateConfig.kt +29 -0
  64. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroColor.kt +15 -0
  65. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroGridButton.kt +17 -0
  66. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroImage.kt +18 -8
  67. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroLoadingManeuver.kt +17 -0
  68. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroManeuver.kt +18 -8
  69. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroMapButton.kt +17 -0
  70. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroMessageManeuver.kt +19 -0
  71. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroNavigationAlert.kt +31 -0
  72. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroRoutingManeuver.kt +49 -0
  73. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroRow.kt +27 -0
  74. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroSection.kt +17 -0
  75. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NumericTelemetryItem.kt +15 -0
  76. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/PermissionRequestResult.kt +15 -0
  77. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/PinSignIn.kt +15 -0
  78. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Point.kt +15 -0
  79. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/PreferredImageLane.kt +19 -0
  80. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/QrSignIn.kt +15 -0
  81. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/RemoteImage.kt +17 -0
  82. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/RouteChoice.kt +21 -0
  83. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/SafeAreaInsets.kt +21 -0
  84. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/SearchTemplateConfig.kt +39 -0
  85. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/SignInTemplateConfig.kt +37 -0
  86. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/StringTelemetryItem.kt +15 -0
  87. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Telemetry.kt +35 -0
  88. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/TravelEstimates.kt +19 -0
  89. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/TripConfig.kt +15 -0
  90. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/TripPoint.kt +19 -0
  91. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/TripPreviewTextConfiguration.kt +19 -0
  92. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/TripSelectorCallback.kt +13 -0
  93. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/TripsConfig.kt +15 -0
  94. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Variant_GlyphImage_AssetImage_RemoteImage.kt +18 -8
  95. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Variant_PreferredImageLane_ImageLane.kt +16 -7
  96. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Variant_QrSignIn_PinSignIn_InputSignIn_GoogleSignIn.kt +20 -9
  97. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/VehicleTelemetryItem.kt +19 -0
  98. package/nitrogen/generated/ios/ReactNativeAutoPlay+autolinking.rb +2 -0
  99. package/nitrogen/generated/ios/ReactNativeAutoPlay-Swift-Cxx-Bridge.cpp +16 -41
  100. package/nitrogen/generated/ios/ReactNativeAutoPlay-Swift-Cxx-Bridge.hpp +126 -201
  101. package/nitrogen/generated/ios/ReactNativeAutoPlay-Swift-Cxx-Umbrella.hpp +0 -11
  102. package/nitrogen/generated/ios/ReactNativeAutoPlayAutolinking.mm +0 -8
  103. package/nitrogen/generated/ios/ReactNativeAutoPlayAutolinking.swift +0 -12
  104. package/nitrogen/generated/ios/c++/HybridAutoPlaySpecSwift.hpp +42 -0
  105. package/nitrogen/generated/ios/swift/Func_void_bool.swift +5 -5
  106. package/nitrogen/generated/ios/swift/{Func_void_VoiceInputResult.swift → Func_void_std__shared_ptr_ArrayBuffer_.swift} +10 -10
  107. package/nitrogen/generated/ios/swift/HybridAutoPlaySpec.swift +5 -0
  108. package/nitrogen/generated/ios/swift/HybridAutoPlaySpec_cxx.swift +94 -0
  109. package/nitrogen/generated/ios/swift/NitroImage.swift +13 -0
  110. package/nitrogen/generated/ios/swift/NitroManeuver.swift +13 -0
  111. package/nitrogen/generated/ios/swift/Variant_GlyphImage_AssetImage_RemoteImage.swift +13 -0
  112. package/nitrogen/generated/ios/swift/Variant_PreferredImageLane_ImageLane.swift +12 -0
  113. package/nitrogen/generated/shared/c++/HybridAutoPlaySpec.cpp +5 -0
  114. package/nitrogen/generated/shared/c++/HybridAutoPlaySpec.hpp +6 -0
  115. package/package.json +2 -2
  116. package/src/index.ts +1 -3
  117. package/src/scenes/CarPlayDashboardScene.ts +18 -11
  118. package/src/specs/AutoPlay.nitro.ts +44 -0
  119. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridVoice.kt +0 -97
  120. package/ios/hybrid/HybridVoice.swift +0 -65
  121. package/lib/HybridAutoPlay.d.ts +0 -2
  122. package/lib/HybridAutoPlay.js +0 -2
  123. package/lib/components/OnAppearedChildRenderer.d.ts +0 -10
  124. package/lib/components/OnAppearedChildRenderer.js +0 -26
  125. package/lib/hooks/useIsAutoPlayFocused.d.ts +0 -7
  126. package/lib/hooks/useIsAutoPlayFocused.js +0 -20
  127. package/lib/hybrid/HybridVoice.d.ts +0 -52
  128. package/lib/hybrid/HybridVoice.js +0 -52
  129. package/lib/hybrid.d.ts +0 -2
  130. package/lib/hybrid.js +0 -2
  131. package/lib/specs/AutomotivePermissionRequestTemplate.d.ts +0 -11
  132. package/lib/specs/AutomotivePermissionRequestTemplate.js +0 -1
  133. package/lib/specs/AutomotivePermissionRequestTemplate.nitro.d.ts +0 -11
  134. package/lib/specs/AutomotivePermissionRequestTemplate.nitro.js +0 -1
  135. package/lib/specs/Voice.nitro.d.ts +0 -11
  136. package/lib/specs/Voice.nitro.js +0 -1
  137. package/lib/templates/AutomotivePermissionRequestTemplate.d.ts +0 -23
  138. package/lib/templates/AutomotivePermissionRequestTemplate.js +0 -18
  139. package/lib/types/Glyphmap.d.ts +0 -4105
  140. package/lib/types/Glyphmap.js +0 -4105
  141. package/lib/types/Voice.d.ts +0 -16
  142. package/lib/types/Voice.js +0 -1
  143. package/nitrogen/generated/android/c++/JFunc_void_VoiceInputChunk.hpp +0 -81
  144. package/nitrogen/generated/android/c++/JHybridVoiceSpec.cpp +0 -104
  145. package/nitrogen/generated/android/c++/JHybridVoiceSpec.hpp +0 -66
  146. package/nitrogen/generated/android/c++/JVoiceInputChunk.hpp +0 -64
  147. package/nitrogen/generated/android/c++/JVoiceInputResult.hpp +0 -64
  148. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_VoiceInputChunk.kt +0 -80
  149. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridVoiceSpec.kt +0 -72
  150. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/VoiceInputChunk.kt +0 -41
  151. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/VoiceInputResult.kt +0 -41
  152. package/nitrogen/generated/ios/c++/HybridVoiceSpecSwift.cpp +0 -11
  153. package/nitrogen/generated/ios/c++/HybridVoiceSpecSwift.hpp +0 -116
  154. package/nitrogen/generated/ios/swift/Func_void_VoiceInputChunk.swift +0 -46
  155. package/nitrogen/generated/ios/swift/HybridVoiceSpec.swift +0 -58
  156. package/nitrogen/generated/ios/swift/HybridVoiceSpec_cxx.swift +0 -234
  157. package/nitrogen/generated/ios/swift/VoiceInputChunk.swift +0 -60
  158. package/nitrogen/generated/ios/swift/VoiceInputResult.swift +0 -60
  159. package/nitrogen/generated/shared/c++/HybridVoiceSpec.cpp +0 -24
  160. package/nitrogen/generated/shared/c++/HybridVoiceSpec.hpp +0 -73
  161. package/nitrogen/generated/shared/c++/VoiceInputChunk.hpp +0 -89
  162. package/nitrogen/generated/shared/c++/VoiceInputResult.hpp +0 -89
  163. package/src/hybrid/HybridVoice.ts +0 -79
  164. package/src/specs/Voice.nitro.ts +0 -16
  165. package/src/types/Voice.ts +0 -18
@@ -1,116 +0,0 @@
1
- ///
2
- /// HybridVoiceSpecSwift.hpp
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
- #pragma once
9
-
10
- #include "HybridVoiceSpec.hpp"
11
-
12
- // Forward declaration of `HybridVoiceSpec_cxx` to properly resolve imports.
13
- namespace ReactNativeAutoPlay { class HybridVoiceSpec_cxx; }
14
-
15
- // Forward declaration of `VoiceInputResult` to properly resolve imports.
16
- namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct VoiceInputResult; }
17
- // Forward declaration of `ArrayBufferHolder` to properly resolve imports.
18
- namespace NitroModules { class ArrayBufferHolder; }
19
- // Forward declaration of `VoiceInputChunk` to properly resolve imports.
20
- namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct VoiceInputChunk; }
21
-
22
- #include <NitroModules/Promise.hpp>
23
- #include "VoiceInputResult.hpp"
24
- #include <string>
25
- #include <optional>
26
- #include <NitroModules/ArrayBuffer.hpp>
27
- #include <NitroModules/ArrayBufferHolder.hpp>
28
- #include "VoiceInputChunk.hpp"
29
- #include <functional>
30
-
31
- #include "ReactNativeAutoPlay-Swift-Cxx-Umbrella.hpp"
32
-
33
- namespace margelo::nitro::swe::iternio::reactnativeautoplay {
34
-
35
- /**
36
- * The C++ part of HybridVoiceSpec_cxx.swift.
37
- *
38
- * HybridVoiceSpecSwift (C++) accesses HybridVoiceSpec_cxx (Swift), and might
39
- * contain some additional bridging code for C++ <> Swift interop.
40
- *
41
- * Since this obviously introduces an overhead, I hope at some point in
42
- * the future, HybridVoiceSpec_cxx can directly inherit from the C++ class HybridVoiceSpec
43
- * to simplify the whole structure and memory management.
44
- */
45
- class HybridVoiceSpecSwift: public virtual HybridVoiceSpec {
46
- public:
47
- // Constructor from a Swift instance
48
- explicit HybridVoiceSpecSwift(const ReactNativeAutoPlay::HybridVoiceSpec_cxx& swiftPart):
49
- HybridObject(HybridVoiceSpec::TAG),
50
- _swiftPart(swiftPart) { }
51
-
52
- public:
53
- // Get the Swift part
54
- inline ReactNativeAutoPlay::HybridVoiceSpec_cxx& getSwiftPart() noexcept {
55
- return _swiftPart;
56
- }
57
-
58
- public:
59
- inline size_t getExternalMemorySize() noexcept override {
60
- return _swiftPart.getMemorySize();
61
- }
62
- bool equals(const std::shared_ptr<HybridObject>& other) override {
63
- if (auto otherCast = std::dynamic_pointer_cast<HybridVoiceSpecSwift>(other)) {
64
- return _swiftPart.equals(otherCast->_swiftPart);
65
- }
66
- return false;
67
- }
68
- void dispose() noexcept override {
69
- _swiftPart.dispose();
70
- }
71
- std::string toString() override {
72
- return _swiftPart.toString();
73
- }
74
-
75
- public:
76
- // Properties
77
-
78
-
79
- public:
80
- // Methods
81
- inline bool hasVoiceInputPermission() override {
82
- auto __result = _swiftPart.hasVoiceInputPermission();
83
- if (__result.hasError()) [[unlikely]] {
84
- std::rethrow_exception(__result.error());
85
- }
86
- auto __value = std::move(__result.value());
87
- return __value;
88
- }
89
- inline std::shared_ptr<Promise<bool>> requestVoiceInputPermission() override {
90
- auto __result = _swiftPart.requestVoiceInputPermission();
91
- if (__result.hasError()) [[unlikely]] {
92
- std::rethrow_exception(__result.error());
93
- }
94
- auto __value = std::move(__result.value());
95
- return __value;
96
- }
97
- inline std::shared_ptr<Promise<VoiceInputResult>> startVoiceInput(std::optional<double> silenceThresholdMs, std::optional<double> maxDurationMs, const std::optional<std::string>& listeningText, std::optional<bool> preferSpeechToText, const std::optional<std::function<void(const VoiceInputChunk& /* chunk */)>>& onChunk, const std::optional<std::string>& language) override {
98
- auto __result = _swiftPart.startVoiceInput(silenceThresholdMs, maxDurationMs, listeningText, preferSpeechToText, onChunk, language);
99
- if (__result.hasError()) [[unlikely]] {
100
- std::rethrow_exception(__result.error());
101
- }
102
- auto __value = std::move(__result.value());
103
- return __value;
104
- }
105
- inline void stopVoiceInput() override {
106
- auto __result = _swiftPart.stopVoiceInput();
107
- if (__result.hasError()) [[unlikely]] {
108
- std::rethrow_exception(__result.error());
109
- }
110
- }
111
-
112
- private:
113
- ReactNativeAutoPlay::HybridVoiceSpec_cxx _swiftPart;
114
- };
115
-
116
- } // namespace margelo::nitro::swe::iternio::reactnativeautoplay
@@ -1,46 +0,0 @@
1
- ///
2
- /// Func_void_VoiceInputChunk.swift
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
- import NitroModules
9
-
10
- /**
11
- * Wraps a Swift `(_ chunk: VoiceInputChunk) -> Void` as a class.
12
- * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
13
- */
14
- public final class Func_void_VoiceInputChunk {
15
- public typealias bridge = margelo.nitro.swe.iternio.reactnativeautoplay.bridge.swift
16
-
17
- private let closure: (_ chunk: VoiceInputChunk) -> Void
18
-
19
- public init(_ closure: @escaping (_ chunk: VoiceInputChunk) -> Void) {
20
- self.closure = closure
21
- }
22
-
23
- @inline(__always)
24
- public func call(chunk: VoiceInputChunk) -> Void {
25
- self.closure(chunk)
26
- }
27
-
28
- /**
29
- * Casts this instance to a retained unsafe raw pointer.
30
- * This acquires one additional strong reference on the object!
31
- */
32
- @inline(__always)
33
- public func toUnsafe() -> UnsafeMutableRawPointer {
34
- return Unmanaged.passRetained(self).toOpaque()
35
- }
36
-
37
- /**
38
- * Casts an unsafe pointer to a `Func_void_VoiceInputChunk`.
39
- * The pointer has to be a retained opaque `Unmanaged<Func_void_VoiceInputChunk>`.
40
- * This removes one strong reference from the object!
41
- */
42
- @inline(__always)
43
- public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_VoiceInputChunk {
44
- return Unmanaged<Func_void_VoiceInputChunk>.fromOpaque(pointer).takeRetainedValue()
45
- }
46
- }
@@ -1,58 +0,0 @@
1
- ///
2
- /// HybridVoiceSpec.swift
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
- import NitroModules
9
-
10
- /// See ``HybridVoiceSpec``
11
- public protocol HybridVoiceSpec_protocol: HybridObject {
12
- // Properties
13
-
14
-
15
- // Methods
16
- func hasVoiceInputPermission() throws -> Bool
17
- func requestVoiceInputPermission() throws -> Promise<Bool>
18
- func startVoiceInput(silenceThresholdMs: Double?, maxDurationMs: Double?, listeningText: String?, preferSpeechToText: Bool?, onChunk: ((_ chunk: VoiceInputChunk) -> Void)?, language: String?) throws -> Promise<VoiceInputResult>
19
- func stopVoiceInput() throws -> Void
20
- }
21
-
22
- public extension HybridVoiceSpec_protocol {
23
- /// Default implementation of ``HybridObject.toString``
24
- func toString() -> String {
25
- return "[HybridObject Voice]"
26
- }
27
- }
28
-
29
- /// See ``HybridVoiceSpec``
30
- open class HybridVoiceSpec_base {
31
- private weak var cxxWrapper: HybridVoiceSpec_cxx? = nil
32
- public init() { }
33
- public func getCxxWrapper() -> HybridVoiceSpec_cxx {
34
- #if DEBUG
35
- guard self is any HybridVoiceSpec else {
36
- fatalError("`self` is not a `HybridVoiceSpec`! Did you accidentally inherit from `HybridVoiceSpec_base` instead of `HybridVoiceSpec`?")
37
- }
38
- #endif
39
- if let cxxWrapper = self.cxxWrapper {
40
- return cxxWrapper
41
- } else {
42
- let cxxWrapper = HybridVoiceSpec_cxx(self as! any HybridVoiceSpec)
43
- self.cxxWrapper = cxxWrapper
44
- return cxxWrapper
45
- }
46
- }
47
- }
48
-
49
- /**
50
- * A Swift base-protocol representing the Voice HybridObject.
51
- * Implement this protocol to create Swift-based instances of Voice.
52
- * ```swift
53
- * class HybridVoice : HybridVoiceSpec {
54
- * // ...
55
- * }
56
- * ```
57
- */
58
- public typealias HybridVoiceSpec = HybridVoiceSpec_protocol & HybridVoiceSpec_base
@@ -1,234 +0,0 @@
1
- ///
2
- /// HybridVoiceSpec_cxx.swift
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
- import NitroModules
9
-
10
- /**
11
- * A class implementation that bridges HybridVoiceSpec over to C++.
12
- * In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
13
- *
14
- * Also, some Swift types need to be bridged with special handling:
15
- * - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
16
- * - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
17
- * - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
18
- */
19
- open class HybridVoiceSpec_cxx {
20
- /**
21
- * The Swift <> C++ bridge's namespace (`margelo::nitro::swe::iternio::reactnativeautoplay::bridge::swift`)
22
- * from `ReactNativeAutoPlay-Swift-Cxx-Bridge.hpp`.
23
- * This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
24
- */
25
- public typealias bridge = margelo.nitro.swe.iternio.reactnativeautoplay.bridge.swift
26
-
27
- /**
28
- * Holds an instance of the `HybridVoiceSpec` Swift protocol.
29
- */
30
- private var __implementation: any HybridVoiceSpec
31
-
32
- /**
33
- * Holds a weak pointer to the C++ class that wraps the Swift class.
34
- */
35
- private var __cxxPart: bridge.std__weak_ptr_HybridVoiceSpec_
36
-
37
- /**
38
- * Create a new `HybridVoiceSpec_cxx` that wraps the given `HybridVoiceSpec`.
39
- * All properties and methods bridge to C++ types.
40
- */
41
- public init(_ implementation: any HybridVoiceSpec) {
42
- self.__implementation = implementation
43
- self.__cxxPart = .init()
44
- /* no base class */
45
- }
46
-
47
- /**
48
- * Get the actual `HybridVoiceSpec` instance this class wraps.
49
- */
50
- @inline(__always)
51
- public func getHybridVoiceSpec() -> any HybridVoiceSpec {
52
- return __implementation
53
- }
54
-
55
- /**
56
- * Casts this instance to a retained unsafe raw pointer.
57
- * This acquires one additional strong reference on the object!
58
- */
59
- public func toUnsafe() -> UnsafeMutableRawPointer {
60
- return Unmanaged.passRetained(self).toOpaque()
61
- }
62
-
63
- /**
64
- * Casts an unsafe pointer to a `HybridVoiceSpec_cxx`.
65
- * The pointer has to be a retained opaque `Unmanaged<HybridVoiceSpec_cxx>`.
66
- * This removes one strong reference from the object!
67
- */
68
- public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridVoiceSpec_cxx {
69
- return Unmanaged<HybridVoiceSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
70
- }
71
-
72
- /**
73
- * Gets (or creates) the C++ part of this Hybrid Object.
74
- * The C++ part is a `std::shared_ptr<HybridVoiceSpec>`.
75
- */
76
- public func getCxxPart() -> bridge.std__shared_ptr_HybridVoiceSpec_ {
77
- let cachedCxxPart = self.__cxxPart.lock()
78
- if Bool(fromCxx: cachedCxxPart) {
79
- return cachedCxxPart
80
- } else {
81
- let newCxxPart = bridge.create_std__shared_ptr_HybridVoiceSpec_(self.toUnsafe())
82
- __cxxPart = bridge.weakify_std__shared_ptr_HybridVoiceSpec_(newCxxPart)
83
- return newCxxPart
84
- }
85
- }
86
-
87
-
88
-
89
- /**
90
- * Get the memory size of the Swift class (plus size of any other allocations)
91
- * so the JS VM can properly track it and garbage-collect the JS object if needed.
92
- */
93
- @inline(__always)
94
- public var memorySize: Int {
95
- return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
96
- }
97
-
98
- /**
99
- * Compares this object with the given [other] object for reference equality.
100
- */
101
- @inline(__always)
102
- public func equals(other: HybridVoiceSpec_cxx) -> Bool {
103
- return self.__implementation === other.__implementation
104
- }
105
-
106
- /**
107
- * Call dispose() on the Swift class.
108
- * This _may_ be called manually from JS.
109
- */
110
- @inline(__always)
111
- public func dispose() {
112
- self.__implementation.dispose()
113
- }
114
-
115
- /**
116
- * Call toString() on the Swift class.
117
- */
118
- @inline(__always)
119
- public func toString() -> String {
120
- return self.__implementation.toString()
121
- }
122
-
123
- // Properties
124
-
125
-
126
- // Methods
127
- @inline(__always)
128
- public final func hasVoiceInputPermission() -> bridge.Result_bool_ {
129
- do {
130
- let __result = try self.__implementation.hasVoiceInputPermission()
131
- let __resultCpp = __result
132
- return bridge.create_Result_bool_(__resultCpp)
133
- } catch (let __error) {
134
- let __exceptionPtr = __error.toCpp()
135
- return bridge.create_Result_bool_(__exceptionPtr)
136
- }
137
- }
138
-
139
- @inline(__always)
140
- public final func requestVoiceInputPermission() -> bridge.Result_std__shared_ptr_Promise_bool___ {
141
- do {
142
- let __result = try self.__implementation.requestVoiceInputPermission()
143
- let __resultCpp = { () -> bridge.std__shared_ptr_Promise_bool__ in
144
- let __promise = bridge.create_std__shared_ptr_Promise_bool__()
145
- let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_bool__(__promise)
146
- __result
147
- .then({ __result in __promiseHolder.resolve(__result) })
148
- .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
149
- return __promise
150
- }()
151
- return bridge.create_Result_std__shared_ptr_Promise_bool___(__resultCpp)
152
- } catch (let __error) {
153
- let __exceptionPtr = __error.toCpp()
154
- return bridge.create_Result_std__shared_ptr_Promise_bool___(__exceptionPtr)
155
- }
156
- }
157
-
158
- @inline(__always)
159
- public final func startVoiceInput(silenceThresholdMs: bridge.std__optional_double_, maxDurationMs: bridge.std__optional_double_, listeningText: bridge.std__optional_std__string_, preferSpeechToText: bridge.std__optional_bool_, onChunk: bridge.std__optional_std__function_void_const_VoiceInputChunk_____chunk______, language: bridge.std__optional_std__string_) -> bridge.Result_std__shared_ptr_Promise_VoiceInputResult___ {
160
- do {
161
- let __result = try self.__implementation.startVoiceInput(silenceThresholdMs: { () -> Double? in
162
- if bridge.has_value_std__optional_double_(silenceThresholdMs) {
163
- let __unwrapped = bridge.get_std__optional_double_(silenceThresholdMs)
164
- return __unwrapped
165
- } else {
166
- return nil
167
- }
168
- }(), maxDurationMs: { () -> Double? in
169
- if bridge.has_value_std__optional_double_(maxDurationMs) {
170
- let __unwrapped = bridge.get_std__optional_double_(maxDurationMs)
171
- return __unwrapped
172
- } else {
173
- return nil
174
- }
175
- }(), listeningText: { () -> String? in
176
- if bridge.has_value_std__optional_std__string_(listeningText) {
177
- let __unwrapped = bridge.get_std__optional_std__string_(listeningText)
178
- return String(__unwrapped)
179
- } else {
180
- return nil
181
- }
182
- }(), preferSpeechToText: { () -> Bool? in
183
- if bridge.has_value_std__optional_bool_(preferSpeechToText) {
184
- let __unwrapped = bridge.get_std__optional_bool_(preferSpeechToText)
185
- return __unwrapped
186
- } else {
187
- return nil
188
- }
189
- }(), onChunk: { () -> ((_ chunk: VoiceInputChunk) -> Void)? in
190
- if bridge.has_value_std__optional_std__function_void_const_VoiceInputChunk_____chunk______(onChunk) {
191
- let __unwrapped = bridge.get_std__optional_std__function_void_const_VoiceInputChunk_____chunk______(onChunk)
192
- return { () -> (VoiceInputChunk) -> Void in
193
- let __wrappedFunction = bridge.wrap_Func_void_VoiceInputChunk(__unwrapped)
194
- return { (__chunk: VoiceInputChunk) -> Void in
195
- __wrappedFunction.call(__chunk)
196
- }
197
- }()
198
- } else {
199
- return nil
200
- }
201
- }(), language: { () -> String? in
202
- if bridge.has_value_std__optional_std__string_(language) {
203
- let __unwrapped = bridge.get_std__optional_std__string_(language)
204
- return String(__unwrapped)
205
- } else {
206
- return nil
207
- }
208
- }())
209
- let __resultCpp = { () -> bridge.std__shared_ptr_Promise_VoiceInputResult__ in
210
- let __promise = bridge.create_std__shared_ptr_Promise_VoiceInputResult__()
211
- let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_VoiceInputResult__(__promise)
212
- __result
213
- .then({ __result in __promiseHolder.resolve(__result) })
214
- .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
215
- return __promise
216
- }()
217
- return bridge.create_Result_std__shared_ptr_Promise_VoiceInputResult___(__resultCpp)
218
- } catch (let __error) {
219
- let __exceptionPtr = __error.toCpp()
220
- return bridge.create_Result_std__shared_ptr_Promise_VoiceInputResult___(__exceptionPtr)
221
- }
222
- }
223
-
224
- @inline(__always)
225
- public final func stopVoiceInput() -> bridge.Result_void_ {
226
- do {
227
- try self.__implementation.stopVoiceInput()
228
- return bridge.create_Result_void_()
229
- } catch (let __error) {
230
- let __exceptionPtr = __error.toCpp()
231
- return bridge.create_Result_void_(__exceptionPtr)
232
- }
233
- }
234
- }
@@ -1,60 +0,0 @@
1
- ///
2
- /// VoiceInputChunk.swift
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
- import NitroModules
9
-
10
- /**
11
- * Represents an instance of `VoiceInputChunk`, backed by a C++ struct.
12
- */
13
- public typealias VoiceInputChunk = margelo.nitro.swe.iternio.reactnativeautoplay.VoiceInputChunk
14
-
15
- public extension VoiceInputChunk {
16
- private typealias bridge = margelo.nitro.swe.iternio.reactnativeautoplay.bridge.swift
17
-
18
- /**
19
- * Create a new instance of `VoiceInputChunk`.
20
- */
21
- init(partial: String?, audio: ArrayBuffer?) {
22
- self.init({ () -> bridge.std__optional_std__string_ in
23
- if let __unwrappedValue = partial {
24
- return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
25
- } else {
26
- return .init()
27
- }
28
- }(), { () -> bridge.std__optional_std__shared_ptr_ArrayBuffer__ in
29
- if let __unwrappedValue = audio {
30
- return bridge.create_std__optional_std__shared_ptr_ArrayBuffer__(__unwrappedValue.getArrayBuffer())
31
- } else {
32
- return .init()
33
- }
34
- }())
35
- }
36
-
37
- @inline(__always)
38
- var partial: String? {
39
- return { () -> String? in
40
- if bridge.has_value_std__optional_std__string_(self.__partial) {
41
- let __unwrapped = bridge.get_std__optional_std__string_(self.__partial)
42
- return String(__unwrapped)
43
- } else {
44
- return nil
45
- }
46
- }()
47
- }
48
-
49
- @inline(__always)
50
- var audio: ArrayBuffer? {
51
- return { () -> ArrayBuffer? in
52
- if bridge.has_value_std__optional_std__shared_ptr_ArrayBuffer__(self.__audio) {
53
- let __unwrapped = bridge.get_std__optional_std__shared_ptr_ArrayBuffer__(self.__audio)
54
- return ArrayBuffer(__unwrapped)
55
- } else {
56
- return nil
57
- }
58
- }()
59
- }
60
- }
@@ -1,60 +0,0 @@
1
- ///
2
- /// VoiceInputResult.swift
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
- import NitroModules
9
-
10
- /**
11
- * Represents an instance of `VoiceInputResult`, backed by a C++ struct.
12
- */
13
- public typealias VoiceInputResult = margelo.nitro.swe.iternio.reactnativeautoplay.VoiceInputResult
14
-
15
- public extension VoiceInputResult {
16
- private typealias bridge = margelo.nitro.swe.iternio.reactnativeautoplay.bridge.swift
17
-
18
- /**
19
- * Create a new instance of `VoiceInputResult`.
20
- */
21
- init(transcription: String?, audio: ArrayBuffer?) {
22
- self.init({ () -> bridge.std__optional_std__string_ in
23
- if let __unwrappedValue = transcription {
24
- return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
25
- } else {
26
- return .init()
27
- }
28
- }(), { () -> bridge.std__optional_std__shared_ptr_ArrayBuffer__ in
29
- if let __unwrappedValue = audio {
30
- return bridge.create_std__optional_std__shared_ptr_ArrayBuffer__(__unwrappedValue.getArrayBuffer())
31
- } else {
32
- return .init()
33
- }
34
- }())
35
- }
36
-
37
- @inline(__always)
38
- var transcription: String? {
39
- return { () -> String? in
40
- if bridge.has_value_std__optional_std__string_(self.__transcription) {
41
- let __unwrapped = bridge.get_std__optional_std__string_(self.__transcription)
42
- return String(__unwrapped)
43
- } else {
44
- return nil
45
- }
46
- }()
47
- }
48
-
49
- @inline(__always)
50
- var audio: ArrayBuffer? {
51
- return { () -> ArrayBuffer? in
52
- if bridge.has_value_std__optional_std__shared_ptr_ArrayBuffer__(self.__audio) {
53
- let __unwrapped = bridge.get_std__optional_std__shared_ptr_ArrayBuffer__(self.__audio)
54
- return ArrayBuffer(__unwrapped)
55
- } else {
56
- return nil
57
- }
58
- }()
59
- }
60
- }
@@ -1,24 +0,0 @@
1
- ///
2
- /// HybridVoiceSpec.cpp
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
- #include "HybridVoiceSpec.hpp"
9
-
10
- namespace margelo::nitro::swe::iternio::reactnativeautoplay {
11
-
12
- void HybridVoiceSpec::loadHybridMethods() {
13
- // load base methods/properties
14
- HybridObject::loadHybridMethods();
15
- // load custom methods/properties
16
- registerHybrids(this, [](Prototype& prototype) {
17
- prototype.registerHybridMethod("hasVoiceInputPermission", &HybridVoiceSpec::hasVoiceInputPermission);
18
- prototype.registerHybridMethod("requestVoiceInputPermission", &HybridVoiceSpec::requestVoiceInputPermission);
19
- prototype.registerHybridMethod("startVoiceInput", &HybridVoiceSpec::startVoiceInput);
20
- prototype.registerHybridMethod("stopVoiceInput", &HybridVoiceSpec::stopVoiceInput);
21
- });
22
- }
23
-
24
- } // namespace margelo::nitro::swe::iternio::reactnativeautoplay
@@ -1,73 +0,0 @@
1
- ///
2
- /// HybridVoiceSpec.hpp
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
- #pragma once
9
-
10
- #if __has_include(<NitroModules/HybridObject.hpp>)
11
- #include <NitroModules/HybridObject.hpp>
12
- #else
13
- #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
- #endif
15
-
16
- // Forward declaration of `VoiceInputResult` to properly resolve imports.
17
- namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct VoiceInputResult; }
18
- // Forward declaration of `VoiceInputChunk` to properly resolve imports.
19
- namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct VoiceInputChunk; }
20
-
21
- #include <NitroModules/Promise.hpp>
22
- #include "VoiceInputResult.hpp"
23
- #include <optional>
24
- #include <string>
25
- #include "VoiceInputChunk.hpp"
26
- #include <functional>
27
-
28
- namespace margelo::nitro::swe::iternio::reactnativeautoplay {
29
-
30
- using namespace margelo::nitro;
31
-
32
- /**
33
- * An abstract base class for `Voice`
34
- * Inherit this class to create instances of `HybridVoiceSpec` in C++.
35
- * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
36
- * @example
37
- * ```cpp
38
- * class HybridVoice: public HybridVoiceSpec {
39
- * public:
40
- * HybridVoice(...): HybridObject(TAG) { ... }
41
- * // ...
42
- * };
43
- * ```
44
- */
45
- class HybridVoiceSpec: public virtual HybridObject {
46
- public:
47
- // Constructor
48
- explicit HybridVoiceSpec(): HybridObject(TAG) { }
49
-
50
- // Destructor
51
- ~HybridVoiceSpec() override = default;
52
-
53
- public:
54
- // Properties
55
-
56
-
57
- public:
58
- // Methods
59
- virtual bool hasVoiceInputPermission() = 0;
60
- virtual std::shared_ptr<Promise<bool>> requestVoiceInputPermission() = 0;
61
- virtual std::shared_ptr<Promise<VoiceInputResult>> startVoiceInput(std::optional<double> silenceThresholdMs, std::optional<double> maxDurationMs, const std::optional<std::string>& listeningText, std::optional<bool> preferSpeechToText, const std::optional<std::function<void(const VoiceInputChunk& /* chunk */)>>& onChunk, const std::optional<std::string>& language) = 0;
62
- virtual void stopVoiceInput() = 0;
63
-
64
- protected:
65
- // Hybrid Setup
66
- void loadHybridMethods() override;
67
-
68
- protected:
69
- // Tag for logging
70
- static constexpr auto TAG = "Voice";
71
- };
72
-
73
- } // namespace margelo::nitro::swe::iternio::reactnativeautoplay