react-native-davoice-tts 1.0.259 → 1.0.260

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.132" # Update to your package version
5
+ s.version = "1.0.133" # 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 .
@@ -317,6 +317,22 @@ RCT_EXPORT_METHOD(initAll:(NSDictionary *)opts
317
317
  });
318
318
  }
319
319
 
320
+ // --- SpeechRecognitionLite pause/unpause (counter-based) ---
321
+
322
+ RCT_EXPORT_METHOD(pauseSpeechRecognitionLite:(RCTResponseSenderBlock)callback)
323
+ {
324
+ if (!self.stt) { if (callback) callback(@[@(NO)]); return; }
325
+ [self.stt pauseSpeechRecognitionLite];
326
+ if (callback) callback(@[@(YES)]);
327
+ }
328
+
329
+ RCT_EXPORT_METHOD(unPauseSpeechRecognitionLite:(RCTResponseSenderBlock)callback)
330
+ {
331
+ if (!self.stt) { if (callback) callback(@[@(NO)]); return; }
332
+ [self.stt unPauseSpeechRecognitionLite];
333
+ if (callback) callback(@[@(YES)]);
334
+ }
335
+
320
336
  // Promise-based pause that resolves ONLY when iOS is actually settled in playback (mic released)
321
337
  RCT_EXPORT_METHOD(pauseMicrophoneAsync:(nonnull NSNumber *)timeoutMs
322
338
  resolver:(RCTPromiseResolveBlock)resolve
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-davoice-tts",
3
- "version": "1.0.259",
3
+ "version": "1.0.260",
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
@@ -409,6 +409,49 @@ class Speech {
409
409
  });
410
410
  }
411
411
 
412
+ // ---------- iOS-only: SpeechRecognitionLite pause/unpause ----------
413
+ pauseSpeechRecognition(): Promise<void> {
414
+ this.logCall('pauseSpeechRecognitionLite');
415
+ if (Platform.OS !== 'ios') return Promise.resolve();
416
+
417
+ if (!(NativeSpeech as any)?.pauseSpeechRecognitionLite) {
418
+ dbg('iOS pauseSpeechRecognitionLite not available on NativeSpeech');
419
+ return Promise.resolve();
420
+ }
421
+
422
+ return new Promise((resolve, reject) => {
423
+ try {
424
+ (NativeSpeech as any).pauseSpeechRecognitionLite((ok: boolean) => {
425
+ if (!ok) dbgErr('pauseSpeechRecognitionLite returned false');
426
+ resolve();
427
+ });
428
+ } catch (e) {
429
+ reject(e as any);
430
+ }
431
+ });
432
+ }
433
+
434
+ unPauseSpeechRecognition(): Promise<void> {
435
+ this.logCall('unPauseSpeechRecognitionLite');
436
+ if (Platform.OS !== 'ios') return Promise.resolve();
437
+
438
+ if (!(NativeSpeech as any)?.unPauseSpeechRecognitionLite) {
439
+ dbg('iOS unPauseSpeechRecognitionLite not available on NativeSpeech');
440
+ return Promise.resolve();
441
+ }
442
+
443
+ return new Promise((resolve, reject) => {
444
+ try {
445
+ (NativeSpeech as any).unPauseSpeechRecognitionLite((ok: boolean) => {
446
+ if (!ok) dbgErr('unPauseSpeechRecognitionLite returned false');
447
+ resolve();
448
+ });
449
+ } catch (e) {
450
+ reject(e as any);
451
+ }
452
+ });
453
+ }
454
+
412
455
  /** Pause mic/STT (Android native; iOS unified if present) */
413
456
  async pauseMicrophone(): Promise<void> {
414
457
  console.log('[pauseMicrophone] called');