@gmessier/nitro-speech 0.1.0 → 0.1.2

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 (30) hide show
  1. package/README.md +116 -27
  2. package/android/src/main/AndroidManifest.xml +1 -0
  3. package/android/src/main/java/com/margelo/nitro/nitrospeech/recognizer/HapticImpact.kt +66 -0
  4. package/android/src/main/java/com/margelo/nitro/nitrospeech/recognizer/HybridRecognizer.kt +11 -0
  5. package/ios/HapticImpact.swift +23 -0
  6. package/ios/HybridRecognizer.swift +28 -10
  7. package/lib/commonjs/index.js +44 -22
  8. package/lib/commonjs/index.js.map +1 -1
  9. package/lib/module/index.js +42 -21
  10. package/lib/module/index.js.map +1 -1
  11. package/lib/tsconfig.tsbuildinfo +1 -1
  12. package/lib/typescript/index.d.ts +23 -3
  13. package/lib/typescript/index.d.ts.map +1 -1
  14. package/lib/typescript/specs/NitroSpeech.nitro.d.ts +13 -0
  15. package/lib/typescript/specs/NitroSpeech.nitro.d.ts.map +1 -1
  16. package/nitrogen/generated/android/c++/JHapticFeedbackStyle.hpp +62 -0
  17. package/nitrogen/generated/android/c++/JHybridRecognizerSpec.cpp +4 -0
  18. package/nitrogen/generated/android/c++/JSpeechToTextParams.hpp +11 -1
  19. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrospeech/HapticFeedbackStyle.kt +22 -0
  20. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrospeech/SpeechToTextParams.kt +8 -2
  21. package/nitrogen/generated/ios/NitroSpeech-Swift-Cxx-Bridge.hpp +18 -0
  22. package/nitrogen/generated/ios/NitroSpeech-Swift-Cxx-Umbrella.hpp +3 -0
  23. package/nitrogen/generated/ios/c++/HybridRecognizerSpecSwift.hpp +3 -0
  24. package/nitrogen/generated/ios/swift/HapticFeedbackStyle.swift +44 -0
  25. package/nitrogen/generated/ios/swift/SpeechToTextParams.swift +47 -1
  26. package/nitrogen/generated/shared/c++/HapticFeedbackStyle.hpp +80 -0
  27. package/nitrogen/generated/shared/c++/SpeechToTextParams.hpp +12 -2
  28. package/package.json +4 -4
  29. package/src/index.ts +43 -21
  30. package/src/specs/NitroSpeech.nitro.ts +14 -0
@@ -1 +1 @@
1
- {"version":3,"file":"NitroSpeech.nitro.d.ts","sourceRoot":"","sources":["../../../src/specs/NitroSpeech.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAE9D,UAAU,aAAa;IACrB;;;;OAIG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAA;IACnC;;;;;;OAMG;IACH,8BAA8B,CAAC,EAAE,OAAO,CAAA;IACxC;;;;;;OAMG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAA;IAClC;;;;;;OAMG;IACH,2BAA2B,CAAC,EAAE,OAAO,CAAA;CACtC;AAED,UAAU,SAAS;IACjB;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAC5B;AAED,MAAM,WAAW,kBAAmB,SAAQ,aAAa,EAAE,SAAS;IAClE;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,uBAAuB,CAAC,EAAE,MAAM,CAAA;IAChC;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC7B;AAED,MAAM,WAAW,UAAW,SAAQ,YAAY,CAAC;IAC/C,GAAG,EAAE,OAAO,CAAA;IACZ,OAAO,EAAE,QAAQ,CAAA;CAClB,CAAC;IACA;;;;OAIG;IACH,cAAc,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAAA;IAChD;;;;;;OAMG;IACH,aAAa,IAAI,IAAI,CAAA;IAErB;;;;;;OAMG;IACH,iBAAiB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAElD;;;;;;;OAOG;IACH,oBAAo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AAC;IAChD,GAAG,EAAE,OAAO,CAAA;IACZ,OAAO,EAAE,QAAQ,CAAA;CAClB,CAAC;IACA,UAAU,EAAE,UAAU,CAAA;CACvB"}
@@ -0,0 +1,62 @@
1
+ ///
2
+ /// JHapticFeedbackStyle.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #include <fbjni/fbjni.h>
11
+ #include "HapticFeedbackStyle.hpp"
12
+
13
+ namespace margelo::nitro::nitrospeech {
14
+
15
+ using namespace facebook;
16
+
17
+ /**
18
+ * The C++ JNI bridge between the C++ enum "HapticFeedbackStyle" and the the Kotlin enum "HapticFeedbackStyle".
19
+ */
20
+ struct JHapticFeedbackStyle final: public jni::JavaClass<JHapticFeedbackStyle> {
21
+ public:
22
+ static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/nitrospeech/HapticFeedbackStyle;";
23
+
24
+ public:
25
+ /**
26
+ * Convert this Java/Kotlin-based enum to the C++ enum HapticFeedbackStyle.
27
+ */
28
+ [[maybe_unused]]
29
+ [[nodiscard]]
30
+ HapticFeedbackStyle toCpp() const {
31
+ static const auto clazz = javaClassStatic();
32
+ static const auto fieldOrdinal = clazz->getField<int>("value");
33
+ int ordinal = this->getFieldValue(fieldOrdinal);
34
+ return static_cast<HapticFeedbackStyle>(ordinal);
35
+ }
36
+
37
+ public:
38
+ /**
39
+ * Create a Java/Kotlin-based enum with the given C++ enum's value.
40
+ */
41
+ [[maybe_unused]]
42
+ static jni::alias_ref<JHapticFeedbackStyle> fromCpp(HapticFeedbackStyle value) {
43
+ static const auto clazz = javaClassStatic();
44
+ static const auto fieldLIGHT = clazz->getStaticField<JHapticFeedbackStyle>("LIGHT");
45
+ static const auto fieldMEDIUM = clazz->getStaticField<JHapticFeedbackStyle>("MEDIUM");
46
+ static const auto fieldHEAVY = clazz->getStaticField<JHapticFeedbackStyle>("HEAVY");
47
+
48
+ switch (value) {
49
+ case HapticFeedbackStyle::LIGHT:
50
+ return clazz->getStaticFieldValue(fieldLIGHT);
51
+ case HapticFeedbackStyle::MEDIUM:
52
+ return clazz->getStaticFieldValue(fieldMEDIUM);
53
+ case HapticFeedbackStyle::HEAVY:
54
+ return clazz->getStaticFieldValue(fieldHEAVY);
55
+ default:
56
+ std::string stringValue = std::to_string(static_cast<int>(value));
57
+ throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
58
+ }
59
+ }
60
+ };
61
+
62
+ } // namespace margelo::nitro::nitrospeech
@@ -9,6 +9,8 @@
9
9
 
10
10
  // Forward declaration of `SpeechToTextParams` to properly resolve imports.
11
11
  namespace margelo::nitro::nitrospeech { struct SpeechToTextParams; }
12
+ // Forward declaration of `HapticFeedbackStyle` to properly resolve imports.
13
+ namespace margelo::nitro::nitrospeech { enum class HapticFeedbackStyle; }
12
14
 
13
15
  #include <functional>
14
16
  #include <optional>
@@ -21,6 +23,8 @@ namespace margelo::nitro::nitrospeech { struct SpeechToTextParams; }
21
23
  #include "JFunc_void_std__string.hpp"
22
24
  #include "SpeechToTextParams.hpp"
23
25
  #include "JSpeechToTextParams.hpp"
26
+ #include "HapticFeedbackStyle.hpp"
27
+ #include "JHapticFeedbackStyle.hpp"
24
28
 
25
29
  namespace margelo::nitro::nitrospeech {
26
30
 
@@ -10,6 +10,8 @@
10
10
  #include <fbjni/fbjni.h>
11
11
  #include "SpeechToTextParams.hpp"
12
12
 
13
+ #include "HapticFeedbackStyle.hpp"
14
+ #include "JHapticFeedbackStyle.hpp"
13
15
  #include <optional>
14
16
  #include <string>
15
17
  #include <vector>
@@ -41,6 +43,10 @@ namespace margelo::nitro::nitrospeech {
41
43
  jni::local_ref<jni::JBoolean> disableRepeatingFilter = this->getFieldValue(fieldDisableRepeatingFilter);
42
44
  static const auto fieldContextualStrings = clazz->getField<jni::JArrayClass<jni::JString>>("contextualStrings");
43
45
  jni::local_ref<jni::JArrayClass<jni::JString>> contextualStrings = this->getFieldValue(fieldContextualStrings);
46
+ static const auto fieldStartHapticFeedbackStyle = clazz->getField<JHapticFeedbackStyle>("startHapticFeedbackStyle");
47
+ jni::local_ref<JHapticFeedbackStyle> startHapticFeedbackStyle = this->getFieldValue(fieldStartHapticFeedbackStyle);
48
+ static const auto fieldStopHapticFeedbackStyle = clazz->getField<JHapticFeedbackStyle>("stopHapticFeedbackStyle");
49
+ jni::local_ref<JHapticFeedbackStyle> stopHapticFeedbackStyle = this->getFieldValue(fieldStopHapticFeedbackStyle);
44
50
  static const auto fieldAndroidMaskOffensiveWords = clazz->getField<jni::JBoolean>("androidMaskOffensiveWords");
45
51
  jni::local_ref<jni::JBoolean> androidMaskOffensiveWords = this->getFieldValue(fieldAndroidMaskOffensiveWords);
46
52
  static const auto fieldAndroidFormattingPreferQuality = clazz->getField<jni::JBoolean>("androidFormattingPreferQuality");
@@ -65,6 +71,8 @@ namespace margelo::nitro::nitrospeech {
65
71
  }
66
72
  return __vector;
67
73
  }()) : std::nullopt,
74
+ startHapticFeedbackStyle != nullptr ? std::make_optional(startHapticFeedbackStyle->toCpp()) : std::nullopt,
75
+ stopHapticFeedbackStyle != nullptr ? std::make_optional(stopHapticFeedbackStyle->toCpp()) : std::nullopt,
68
76
  androidMaskOffensiveWords != nullptr ? std::make_optional(static_cast<bool>(androidMaskOffensiveWords->value())) : std::nullopt,
69
77
  androidFormattingPreferQuality != nullptr ? std::make_optional(static_cast<bool>(androidFormattingPreferQuality->value())) : std::nullopt,
70
78
  androidUseWebSearchModel != nullptr ? std::make_optional(static_cast<bool>(androidUseWebSearchModel->value())) : std::nullopt,
@@ -79,7 +87,7 @@ namespace margelo::nitro::nitrospeech {
79
87
  */
80
88
  [[maybe_unused]]
81
89
  static jni::local_ref<JSpeechToTextParams::javaobject> fromCpp(const SpeechToTextParams& value) {
82
- using JSignature = JSpeechToTextParams(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JArrayClass<jni::JString>>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JBoolean>);
90
+ using JSignature = JSpeechToTextParams(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JArrayClass<jni::JString>>, jni::alias_ref<JHapticFeedbackStyle>, jni::alias_ref<JHapticFeedbackStyle>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JBoolean>);
83
91
  static const auto clazz = javaClassStatic();
84
92
  static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
85
93
  return create(
@@ -97,6 +105,8 @@ namespace margelo::nitro::nitrospeech {
97
105
  }
98
106
  return __array;
99
107
  }() : nullptr,
108
+ value.startHapticFeedbackStyle.has_value() ? JHapticFeedbackStyle::fromCpp(value.startHapticFeedbackStyle.value()) : nullptr,
109
+ value.stopHapticFeedbackStyle.has_value() ? JHapticFeedbackStyle::fromCpp(value.stopHapticFeedbackStyle.value()) : nullptr,
100
110
  value.androidMaskOffensiveWords.has_value() ? jni::JBoolean::valueOf(value.androidMaskOffensiveWords.value()) : nullptr,
101
111
  value.androidFormattingPreferQuality.has_value() ? jni::JBoolean::valueOf(value.androidFormattingPreferQuality.value()) : nullptr,
102
112
  value.androidUseWebSearchModel.has_value() ? jni::JBoolean::valueOf(value.androidUseWebSearchModel.value()) : nullptr,
@@ -0,0 +1,22 @@
1
+ ///
2
+ /// HapticFeedbackStyle.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.nitrospeech
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+
13
+ /**
14
+ * Represents the JavaScript enum/union "HapticFeedbackStyle".
15
+ */
16
+ @DoNotStrip
17
+ @Keep
18
+ enum class HapticFeedbackStyle(@DoNotStrip @Keep val value: Int) {
19
+ LIGHT(0),
20
+ MEDIUM(1),
21
+ HEAVY(2);
22
+ }
@@ -31,6 +31,12 @@ data class SpeechToTextParams(
31
31
  val contextualStrings: Array<String>?,
32
32
  @DoNotStrip
33
33
  @Keep
34
+ val startHapticFeedbackStyle: HapticFeedbackStyle?,
35
+ @DoNotStrip
36
+ @Keep
37
+ val stopHapticFeedbackStyle: HapticFeedbackStyle?,
38
+ @DoNotStrip
39
+ @Keep
34
40
  val androidMaskOffensiveWords: Boolean?,
35
41
  @DoNotStrip
36
42
  @Keep
@@ -55,8 +61,8 @@ data class SpeechToTextParams(
55
61
  @Keep
56
62
  @Suppress("unused")
57
63
  @JvmStatic
58
- private fun fromCpp(locale: String?, autoFinishRecognitionMs: Double?, disableRepeatingFilter: Boolean?, contextualStrings: Array<String>?, androidMaskOffensiveWords: Boolean?, androidFormattingPreferQuality: Boolean?, androidUseWebSearchModel: Boolean?, androidDisableBatchHandling: Boolean?, iosAddPunctuation: Boolean?): SpeechToTextParams {
59
- return SpeechToTextParams(locale, autoFinishRecognitionMs, disableRepeatingFilter, contextualStrings, androidMaskOffensiveWords, androidFormattingPreferQuality, androidUseWebSearchModel, androidDisableBatchHandling, iosAddPunctuation)
64
+ private fun fromCpp(locale: String?, autoFinishRecognitionMs: Double?, disableRepeatingFilter: Boolean?, contextualStrings: Array<String>?, startHapticFeedbackStyle: HapticFeedbackStyle?, stopHapticFeedbackStyle: HapticFeedbackStyle?, androidMaskOffensiveWords: Boolean?, androidFormattingPreferQuality: Boolean?, androidUseWebSearchModel: Boolean?, androidDisableBatchHandling: Boolean?, iosAddPunctuation: Boolean?): SpeechToTextParams {
65
+ return SpeechToTextParams(locale, autoFinishRecognitionMs, disableRepeatingFilter, contextualStrings, startHapticFeedbackStyle, stopHapticFeedbackStyle, androidMaskOffensiveWords, androidFormattingPreferQuality, androidUseWebSearchModel, androidDisableBatchHandling, iosAddPunctuation)
60
66
  }
61
67
  }
62
68
  }
@@ -8,6 +8,8 @@
8
8
  #pragma once
9
9
 
10
10
  // Forward declarations of C++ defined types
11
+ // Forward declaration of `HapticFeedbackStyle` to properly resolve imports.
12
+ namespace margelo::nitro::nitrospeech { enum class HapticFeedbackStyle; }
11
13
  // Forward declaration of `HybridNitroSpeechSpec` to properly resolve imports.
12
14
  namespace margelo::nitro::nitrospeech { class HybridNitroSpeechSpec; }
13
15
  // Forward declaration of `HybridRecognizerSpec` to properly resolve imports.
@@ -20,6 +22,7 @@ namespace NitroSpeech { class HybridNitroSpeechSpec_cxx; }
20
22
  namespace NitroSpeech { class HybridRecognizerSpec_cxx; }
21
23
 
22
24
  // Include C++ defined types
25
+ #include "HapticFeedbackStyle.hpp"
23
26
  #include "HybridNitroSpeechSpec.hpp"
24
27
  #include "HybridRecognizerSpec.hpp"
25
28
  #include <NitroModules/Result.hpp>
@@ -107,6 +110,21 @@ namespace margelo::nitro::nitrospeech::bridge::swift {
107
110
  return *optional;
108
111
  }
109
112
 
113
+ // pragma MARK: std::optional<HapticFeedbackStyle>
114
+ /**
115
+ * Specialized version of `std::optional<HapticFeedbackStyle>`.
116
+ */
117
+ using std__optional_HapticFeedbackStyle_ = std::optional<HapticFeedbackStyle>;
118
+ inline std::optional<HapticFeedbackStyle> create_std__optional_HapticFeedbackStyle_(const HapticFeedbackStyle& value) noexcept {
119
+ return std::optional<HapticFeedbackStyle>(value);
120
+ }
121
+ inline bool has_value_std__optional_HapticFeedbackStyle_(const std::optional<HapticFeedbackStyle>& optional) noexcept {
122
+ return optional.has_value();
123
+ }
124
+ inline HapticFeedbackStyle get_std__optional_HapticFeedbackStyle_(const std::optional<HapticFeedbackStyle>& optional) noexcept {
125
+ return *optional;
126
+ }
127
+
110
128
  // pragma MARK: std::function<void()>
111
129
  /**
112
130
  * Specialized version of `std::function<void()>`.
@@ -8,6 +8,8 @@
8
8
  #pragma once
9
9
 
10
10
  // Forward declarations of C++ defined types
11
+ // Forward declaration of `HapticFeedbackStyle` to properly resolve imports.
12
+ namespace margelo::nitro::nitrospeech { enum class HapticFeedbackStyle; }
11
13
  // Forward declaration of `HybridNitroSpeechSpec` to properly resolve imports.
12
14
  namespace margelo::nitro::nitrospeech { class HybridNitroSpeechSpec; }
13
15
  // Forward declaration of `HybridRecognizerSpec` to properly resolve imports.
@@ -16,6 +18,7 @@ namespace margelo::nitro::nitrospeech { class HybridRecognizerSpec; }
16
18
  namespace margelo::nitro::nitrospeech { struct SpeechToTextParams; }
17
19
 
18
20
  // Include C++ defined types
21
+ #include "HapticFeedbackStyle.hpp"
19
22
  #include "HybridNitroSpeechSpec.hpp"
20
23
  #include "HybridRecognizerSpec.hpp"
21
24
  #include "SpeechToTextParams.hpp"
@@ -14,12 +14,15 @@ namespace NitroSpeech { class HybridRecognizerSpec_cxx; }
14
14
 
15
15
  // Forward declaration of `SpeechToTextParams` to properly resolve imports.
16
16
  namespace margelo::nitro::nitrospeech { struct SpeechToTextParams; }
17
+ // Forward declaration of `HapticFeedbackStyle` to properly resolve imports.
18
+ namespace margelo::nitro::nitrospeech { enum class HapticFeedbackStyle; }
17
19
 
18
20
  #include <functional>
19
21
  #include <optional>
20
22
  #include <string>
21
23
  #include <vector>
22
24
  #include "SpeechToTextParams.hpp"
25
+ #include "HapticFeedbackStyle.hpp"
23
26
 
24
27
  #include "NitroSpeech-Swift-Cxx-Umbrella.hpp"
25
28
 
@@ -0,0 +1,44 @@
1
+ ///
2
+ /// HapticFeedbackStyle.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ /**
9
+ * Represents the JS union `HapticFeedbackStyle`, backed by a C++ enum.
10
+ */
11
+ public typealias HapticFeedbackStyle = margelo.nitro.nitrospeech.HapticFeedbackStyle
12
+
13
+ public extension HapticFeedbackStyle {
14
+ /**
15
+ * Get a HapticFeedbackStyle for the given String value, or
16
+ * return `nil` if the given value was invalid/unknown.
17
+ */
18
+ init?(fromString string: String) {
19
+ switch string {
20
+ case "light":
21
+ self = .light
22
+ case "medium":
23
+ self = .medium
24
+ case "heavy":
25
+ self = .heavy
26
+ default:
27
+ return nil
28
+ }
29
+ }
30
+
31
+ /**
32
+ * Get the String value this HapticFeedbackStyle represents.
33
+ */
34
+ var stringValue: String {
35
+ switch self {
36
+ case .light:
37
+ return "light"
38
+ case .medium:
39
+ return "medium"
40
+ case .heavy:
41
+ return "heavy"
42
+ }
43
+ }
44
+ }
@@ -19,7 +19,7 @@ public extension SpeechToTextParams {
19
19
  /**
20
20
  * Create a new instance of `SpeechToTextParams`.
21
21
  */
22
- init(locale: String?, autoFinishRecognitionMs: Double?, disableRepeatingFilter: Bool?, contextualStrings: [String]?, androidMaskOffensiveWords: Bool?, androidFormattingPreferQuality: Bool?, androidUseWebSearchModel: Bool?, androidDisableBatchHandling: Bool?, iosAddPunctuation: Bool?) {
22
+ init(locale: String?, autoFinishRecognitionMs: Double?, disableRepeatingFilter: Bool?, contextualStrings: [String]?, startHapticFeedbackStyle: HapticFeedbackStyle?, stopHapticFeedbackStyle: HapticFeedbackStyle?, androidMaskOffensiveWords: Bool?, androidFormattingPreferQuality: Bool?, androidUseWebSearchModel: Bool?, androidDisableBatchHandling: Bool?, iosAddPunctuation: Bool?) {
23
23
  self.init({ () -> bridge.std__optional_std__string_ in
24
24
  if let __unwrappedValue = locale {
25
25
  return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
@@ -50,6 +50,18 @@ public extension SpeechToTextParams {
50
50
  } else {
51
51
  return .init()
52
52
  }
53
+ }(), { () -> bridge.std__optional_HapticFeedbackStyle_ in
54
+ if let __unwrappedValue = startHapticFeedbackStyle {
55
+ return bridge.create_std__optional_HapticFeedbackStyle_(__unwrappedValue)
56
+ } else {
57
+ return .init()
58
+ }
59
+ }(), { () -> bridge.std__optional_HapticFeedbackStyle_ in
60
+ if let __unwrappedValue = stopHapticFeedbackStyle {
61
+ return bridge.create_std__optional_HapticFeedbackStyle_(__unwrappedValue)
62
+ } else {
63
+ return .init()
64
+ }
53
65
  }(), { () -> bridge.std__optional_bool_ in
54
66
  if let __unwrappedValue = androidMaskOffensiveWords {
55
67
  return bridge.create_std__optional_bool_(__unwrappedValue)
@@ -178,6 +190,40 @@ public extension SpeechToTextParams {
178
190
  }
179
191
  }
180
192
 
193
+ var startHapticFeedbackStyle: HapticFeedbackStyle? {
194
+ @inline(__always)
195
+ get {
196
+ return self.__startHapticFeedbackStyle.value
197
+ }
198
+ @inline(__always)
199
+ set {
200
+ self.__startHapticFeedbackStyle = { () -> bridge.std__optional_HapticFeedbackStyle_ in
201
+ if let __unwrappedValue = newValue {
202
+ return bridge.create_std__optional_HapticFeedbackStyle_(__unwrappedValue)
203
+ } else {
204
+ return .init()
205
+ }
206
+ }()
207
+ }
208
+ }
209
+
210
+ var stopHapticFeedbackStyle: HapticFeedbackStyle? {
211
+ @inline(__always)
212
+ get {
213
+ return self.__stopHapticFeedbackStyle.value
214
+ }
215
+ @inline(__always)
216
+ set {
217
+ self.__stopHapticFeedbackStyle = { () -> bridge.std__optional_HapticFeedbackStyle_ in
218
+ if let __unwrappedValue = newValue {
219
+ return bridge.create_std__optional_HapticFeedbackStyle_(__unwrappedValue)
220
+ } else {
221
+ return .init()
222
+ }
223
+ }()
224
+ }
225
+ }
226
+
181
227
  var androidMaskOffensiveWords: Bool? {
182
228
  @inline(__always)
183
229
  get {
@@ -0,0 +1,80 @@
1
+ ///
2
+ /// HapticFeedbackStyle.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #if __has_include(<NitroModules/NitroHash.hpp>)
11
+ #include <NitroModules/NitroHash.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+ #if __has_include(<NitroModules/JSIConverter.hpp>)
16
+ #include <NitroModules/JSIConverter.hpp>
17
+ #else
18
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
+ #endif
20
+ #if __has_include(<NitroModules/NitroDefines.hpp>)
21
+ #include <NitroModules/NitroDefines.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
25
+
26
+ namespace margelo::nitro::nitrospeech {
27
+
28
+ /**
29
+ * An enum which can be represented as a JavaScript union (HapticFeedbackStyle).
30
+ */
31
+ enum class HapticFeedbackStyle {
32
+ LIGHT SWIFT_NAME(light) = 0,
33
+ MEDIUM SWIFT_NAME(medium) = 1,
34
+ HEAVY SWIFT_NAME(heavy) = 2,
35
+ } CLOSED_ENUM;
36
+
37
+ } // namespace margelo::nitro::nitrospeech
38
+
39
+ namespace margelo::nitro {
40
+
41
+ // C++ HapticFeedbackStyle <> JS HapticFeedbackStyle (union)
42
+ template <>
43
+ struct JSIConverter<margelo::nitro::nitrospeech::HapticFeedbackStyle> final {
44
+ static inline margelo::nitro::nitrospeech::HapticFeedbackStyle fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
45
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
46
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
47
+ case hashString("light"): return margelo::nitro::nitrospeech::HapticFeedbackStyle::LIGHT;
48
+ case hashString("medium"): return margelo::nitro::nitrospeech::HapticFeedbackStyle::MEDIUM;
49
+ case hashString("heavy"): return margelo::nitro::nitrospeech::HapticFeedbackStyle::HEAVY;
50
+ default: [[unlikely]]
51
+ throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum HapticFeedbackStyle - invalid value!");
52
+ }
53
+ }
54
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::nitrospeech::HapticFeedbackStyle arg) {
55
+ switch (arg) {
56
+ case margelo::nitro::nitrospeech::HapticFeedbackStyle::LIGHT: return JSIConverter<std::string>::toJSI(runtime, "light");
57
+ case margelo::nitro::nitrospeech::HapticFeedbackStyle::MEDIUM: return JSIConverter<std::string>::toJSI(runtime, "medium");
58
+ case margelo::nitro::nitrospeech::HapticFeedbackStyle::HEAVY: return JSIConverter<std::string>::toJSI(runtime, "heavy");
59
+ default: [[unlikely]]
60
+ throw std::invalid_argument("Cannot convert HapticFeedbackStyle to JS - invalid value: "
61
+ + std::to_string(static_cast<int>(arg)) + "!");
62
+ }
63
+ }
64
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
65
+ if (!value.isString()) {
66
+ return false;
67
+ }
68
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
69
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
70
+ case hashString("light"):
71
+ case hashString("medium"):
72
+ case hashString("heavy"):
73
+ return true;
74
+ default:
75
+ return false;
76
+ }
77
+ }
78
+ };
79
+
80
+ } // namespace margelo::nitro
@@ -23,11 +23,13 @@
23
23
  #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
24
  #endif
25
25
 
26
-
26
+ // Forward declaration of `HapticFeedbackStyle` to properly resolve imports.
27
+ namespace margelo::nitro::nitrospeech { enum class HapticFeedbackStyle; }
27
28
 
28
29
  #include <string>
29
30
  #include <optional>
30
31
  #include <vector>
32
+ #include "HapticFeedbackStyle.hpp"
31
33
 
32
34
  namespace margelo::nitro::nitrospeech {
33
35
 
@@ -40,6 +42,8 @@ namespace margelo::nitro::nitrospeech {
40
42
  std::optional<double> autoFinishRecognitionMs SWIFT_PRIVATE;
41
43
  std::optional<bool> disableRepeatingFilter SWIFT_PRIVATE;
42
44
  std::optional<std::vector<std::string>> contextualStrings SWIFT_PRIVATE;
45
+ std::optional<HapticFeedbackStyle> startHapticFeedbackStyle SWIFT_PRIVATE;
46
+ std::optional<HapticFeedbackStyle> stopHapticFeedbackStyle SWIFT_PRIVATE;
43
47
  std::optional<bool> androidMaskOffensiveWords SWIFT_PRIVATE;
44
48
  std::optional<bool> androidFormattingPreferQuality SWIFT_PRIVATE;
45
49
  std::optional<bool> androidUseWebSearchModel SWIFT_PRIVATE;
@@ -48,7 +52,7 @@ namespace margelo::nitro::nitrospeech {
48
52
 
49
53
  public:
50
54
  SpeechToTextParams() = default;
51
- explicit SpeechToTextParams(std::optional<std::string> locale, std::optional<double> autoFinishRecognitionMs, std::optional<bool> disableRepeatingFilter, std::optional<std::vector<std::string>> contextualStrings, std::optional<bool> androidMaskOffensiveWords, std::optional<bool> androidFormattingPreferQuality, std::optional<bool> androidUseWebSearchModel, std::optional<bool> androidDisableBatchHandling, std::optional<bool> iosAddPunctuation): locale(locale), autoFinishRecognitionMs(autoFinishRecognitionMs), disableRepeatingFilter(disableRepeatingFilter), contextualStrings(contextualStrings), androidMaskOffensiveWords(androidMaskOffensiveWords), androidFormattingPreferQuality(androidFormattingPreferQuality), androidUseWebSearchModel(androidUseWebSearchModel), androidDisableBatchHandling(androidDisableBatchHandling), iosAddPunctuation(iosAddPunctuation) {}
55
+ explicit SpeechToTextParams(std::optional<std::string> locale, std::optional<double> autoFinishRecognitionMs, std::optional<bool> disableRepeatingFilter, std::optional<std::vector<std::string>> contextualStrings, std::optional<HapticFeedbackStyle> startHapticFeedbackStyle, std::optional<HapticFeedbackStyle> stopHapticFeedbackStyle, std::optional<bool> androidMaskOffensiveWords, std::optional<bool> androidFormattingPreferQuality, std::optional<bool> androidUseWebSearchModel, std::optional<bool> androidDisableBatchHandling, std::optional<bool> iosAddPunctuation): locale(locale), autoFinishRecognitionMs(autoFinishRecognitionMs), disableRepeatingFilter(disableRepeatingFilter), contextualStrings(contextualStrings), startHapticFeedbackStyle(startHapticFeedbackStyle), stopHapticFeedbackStyle(stopHapticFeedbackStyle), androidMaskOffensiveWords(androidMaskOffensiveWords), androidFormattingPreferQuality(androidFormattingPreferQuality), androidUseWebSearchModel(androidUseWebSearchModel), androidDisableBatchHandling(androidDisableBatchHandling), iosAddPunctuation(iosAddPunctuation) {}
52
56
  };
53
57
 
54
58
  } // namespace margelo::nitro::nitrospeech
@@ -65,6 +69,8 @@ namespace margelo::nitro {
65
69
  JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "autoFinishRecognitionMs")),
66
70
  JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "disableRepeatingFilter")),
67
71
  JSIConverter<std::optional<std::vector<std::string>>>::fromJSI(runtime, obj.getProperty(runtime, "contextualStrings")),
72
+ JSIConverter<std::optional<margelo::nitro::nitrospeech::HapticFeedbackStyle>>::fromJSI(runtime, obj.getProperty(runtime, "startHapticFeedbackStyle")),
73
+ JSIConverter<std::optional<margelo::nitro::nitrospeech::HapticFeedbackStyle>>::fromJSI(runtime, obj.getProperty(runtime, "stopHapticFeedbackStyle")),
68
74
  JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "androidMaskOffensiveWords")),
69
75
  JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "androidFormattingPreferQuality")),
70
76
  JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "androidUseWebSearchModel")),
@@ -78,6 +84,8 @@ namespace margelo::nitro {
78
84
  obj.setProperty(runtime, "autoFinishRecognitionMs", JSIConverter<std::optional<double>>::toJSI(runtime, arg.autoFinishRecognitionMs));
79
85
  obj.setProperty(runtime, "disableRepeatingFilter", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.disableRepeatingFilter));
80
86
  obj.setProperty(runtime, "contextualStrings", JSIConverter<std::optional<std::vector<std::string>>>::toJSI(runtime, arg.contextualStrings));
87
+ obj.setProperty(runtime, "startHapticFeedbackStyle", JSIConverter<std::optional<margelo::nitro::nitrospeech::HapticFeedbackStyle>>::toJSI(runtime, arg.startHapticFeedbackStyle));
88
+ obj.setProperty(runtime, "stopHapticFeedbackStyle", JSIConverter<std::optional<margelo::nitro::nitrospeech::HapticFeedbackStyle>>::toJSI(runtime, arg.stopHapticFeedbackStyle));
81
89
  obj.setProperty(runtime, "androidMaskOffensiveWords", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.androidMaskOffensiveWords));
82
90
  obj.setProperty(runtime, "androidFormattingPreferQuality", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.androidFormattingPreferQuality));
83
91
  obj.setProperty(runtime, "androidUseWebSearchModel", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.androidUseWebSearchModel));
@@ -97,6 +105,8 @@ namespace margelo::nitro {
97
105
  if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "autoFinishRecognitionMs"))) return false;
98
106
  if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "disableRepeatingFilter"))) return false;
99
107
  if (!JSIConverter<std::optional<std::vector<std::string>>>::canConvert(runtime, obj.getProperty(runtime, "contextualStrings"))) return false;
108
+ if (!JSIConverter<std::optional<margelo::nitro::nitrospeech::HapticFeedbackStyle>>::canConvert(runtime, obj.getProperty(runtime, "startHapticFeedbackStyle"))) return false;
109
+ if (!JSIConverter<std::optional<margelo::nitro::nitrospeech::HapticFeedbackStyle>>::canConvert(runtime, obj.getProperty(runtime, "stopHapticFeedbackStyle"))) return false;
100
110
  if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "androidMaskOffensiveWords"))) return false;
101
111
  if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "androidFormattingPreferQuality"))) return false;
102
112
  if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "androidUseWebSearchModel"))) return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gmessier/nitro-speech",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "React Native Speech Recognition Library powered by Nitro Modules",
5
5
  "main": "./lib/commonjs/index.js",
6
6
  "module": "./lib/module/index.js",
@@ -76,9 +76,9 @@
76
76
  "eslint-plugin-prettier": "^5.2.1",
77
77
  "nitrogen": "*",
78
78
  "prettier": "^3.3.3",
79
- "react": "19.1.1",
80
- "react-native": "0.82.0",
81
- "react-native-nitro-modules": "*",
79
+ "react": "^19.2.4",
80
+ "react-native": "^0.83.1",
81
+ "react-native-nitro-modules": "^0.33.9",
82
82
  "react-native-builder-bob": "^0.37.0",
83
83
  "typescript": "^5.8.3"
84
84
  },