react-native-davoice-tts 1.0.366 → 1.0.368

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 (26) hide show
  1. package/TTSRNBridge.podspec +1 -1
  2. package/android/libs/com/davoice/tts/1.0.0/tts-1.0.0.aar +0 -0
  3. package/android/libs/com/davoice/tts/1.0.0/tts-1.0.0.aar.md5 +1 -1
  4. package/android/libs/com/davoice/tts/1.0.0/tts-1.0.0.aar.sha1 +1 -1
  5. package/android/src/main/java/com/davoice/stt/rn/STTModule.kt +12 -10
  6. package/android/src/main/java/com/davoice/tts/rn/DaVoiceTTSBridge.java +16 -6
  7. package/ios/SpeechBridge/SpeechBridge.m +26 -14
  8. package/ios/TTSRNBridge/DaVoiceTTSBridge.m +15 -6
  9. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/DavoiceTTS +0 -0
  10. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.abi.json +432 -418
  11. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.private.swiftinterface +1 -1
  12. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.swiftinterface +1 -1
  13. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/DavoiceTTS +0 -0
  14. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.abi.json +432 -418
  15. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +1 -1
  16. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftinterface +1 -1
  17. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.abi.json +432 -418
  18. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +1 -1
  19. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +1 -1
  20. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeDirectory +0 -0
  21. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeRequirements-1 +0 -0
  22. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeResources +24 -24
  23. package/package.json +1 -1
  24. package/speech/index.ts +81 -43
  25. package/stt/index.ts +8 -1
  26. package/tts/DaVoiceTTSBridge.js +7 -1
@@ -197,7 +197,7 @@ public struct SpeakerVerificationConfig : Swift.Codable {
197
197
  public var logLevel: DavoiceTTS.SVLogLevel
198
198
  public init(from decoder: any Swift.Decoder) throws
199
199
  public func encode(to encoder: any Swift.Encoder) throws
200
- public init(modelPath: Swift.String, sampleRate: Swift.Int = 16_000, numMelBins: Swift.Int = 80, cmn: Swift.Bool = true, frameLengthMs: Swift.Float = 25.0, frameShiftMs: Swift.Float = 10.0, nFFT: Swift.Int = 512, decisionThreshold: Swift.Float = 0.35, expectedLayoutBDT: Swift.Bool = false, frameSize: Swift.Int = 1280, tailSeconds: Swift.Float = 2.0, maxTailSeconds: Swift.Float = 3.0, meanComboEnabled: Swift.Bool = true, meanComboMaxK: Swift.Int = 3, meanComboMaxTotal: Swift.Int = 2000, logLevel: DavoiceTTS.SVLogLevel = .debug)
200
+ public init(modelPath: Swift.String, sampleRate: Swift.Int = 16_000, numMelBins: Swift.Int = 80, cmn: Swift.Bool = true, frameLengthMs: Swift.Float = 25.0, frameShiftMs: Swift.Float = 10.0, nFFT: Swift.Int = 512, decisionThreshold: Swift.Float = 0.35, expectedLayoutBDT: Swift.Bool = false, frameSize: Swift.Int = 1280, tailSeconds: Swift.Float = 2.0, maxTailSeconds: Swift.Float = 3.0, meanComboEnabled: Swift.Bool = true, meanComboMaxK: Swift.Int = 3, meanComboMaxTotal: Swift.Int = 2000, logLevel: DavoiceTTS.SVLogLevel = .off)
201
201
  }
202
202
  public struct SpeakerEnrollment : Swift.Codable {
203
203
  public let enrollmentId: Swift.String
@@ -197,7 +197,7 @@ public struct SpeakerVerificationConfig : Swift.Codable {
197
197
  public var logLevel: DavoiceTTS.SVLogLevel
198
198
  public init(from decoder: any Swift.Decoder) throws
199
199
  public func encode(to encoder: any Swift.Encoder) throws
200
- public init(modelPath: Swift.String, sampleRate: Swift.Int = 16_000, numMelBins: Swift.Int = 80, cmn: Swift.Bool = true, frameLengthMs: Swift.Float = 25.0, frameShiftMs: Swift.Float = 10.0, nFFT: Swift.Int = 512, decisionThreshold: Swift.Float = 0.35, expectedLayoutBDT: Swift.Bool = false, frameSize: Swift.Int = 1280, tailSeconds: Swift.Float = 2.0, maxTailSeconds: Swift.Float = 3.0, meanComboEnabled: Swift.Bool = true, meanComboMaxK: Swift.Int = 3, meanComboMaxTotal: Swift.Int = 2000, logLevel: DavoiceTTS.SVLogLevel = .debug)
200
+ public init(modelPath: Swift.String, sampleRate: Swift.Int = 16_000, numMelBins: Swift.Int = 80, cmn: Swift.Bool = true, frameLengthMs: Swift.Float = 25.0, frameShiftMs: Swift.Float = 10.0, nFFT: Swift.Int = 512, decisionThreshold: Swift.Float = 0.35, expectedLayoutBDT: Swift.Bool = false, frameSize: Swift.Int = 1280, tailSeconds: Swift.Float = 2.0, maxTailSeconds: Swift.Float = 3.0, meanComboEnabled: Swift.Bool = true, meanComboMaxK: Swift.Int = 3, meanComboMaxTotal: Swift.Int = 2000, logLevel: DavoiceTTS.SVLogLevel = .off)
201
201
  }
202
202
  public struct SpeakerEnrollment : Swift.Codable {
203
203
  public let enrollmentId: Swift.String
@@ -14,11 +14,11 @@
14
14
  </data>
15
15
  <key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
16
16
  <data>
17
- ru7p+bUKnIS+HG5H0Pk4ci+5Jxg=
17
+ EphxVlJED59kbqQ3or966ytYg6I=
18
18
  </data>
19
19
  <key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
20
20
  <data>
21
- nJGa9a3X0P/C5O0dZf1NYhjqyhc=
21
+ rBAXQ5p1nFznE9lDB2fjnDpG4G0=
22
22
  </data>
23
23
  <key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
24
24
  <data>
@@ -26,19 +26,19 @@
26
26
  </data>
27
27
  <key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key>
28
28
  <data>
29
- nJGa9a3X0P/C5O0dZf1NYhjqyhc=
29
+ rBAXQ5p1nFznE9lDB2fjnDpG4G0=
30
30
  </data>
31
31
  <key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
32
32
  <data>
33
- mG5zpUzD0Dj71BTZ8Lvunb7lkbM=
33
+ k+GkN20de5GN4frQgQ6L7c6eDi8=
34
34
  </data>
35
35
  <key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
36
36
  <data>
37
- ru7p+bUKnIS+HG5H0Pk4ci+5Jxg=
37
+ EphxVlJED59kbqQ3or966ytYg6I=
38
38
  </data>
39
39
  <key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
40
40
  <data>
41
- KW3zq20fxSNKp3z3d7TcznPWiP4=
41
+ /JI1t6r6wr/zuwq4TewxkVJ6RqI=
42
42
  </data>
43
43
  <key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
44
44
  <data>
@@ -46,11 +46,11 @@
46
46
  </data>
47
47
  <key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
48
48
  <data>
49
- KW3zq20fxSNKp3z3d7TcznPWiP4=
49
+ /JI1t6r6wr/zuwq4TewxkVJ6RqI=
50
50
  </data>
51
51
  <key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
52
52
  <data>
53
- UukBUaorNvJ3swwENgV9QE64egI=
53
+ s5aHOuj8F/LwF2Akwz9hR/citzU=
54
54
  </data>
55
55
  <key>Modules/module.modulemap</key>
56
56
  <data>
@@ -74,22 +74,22 @@
74
74
  <dict>
75
75
  <key>hash</key>
76
76
  <data>
77
- ru7p+bUKnIS+HG5H0Pk4ci+5Jxg=
77
+ EphxVlJED59kbqQ3or966ytYg6I=
78
78
  </data>
79
79
  <key>hash2</key>
80
80
  <data>
81
- jDpKOzrNa5k/cHoG7rjXaJsi6TNjU6jd/SQWSe/FrAY=
81
+ tpMM/tJELbY6pCkJOrEr+W2aXCakvJPn0wgv8Eu6+NE=
82
82
  </data>
83
83
  </dict>
84
84
  <key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
85
85
  <dict>
86
86
  <key>hash</key>
87
87
  <data>
88
- nJGa9a3X0P/C5O0dZf1NYhjqyhc=
88
+ rBAXQ5p1nFznE9lDB2fjnDpG4G0=
89
89
  </data>
90
90
  <key>hash2</key>
91
91
  <data>
92
- 0iPH5zlEtAJ3NTDgWPDwrXa3fCLwpTV8+wfrCWoLQsc=
92
+ nlQICdEdKlQdQSj0c53wlHehS303Jz9TtL478iyRC7w=
93
93
  </data>
94
94
  </dict>
95
95
  <key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
@@ -107,44 +107,44 @@
107
107
  <dict>
108
108
  <key>hash</key>
109
109
  <data>
110
- nJGa9a3X0P/C5O0dZf1NYhjqyhc=
110
+ rBAXQ5p1nFznE9lDB2fjnDpG4G0=
111
111
  </data>
112
112
  <key>hash2</key>
113
113
  <data>
114
- 0iPH5zlEtAJ3NTDgWPDwrXa3fCLwpTV8+wfrCWoLQsc=
114
+ nlQICdEdKlQdQSj0c53wlHehS303Jz9TtL478iyRC7w=
115
115
  </data>
116
116
  </dict>
117
117
  <key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
118
118
  <dict>
119
119
  <key>hash</key>
120
120
  <data>
121
- mG5zpUzD0Dj71BTZ8Lvunb7lkbM=
121
+ k+GkN20de5GN4frQgQ6L7c6eDi8=
122
122
  </data>
123
123
  <key>hash2</key>
124
124
  <data>
125
- 5rkxfeXBgmtWNUJKirhDCCabcOxhlPoY8cY1GzYuUag=
125
+ 22MvGYtDcyMzjmwqT0Guh+nps5GkZPy9eXyytCuIiEo=
126
126
  </data>
127
127
  </dict>
128
128
  <key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
129
129
  <dict>
130
130
  <key>hash</key>
131
131
  <data>
132
- ru7p+bUKnIS+HG5H0Pk4ci+5Jxg=
132
+ EphxVlJED59kbqQ3or966ytYg6I=
133
133
  </data>
134
134
  <key>hash2</key>
135
135
  <data>
136
- jDpKOzrNa5k/cHoG7rjXaJsi6TNjU6jd/SQWSe/FrAY=
136
+ tpMM/tJELbY6pCkJOrEr+W2aXCakvJPn0wgv8Eu6+NE=
137
137
  </data>
138
138
  </dict>
139
139
  <key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
140
140
  <dict>
141
141
  <key>hash</key>
142
142
  <data>
143
- KW3zq20fxSNKp3z3d7TcznPWiP4=
143
+ /JI1t6r6wr/zuwq4TewxkVJ6RqI=
144
144
  </data>
145
145
  <key>hash2</key>
146
146
  <data>
147
- Zry/ZX+dhZk8czEu6juDVYa+TcZniSIP3m4nuPxQW8k=
147
+ sCC9UgvU8GsKTggUO2sH5+KUq5Zo7YQC111Md4BOvbw=
148
148
  </data>
149
149
  </dict>
150
150
  <key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
@@ -162,22 +162,22 @@
162
162
  <dict>
163
163
  <key>hash</key>
164
164
  <data>
165
- KW3zq20fxSNKp3z3d7TcznPWiP4=
165
+ /JI1t6r6wr/zuwq4TewxkVJ6RqI=
166
166
  </data>
167
167
  <key>hash2</key>
168
168
  <data>
169
- Zry/ZX+dhZk8czEu6juDVYa+TcZniSIP3m4nuPxQW8k=
169
+ sCC9UgvU8GsKTggUO2sH5+KUq5Zo7YQC111Md4BOvbw=
170
170
  </data>
171
171
  </dict>
172
172
  <key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
173
173
  <dict>
174
174
  <key>hash</key>
175
175
  <data>
176
- UukBUaorNvJ3swwENgV9QE64egI=
176
+ s5aHOuj8F/LwF2Akwz9hR/citzU=
177
177
  </data>
178
178
  <key>hash2</key>
179
179
  <data>
180
- DrzWlfpisKxpcKHvEzqlPqWvhtauis/mAk5jMK5SZLk=
180
+ adGpsmHrpNMWvuGe8sfz5CyhGoTH7pghBUUDPvkMjC8=
181
181
  </data>
182
182
  </dict>
183
183
  <key>Modules/module.modulemap</key>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-davoice-tts",
3
- "version": "1.0.366",
3
+ "version": "1.0.368",
4
4
  "description": "tts library for React Native",
5
5
  "main": "tts/index.js",
6
6
  "types": "tts/index.d.ts",
package/speech/index.ts CHANGED
@@ -6,7 +6,7 @@ import resolveAssetSource from 'react-native/Libraries/Image/resolveAssetSource'
6
6
  const AssetRegistry = require('react-native/Libraries/Image/AssetRegistry');
7
7
 
8
8
  // -------------------- VERBOSE LOGGING --------------------
9
- const VERBOSE = true;
9
+ const VERBOSE = false;
10
10
  const PFX = '[SpeechJS]';
11
11
  function ts() {
12
12
  const d = new Date();
@@ -19,7 +19,7 @@ function dbg(...args: any[]) {
19
19
  }
20
20
  function dbgErr(...args: any[]) {
21
21
  // eslint-disable-next-line no-console
22
- console.log(ts(), PFX, '❌', ...args);
22
+ console.error(ts(), PFX, '❌', ...args);
23
23
  }
24
24
 
25
25
  function safeJson(x: any) {
@@ -34,6 +34,42 @@ function sleep(ms: number) {
34
34
  return new Promise<void>((r) => setTimeout(r, ms));
35
35
  }
36
36
 
37
+ // Android's pauseSpeechRecognitionLite/unPauseSpeechRecognitionLite native callbacks have
38
+ // no native-JS-visible timeout contract of their own (unlike iOS's ...LiteAsync). This
39
+ // guarantees the wrapping promise always settles: on timeout it logs and resolves with
40
+ // undefined rather than rejecting, so callers that never expected this call to throw don't
41
+ // suddenly start seeing exceptions - the only change is a bounded wait instead of an
42
+ // unbounded one.
43
+ function androidCallbackWithTimeout<T>(
44
+ invoke: (done: (value: T) => void) => void,
45
+ timeoutMs: number,
46
+ label: string,
47
+ ): Promise<T | undefined> {
48
+ return new Promise<T | undefined>((resolve) => {
49
+ let settled = false;
50
+ const timer = setTimeout(() => {
51
+ if (settled) return;
52
+ settled = true;
53
+ dbgErr(`${label} timed out after ${timeoutMs}ms`);
54
+ resolve(undefined);
55
+ }, timeoutMs);
56
+ try {
57
+ invoke((value) => {
58
+ if (settled) return;
59
+ settled = true;
60
+ clearTimeout(timer);
61
+ resolve(value);
62
+ });
63
+ } catch (e) {
64
+ if (settled) return;
65
+ settled = true;
66
+ clearTimeout(timer);
67
+ dbgErr(`${label} threw before native callback`, String(e));
68
+ resolve(undefined);
69
+ }
70
+ });
71
+ }
72
+
37
73
  let speechOpSeq = 0;
38
74
  const PROBABLY_GPT_MISTAKE = false;
39
75
  function nextSpeechOpId(prefix: string) {
@@ -449,8 +485,8 @@ class Speech {
449
485
  }
450
486
  // Init TTS
451
487
  const modelExt = this.resolveModelExt(cfg.model);
452
- console.log('[MODELDBG] initAllRemoteSTT.modelPath (resolved)=', modelPath);
453
- console.log('[MODELDBG] initAllRemoteSTT.modelExt (resolved)=', modelExt);
488
+ dbg('[MODELDBG] initAllRemoteSTT.modelPath (resolved)=', modelPath);
489
+ dbg('[MODELDBG] initAllRemoteSTT.modelExt (resolved)=', modelExt);
454
490
  await NativeTTS.initTTS({ model: modelPath, modelExt });
455
491
  await sleep(500);
456
492
  }
@@ -488,13 +524,13 @@ class Speech {
488
524
 
489
525
  dbgModel(label: string, model: any) {
490
526
  try {
491
- console.log(`[MODELDBG] ${label} typeof=`, typeof model, ' value=', model);
527
+ dbg(`[MODELDBG] ${label} typeof=`, typeof model, ' value=', model);
492
528
  try {
493
529
  const asset = resolveAssetSource(model);
494
- console.log(`[MODELDBG] ${label} resolveAssetSource=`, asset);
495
- if (asset?.uri) console.log(`[MODELDBG] ${label} asset.uri=`, asset.uri);
530
+ dbg(`[MODELDBG] ${label} resolveAssetSource=`, asset);
531
+ if (asset?.uri) dbg(`[MODELDBG] ${label} asset.uri=`, asset.uri);
496
532
  } catch (e) {
497
- console.log(`[MODELDBG] ${label} resolveAssetSource threw:`, String(e));
533
+ dbg(`[MODELDBG] ${label} resolveAssetSource threw:`, String(e));
498
534
  }
499
535
  } catch {}
500
536
  }
@@ -536,7 +572,7 @@ class Speech {
536
572
  this.wavChain = Promise.resolve();
537
573
 
538
574
  const modelPath = this.resolveModelToPath(opts.model);
539
- console.log('[MODELDBG] initAll.modelPath (resolved)=', modelPath);
575
+ dbg('[MODELDBG] initAll.modelPath (resolved)=', modelPath);
540
576
 
541
577
  this.lastLocale = opts.locale;
542
578
  this.lastModel = modelPath;
@@ -607,7 +643,7 @@ class Speech {
607
643
 
608
644
  // Init TTS
609
645
  const modelExt = this.resolveModelExt(opts.model);
610
- console.log('[MODELDBG] initAll.modelExt (resolved)=', modelExt);
646
+ dbg('[MODELDBG] initAll.modelExt (resolved)=', modelExt);
611
647
  await NativeTTS.initTTS({ model: modelPath, modelExt });
612
648
  this.hasCompletedFullInit = true;
613
649
  this.hasCompletedTtsInit = true;
@@ -795,8 +831,10 @@ class Speech {
795
831
  return this.start(locale);
796
832
  }
797
833
 
798
- // TODO: CHECK THE NATIVE SIDE DOES NOT REALLY AWAITS
799
- async pauseSpeechRecognition(): Promise<void> {
834
+ // Android: native pauseSpeechRecognitionLite is now bounded internally (~1.5s, see
835
+ // STT.kt runPauseResumeSerializedOnMain), so this timeout is a backstop, not the
836
+ // primary fix - it guarantees this promise settles even if the bridge itself stalls.
837
+ async pauseSpeechRecognition(timeoutMs: number = 2500): Promise<void> {
800
838
  this.logCall('pauseSpeechRecognitionLite');
801
839
  const startedAt = Date.now();
802
840
 
@@ -830,18 +868,18 @@ class Speech {
830
868
  return;
831
869
  }
832
870
 
833
- await new Promise<void>((resolve, reject) => {
834
- try {
871
+ await androidCallbackWithTimeout<void>(
872
+ (done) => {
835
873
  fn.call(mod, async (ok: boolean) => {
836
874
  if (!ok) dbgErr('pauseSpeechRecognitionLite returned false');
837
875
  // ✅ ANDROID: small delay before resolving
838
876
  if (Platform.OS === 'android') await sleep(500);
839
- resolve();
877
+ done(undefined);
840
878
  });
841
- } catch (e) {
842
- reject(e as any);
843
- }
844
- });
879
+ },
880
+ timeoutMs,
881
+ 'pauseSpeechRecognitionLite',
882
+ );
845
883
  };
846
884
 
847
885
  if (PROBABLY_GPT_MISTAKE) {
@@ -907,23 +945,23 @@ class Speech {
907
945
  });
908
946
  return;
909
947
  }
910
- await new Promise<void>((resolve, reject) => {
911
- try {
912
- const done = async (ok: boolean) => {
948
+ await androidCallbackWithTimeout<void>(
949
+ (done) => {
950
+ const nativeDone = async (ok: boolean) => {
913
951
  if (!ok) dbgErr('unPauseSpeechRecognitionLite(times) returned false');
914
952
  // ✅ ANDROID: small delay before resolving
915
953
  if (Platform.OS === 'android') await sleep(500);
916
- resolve();
954
+ done(undefined);
917
955
  };
918
956
  if (Platform.OS === 'android' && preFetchMs > 0 && typeof mod?.unPauseSpeechRecognitionLiteWithPreFetch === 'function') {
919
- mod.unPauseSpeechRecognitionLiteWithPreFetch(times, preFetchMs, done);
957
+ mod.unPauseSpeechRecognitionLiteWithPreFetch(times, preFetchMs, nativeDone);
920
958
  return;
921
959
  }
922
- fn.call(mod, times, done);
923
- } catch (e) {
924
- reject(e as any);
925
- }
926
- });
960
+ fn.call(mod, times, nativeDone);
961
+ },
962
+ timeoutMs,
963
+ 'unPauseSpeechRecognitionLite',
964
+ );
927
965
  };
928
966
 
929
967
  if (PROBABLY_GPT_MISTAKE) {
@@ -936,7 +974,7 @@ class Speech {
936
974
  }
937
975
  /** Pause mic/STT (Android native; iOS unified if present) */
938
976
  async pauseMicrophone(): Promise<void> {
939
- console.log('[pauseMicrophone] called');
977
+ dbg('[pauseMicrophone] called');
940
978
  this.logCall('pauseMicrophone');
941
979
  // iOS: prefer async first, fallback to callback if missing
942
980
  if (Platform.OS === 'ios' && (NativeSpeech as any)?.pauseMicrophoneAsync) {
@@ -952,7 +990,7 @@ class Speech {
952
990
  }
953
991
  }
954
992
  if (Platform.OS === 'ios' && NativeSpeech?.pauseMicrophone) {
955
- console.log('IOS [pauseMicrophone] called');
993
+ dbg('IOS [pauseMicrophone] called');
956
994
  return new Promise((resolve, reject) => {
957
995
  try { (NativeSpeech as any).pauseMicrophone(() => resolve()); }
958
996
  catch (e) { reject(e as any); }
@@ -983,14 +1021,14 @@ class Speech {
983
1021
  }
984
1022
 
985
1023
  if (Platform.OS === 'ios' && NativeSpeech?.unPauseMicrophone) {
986
- console.log('IOS [unPauseMicrophone] called');
1024
+ dbg('IOS [unPauseMicrophone] called');
987
1025
  return new Promise((resolve, reject) => {
988
1026
  try { (NativeSpeech as any).unPauseMicrophone(() => resolve()); }
989
1027
  catch (e) { reject(e as any); }
990
1028
  });
991
1029
  }
992
1030
  if (Platform.OS === 'ios')
993
- console.log('IOS [unPauseMicrophone] called without native support');
1031
+ dbg('IOS [unPauseMicrophone] called without native support');
994
1032
  if (!(NativeSTT as any)?.unPauseMicrophone) return Promise.resolve();
995
1033
  return new Promise((resolve, reject) => {
996
1034
  try { (NativeSTT as any).unPauseMicrophone(() => resolve()); }
@@ -1232,11 +1270,11 @@ class Speech {
1232
1270
 
1233
1271
  async playWav(pathOrURL: any, markAsLast = true) {
1234
1272
  // ✅ KEEP ALL YOUR EXISTING LOGGING + resolveAssetSource LOGIC
1235
- console.log('[Speech.playWav] called with:', pathOrURL, '| type:', typeof pathOrURL);
1273
+ dbg('[Speech.playWav] called with:', pathOrURL, '| type:', typeof pathOrURL);
1236
1274
  this.dbgAsset('playWav.arg', pathOrURL);
1237
1275
 
1238
1276
  const asset = resolveAssetSource(pathOrURL);
1239
- console.log('[Speech.playWav] resolveAssetSource ->', asset);
1277
+ dbg('[Speech.playWav] resolveAssetSource ->', asset);
1240
1278
 
1241
1279
  let realPath = asset?.uri ?? pathOrURL;
1242
1280
  if (Platform.OS === 'android' && typeof asset?.uri === 'string') {
@@ -1244,14 +1282,14 @@ class Speech {
1244
1282
  realPath = asset.uri;
1245
1283
  }
1246
1284
 
1247
- console.log('[Speech.playWav] resolved realPath:', realPath);
1285
+ dbg('[Speech.playWav] resolved realPath:', realPath);
1248
1286
 
1249
1287
  if (typeof realPath !== 'string') {
1250
1288
  realPath = String(realPath);
1251
- console.log('[Speech.playWav] converted ?? realPath:', realPath);
1289
+ dbg('[Speech.playWav] converted ?? realPath:', realPath);
1252
1290
  }
1253
1291
 
1254
- console.log('[Speech.playWav] before checking ios realPath:', realPath);
1292
+ dbg('[Speech.playWav] before checking ios realPath:', realPath);
1255
1293
 
1256
1294
  // ✅ IMPORTANT: separate logic per platform + queue only when markAsLast=true
1257
1295
  this.ensureListeners();
@@ -1267,15 +1305,15 @@ class Speech {
1267
1305
  return (NativeSpeech as any).playWav(realPath, false);
1268
1306
  }
1269
1307
 
1270
- console.log('[Speech.playWav] after checking ios realPath:', realPath);
1271
- console.log('[Speech.playWav] after checking ios realPath:', typeof realPath);
1308
+ dbg('[Speech.playWav] after checking ios realPath:', realPath);
1309
+ dbg('[Speech.playWav] after checking ios realPath:', typeof realPath);
1272
1310
 
1273
1311
  if (!NativeTTS?.playWav) {
1274
- console.log('[Speech.playWav] NativeTTS:', NativeTTS);
1275
- if (NativeTTS) console.log('[Speech.playWav] NativeTTS.playWav :', NativeTTS.playWav);
1312
+ dbg('[Speech.playWav] NativeTTS:', NativeTTS);
1313
+ if (NativeTTS) dbg('[Speech.playWav] NativeTTS.playWav :', NativeTTS.playWav);
1276
1314
  throw new Error('playWav not available on this platform.');
1277
1315
  }
1278
- console.log('[Speech.playWav] calling NativeTTS.playWav with type of realPath:', typeof realPath);
1316
+ dbg('[Speech.playWav] calling NativeTTS.playWav with type of realPath:', typeof realPath);
1279
1317
  return (NativeTTS as any).playWav(realPath, false);
1280
1318
  }
1281
1319
 
package/stt/index.ts CHANGED
@@ -1,6 +1,13 @@
1
1
  // stt/index.ts
2
2
  import { NativeModules, NativeEventEmitter, Platform } from 'react-native';
3
3
 
4
+ const DEBUG_LOGS_ENABLED = false;
5
+ function debugLog(...args: any[]) {
6
+ if (!DEBUG_LOGS_ENABLED) return;
7
+ // eslint-disable-next-line no-console
8
+ console.log(...args);
9
+ }
10
+
4
11
  // Prefer new names; gracefully fall back to legacy names during migration.
5
12
  const STTNative =
6
13
  NativeModules.STT ||
@@ -9,7 +16,7 @@ const STTNative =
9
16
  NativeModules.RCTVoice;
10
17
 
11
18
  if (STTNative) {
12
- console.log('STTNative loaded:', Object.keys(STTNative));
19
+ debugLog('STTNative loaded:', Object.keys(STTNative));
13
20
  } else {
14
21
  console.error('STT native module is not linked correctly.');
15
22
  }
@@ -1,9 +1,15 @@
1
1
  import { NativeModules, NativeEventEmitter, Platform } from 'react-native';
2
2
 
3
+ const DEBUG_LOGS_ENABLED = false;
4
+ function debugLog(...args) {
5
+ if (!DEBUG_LOGS_ENABLED) return;
6
+ console.log(...args);
7
+ }
8
+
3
9
  const { DaVoiceTTSBridge } = NativeModules;
4
10
 
5
11
  if (DaVoiceTTSBridge) {
6
- console.log('DaVoiceTTSBridge is loaded:', DaVoiceTTSBridge);
12
+ debugLog('DaVoiceTTSBridge is loaded:', DaVoiceTTSBridge);
7
13
  } else {
8
14
  console.error('DaVoiceTTSBridge is not linked correctly.');
9
15
  }