react-native-davoice-tts 1.0.307 → 1.0.308

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 (22) 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/ios/SpeechBridge/SpeechBridge.m +103 -0
  6. package/ios/TTSRNBridge/DavoiceTTS.xcframework/Info.plist +5 -5
  7. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/DavoiceTTS +0 -0
  8. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.abi.json +10163 -7774
  9. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.private.swiftinterface +75 -35
  10. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.swiftinterface +75 -35
  11. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/DavoiceTTS +0 -0
  12. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.abi.json +2588 -199
  13. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +40 -0
  14. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftinterface +40 -0
  15. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.abi.json +2588 -199
  16. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +40 -0
  17. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +40 -0
  18. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeDirectory +0 -0
  19. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeRequirements-1 +0 -0
  20. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeResources +24 -39
  21. package/package.json +1 -1
  22. package/speech/index.ts +24 -0
@@ -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.180" # Update to your package version
5
+ s.version = "1.0.181" # 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
- 9fa81740346cc323634537859a7a2cb6 tts-1.0.0.aar
1
+ 16d87cc4b6208af65436963ef13db895 tts-1.0.0.aar
@@ -1 +1 @@
1
- e088a037b4b602225ba1029a317b9b74e1f6fa35 tts-1.0.0.aar
1
+ 80fcaf4a39167543a54e4405120c4253eea6beb5 tts-1.0.0.aar
@@ -8,12 +8,23 @@
8
8
  #import <DaVoiceTTS/DaVoiceTTS-Swift.h> // DaVoiceTTS + STT live here in your setup
9
9
 
10
10
  #import <AVFAudio/AVFAudio.h>
11
+ #import <Speech/Speech.h>
11
12
 
12
13
  static NSData *SB_Base64Decode(NSString *b64) {
13
14
  if (!b64 || (id)b64 == [NSNull null]) return nil;
14
15
  return [[NSData alloc] initWithBase64EncodedString:b64 options:0];
15
16
  }
16
17
 
18
+ static BOOL SBHasMicPermission(void) {
19
+ AVAudioSessionRecordPermission permission = [[AVAudioSession sharedInstance] recordPermission];
20
+ return permission == AVAudioSessionRecordPermissionGranted;
21
+ }
22
+
23
+ static BOOL SBHasSpeechRecognitionPermission(void) {
24
+ SFSpeechRecognizerAuthorizationStatus status = [SFSpeechRecognizer authorizationStatus];
25
+ return status == SFSpeechRecognizerAuthorizationStatusAuthorized;
26
+ }
27
+
17
28
  // Make a mono Float32 AVAudioPCMBuffer from raw PCM payload (i16 or f32).
18
29
  // We accept either interleaved or non-interleaved input and mixdown to mono
19
30
  // (DaVoiceTTS.playBuffer will resample / normalize as needed).
@@ -236,6 +247,98 @@ RCT_EXPORT_MODULE(SpeechBridge)
236
247
  };
237
248
  }
238
249
 
250
+ RCT_EXPORT_METHOD(hasMicPermissions:(RCTPromiseResolveBlock)resolve
251
+ rejecter:(RCTPromiseRejectBlock)reject)
252
+ {
253
+ resolve(@(SBHasMicPermission()));
254
+ }
255
+
256
+ RCT_EXPORT_METHOD(requestMicPermissions:(nonnull NSNumber *)wait_timeout
257
+ resolver:(RCTPromiseResolveBlock)resolve
258
+ rejecter:(RCTPromiseRejectBlock)reject)
259
+ {
260
+ dispatch_async(dispatch_get_main_queue(), ^{
261
+ AVAudioSession *audioSession = [AVAudioSession sharedInstance];
262
+ AVAudioSessionRecordPermission permission = audioSession.recordPermission;
263
+ if (permission == AVAudioSessionRecordPermissionGranted) {
264
+ resolve(@YES);
265
+ return;
266
+ }
267
+
268
+ if (permission == AVAudioSessionRecordPermissionDenied) {
269
+ resolve(@NO);
270
+ return;
271
+ }
272
+
273
+ NSTimeInterval timeoutSeconds = MAX(wait_timeout.doubleValue, 0.0) / 1000.0;
274
+ __block BOOL didResolve = NO;
275
+ void (^finish)(BOOL) = ^(BOOL granted) {
276
+ if (didResolve) return;
277
+ didResolve = YES;
278
+ resolve(@(granted));
279
+ };
280
+
281
+ if (timeoutSeconds > 0.0) {
282
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(timeoutSeconds * NSEC_PER_SEC)),
283
+ dispatch_get_main_queue(), ^{
284
+ finish(SBHasMicPermission());
285
+ });
286
+ }
287
+
288
+ [audioSession requestRecordPermission:^(BOOL granted) {
289
+ dispatch_async(dispatch_get_main_queue(), ^{
290
+ finish(granted);
291
+ });
292
+ }];
293
+ });
294
+ }
295
+
296
+ RCT_EXPORT_METHOD(hasSpeechRecognitionPermissions:(RCTPromiseResolveBlock)resolve
297
+ rejecter:(RCTPromiseRejectBlock)reject)
298
+ {
299
+ resolve(@(SBHasSpeechRecognitionPermission()));
300
+ }
301
+
302
+ RCT_EXPORT_METHOD(requestSpeechRecognitionPermissions:(nonnull NSNumber *)wait_timeout
303
+ resolver:(RCTPromiseResolveBlock)resolve
304
+ rejecter:(RCTPromiseRejectBlock)reject)
305
+ {
306
+ dispatch_async(dispatch_get_main_queue(), ^{
307
+ SFSpeechRecognizerAuthorizationStatus status = [SFSpeechRecognizer authorizationStatus];
308
+ if (status == SFSpeechRecognizerAuthorizationStatusAuthorized) {
309
+ resolve(@YES);
310
+ return;
311
+ }
312
+
313
+ if (status == SFSpeechRecognizerAuthorizationStatusDenied ||
314
+ status == SFSpeechRecognizerAuthorizationStatusRestricted) {
315
+ resolve(@NO);
316
+ return;
317
+ }
318
+
319
+ NSTimeInterval timeoutSeconds = MAX(wait_timeout.doubleValue, 0.0) / 1000.0;
320
+ __block BOOL didResolve = NO;
321
+ void (^finish)(BOOL) = ^(BOOL granted) {
322
+ if (didResolve) return;
323
+ didResolve = YES;
324
+ resolve(@(granted));
325
+ };
326
+
327
+ if (timeoutSeconds > 0.0) {
328
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(timeoutSeconds * NSEC_PER_SEC)),
329
+ dispatch_get_main_queue(), ^{
330
+ finish(SBHasSpeechRecognitionPermission());
331
+ });
332
+ }
333
+
334
+ [SFSpeechRecognizer requestAuthorization:^(SFSpeechRecognizerAuthorizationStatus updatedStatus) {
335
+ dispatch_async(dispatch_get_main_queue(), ^{
336
+ finish(updatedStatus == SFSpeechRecognizerAuthorizationStatusAuthorized);
337
+ });
338
+ }];
339
+ });
340
+ }
341
+
239
342
  #pragma mark - Unified API
240
343
 
241
344
  /// initAll({ locale: "en-US", model: "/path/model.onnx", timeoutMs?: 8000 })
@@ -8,32 +8,32 @@
8
8
  <key>BinaryPath</key>
9
9
  <string>DavoiceTTS.framework/DavoiceTTS</string>
10
10
  <key>LibraryIdentifier</key>
11
- <string>ios-arm64</string>
11
+ <string>ios-arm64_x86_64-simulator</string>
12
12
  <key>LibraryPath</key>
13
13
  <string>DavoiceTTS.framework</string>
14
14
  <key>SupportedArchitectures</key>
15
15
  <array>
16
16
  <string>arm64</string>
17
+ <string>x86_64</string>
17
18
  </array>
18
19
  <key>SupportedPlatform</key>
19
20
  <string>ios</string>
21
+ <key>SupportedPlatformVariant</key>
22
+ <string>simulator</string>
20
23
  </dict>
21
24
  <dict>
22
25
  <key>BinaryPath</key>
23
26
  <string>DavoiceTTS.framework/DavoiceTTS</string>
24
27
  <key>LibraryIdentifier</key>
25
- <string>ios-arm64_x86_64-simulator</string>
28
+ <string>ios-arm64</string>
26
29
  <key>LibraryPath</key>
27
30
  <string>DavoiceTTS.framework</string>
28
31
  <key>SupportedArchitectures</key>
29
32
  <array>
30
33
  <string>arm64</string>
31
- <string>x86_64</string>
32
34
  </array>
33
35
  <key>SupportedPlatform</key>
34
36
  <string>ios</string>
35
- <key>SupportedPlatformVariant</key>
36
- <string>simulator</string>
37
37
  </dict>
38
38
  </array>
39
39
  <key>CFBundlePackageType</key>