react-native-davoice 1.0.8 → 1.0.10

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.
@@ -2,7 +2,7 @@ require 'json'
2
2
 
3
3
  Pod::Spec.new do |s|
4
4
  s.name = "TTSRNBridge"
5
- s.version = "1.0.191" # Update to your package version
5
+ s.version = "1.0.194" # Update to your package version
6
6
  s.summary = "TTS for React Native."
7
7
  s.description = <<-DESC
8
8
  A React Native module for tts .
@@ -1 +1 @@
1
- dd2b50d07ff256989600f071c66d4227 tts-1.0.0.aar
1
+ 42672253290af681c13e0c48a8ea05dd tts-1.0.0.aar
@@ -1 +1 @@
1
- f351faff177e5d8cba9faacd5bf97da0accb10b0 tts-1.0.0.aar
1
+ db50ab0dec3bc798242d72f812bf5d7b4f87ed0d tts-1.0.0.aar
@@ -138,6 +138,19 @@ class STTModule(private val rc: ReactApplicationContext)
138
138
  cb.invoke(true)
139
139
  }
140
140
 
141
+ @ReactMethod
142
+ fun unPauseSpeechRecognitionLiteWithPreFetch(times: Double, preFetchMs: Double, cb: Callback) {
143
+ if (stt == null) {
144
+ cb.invoke(true)
145
+ return
146
+ }
147
+
148
+ val t = times.toInt()
149
+ val ms = preFetchMs.toInt().coerceIn(0, 2000)
150
+ stt?.unPauseSpeechRecognitionLite(t, ms)
151
+ cb.invoke(true)
152
+ }
153
+
141
154
  @ReactMethod
142
155
  fun pauseMicrophone(cb: Callback) {
143
156
  ensure().pauseMicrophone()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-davoice",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
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
@@ -588,12 +588,17 @@ class Speech {
588
588
  }
589
589
  return new Promise<void>((resolve, reject) => {
590
590
  try {
591
- fn.call(mod, times, async (ok: boolean) => {
591
+ const done = async (ok: boolean) => {
592
592
  if (!ok) dbgErr('unPauseSpeechRecognitionLite(times) returned false');
593
593
  // ✅ ANDROID: small delay before resolving
594
594
  if (Platform.OS === 'android') await sleep(500);
595
595
  resolve();
596
- });
596
+ };
597
+ if (Platform.OS === 'android' && preFetchMs > 0 && typeof mod?.unPauseSpeechRecognitionLiteWithPreFetch === 'function') {
598
+ mod.unPauseSpeechRecognitionLiteWithPreFetch(times, preFetchMs, done);
599
+ return;
600
+ }
601
+ fn.call(mod, times, done);
597
602
  } catch (e) {
598
603
  reject(e as any);
599
604
  }