react-native-davoice-tts 1.0.42 → 1.0.43

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 (32) hide show
  1. package/TTSRNBridge.podspec +6 -1
  2. package/ios/STTRNBridge/STTBridge.h +7 -0
  3. package/ios/STTRNBridge/STTBridge.m +109 -0
  4. package/ios/TTSRNBridge/DavoiceTTS.xcframework/Info.plist +5 -5
  5. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/DavoiceTTS +0 -0
  6. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Headers/DavoiceTTS-Swift.h +27 -0
  7. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Info.plist +0 -0
  8. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.abi.json +1829 -934
  9. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.private.swiftinterface +27 -4
  10. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  11. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.swiftinterface +27 -4
  12. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/module.modulemap +0 -0
  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/Headers/DavoiceTTS-Swift.h +54 -0
  15. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Info.plist +0 -0
  16. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.abi.json +1829 -934
  17. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +27 -4
  18. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  19. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftinterface +27 -4
  20. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.abi.json +1829 -934
  21. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +27 -4
  22. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  23. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +27 -4
  24. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/module.modulemap +0 -0
  25. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeDirectory +0 -0
  26. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeRequirements +0 -0
  27. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeRequirements-1 +0 -0
  28. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeResources +28 -28
  29. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeSignature +0 -0
  30. package/package.json +2 -1
  31. package/stt/index.d.ts +52 -0
  32. package/stt/index.ts +202 -0
@@ -16,7 +16,12 @@ Pod::Spec.new do |s|
16
16
 
17
17
  # s.source_files = "ios/*.{h,m,mm,swift}"
18
18
  # s.resources = "ios/TTSRNBridge/models/*"
19
- s.source_files = 'ios/TTSRNBridge/DaVoiceTTSBridge.m', 'ios/TTSRNBridge/DaVoiceTTSBridge.h'
19
+ # s.source_files = 'ios/TTSRNBridge/DaVoiceTTSBridge.m', 'ios/TTSRNBridge/DaVoiceTTSBridge.h'
20
+ s.source_files = [
21
+ "ios/TTSRNBridge/DaVoiceTTSBridge.{h,m}",
22
+ "ios/STTRNBridge/STTBridge.{h,m}",
23
+ "ios/STT/**/*.{swift}"
24
+ ]
20
25
 
21
26
  #s.static_framework = true
22
27
  # Add your static libraries explicitly as vendored_libraries
@@ -0,0 +1,7 @@
1
+ #import <React/RCTEventEmitter.h>
2
+ #import <React/RCTBridgeModule.h>
3
+
4
+ @class STT; // from Swift
5
+
6
+ @interface STTBridge : RCTEventEmitter <RCTBridgeModule>
7
+ @end
@@ -0,0 +1,109 @@
1
+ #import "STTBridge.h"
2
+ #import <React/RCTLog.h>
3
+ #import <React/RCTConvert.h>
4
+
5
+ // Import the generated Swift header for your target.
6
+ // Replace "YourTargetName-Swift.h" with your actual target name.
7
+ #import "YourTargetName-Swift.h"
8
+
9
+ @interface STTBridge () <STTDelegate>
10
+ @property (nonatomic, strong, nullable) STT *stt;
11
+ @property (nonatomic, assign) BOOL hasListeners;
12
+ @end
13
+
14
+ @implementation STTBridge
15
+
16
+ RCT_EXPORT_MODULE(STT) // matches NativeModules.STT in stt/index.ts
17
+
18
+ + (BOOL)requiresMainQueueSetup { return YES; }
19
+
20
+ - (NSArray<NSString *> *)supportedEvents
21
+ {
22
+ // Keep event names EXACTLY as the native STT emits.
23
+ return @[
24
+ @"onSpeechResults",
25
+ @"onSpeechStart",
26
+ @"onSpeechPartialResults",
27
+ @"onSpeechError",
28
+ @"onSpeechEnd",
29
+ @"onSpeechRecognized",
30
+ @"onSpeechVolumeChanged"
31
+ ];
32
+ }
33
+
34
+ - (void)startObserving { self.hasListeners = YES; }
35
+ - (void)stopObserving { self.hasListeners = NO; }
36
+ - (dispatch_queue_t)methodQueue { return dispatch_get_main_queue(); }
37
+
38
+ - (void)dealloc {
39
+ // Tear down safely
40
+ [self.stt destroySpeech:^(id _){}]; // optional; or call a direct Swift method if you exposed one
41
+ self.stt = nil;
42
+ }
43
+
44
+ #pragma mark - STTDelegate (from Swift)
45
+ - (void)stt:(STT *)stt didEmitEvent:(NSString *)name body:(NSDictionary *)body
46
+ {
47
+ if (!self.hasListeners) return;
48
+ [self sendEventWithName:name body:body ?: @{}];
49
+ }
50
+
51
+ #pragma mark - Helpers
52
+ - (void)ensureSTT {
53
+ if (!self.stt) {
54
+ self.stt = [STT new];
55
+ self.stt.delegate = self;
56
+ }
57
+ }
58
+
59
+ #pragma mark - API (match your JS contract)
60
+
61
+ RCT_EXPORT_METHOD(startSpeech:(NSString *)locale
62
+ callback:(RCTResponseSenderBlock)callback)
63
+ {
64
+ [self ensureSTT];
65
+ [self.stt startSpeechWithLocaleStr:locale];
66
+ // parity with old Voice bridge: immediately callback with "false"
67
+ if (callback) callback(@[@(NO)]);
68
+ }
69
+
70
+ RCT_EXPORT_METHOD(stopSpeech:(RCTResponseSenderBlock)callback)
71
+ {
72
+ if (!self.stt) { if (callback) callback(@[@(NO)]); return; }
73
+ [self.stt stopSpeech:^(BOOL _){}];
74
+ if (callback) callback(@[@(NO)]);
75
+ }
76
+
77
+ RCT_EXPORT_METHOD(cancelSpeech:(RCTResponseSenderBlock)callback)
78
+ {
79
+ if (!self.stt) { if (callback) callback(@[@(NO)]); return; }
80
+ [self.stt cancelSpeech:^(BOOL _){}];
81
+ if (callback) callback(@[@(NO)]);
82
+ }
83
+
84
+ RCT_EXPORT_METHOD(destroySpeech:(RCTResponseSenderBlock)callback)
85
+ {
86
+ if (self.stt) {
87
+ [self.stt destroySpeech:^(BOOL _){}];
88
+ self.stt = nil;
89
+ }
90
+ if (callback) callback(@[@(NO)]);
91
+ }
92
+
93
+ RCT_EXPORT_METHOD(isSpeechAvailable:(RCTResponseSenderBlock)callback)
94
+ {
95
+ [STT new]; // ensures class is loaded; optional
96
+ // Call the Swift closure-based API
97
+ STT *tmp = self.stt ?: [STT new];
98
+ [tmp isSpeechAvailable:^(BOOL ok){
99
+ if (callback) callback(@[@(ok ? 1 : 0), [NSNull null]]);
100
+ }];
101
+ }
102
+
103
+ RCT_EXPORT_METHOD(isRecognizing:(RCTResponseSenderBlock)callback)
104
+ {
105
+ BOOL running = self.stt ? [self.stt isRecognizing] : NO;
106
+ if (callback) callback(@[@(running ? 1 : 0)]);
107
+ }
108
+
109
+ @end
@@ -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_x86_64-simulator</string>
11
+ <string>ios-arm64</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>
18
17
  </array>
19
18
  <key>SupportedPlatform</key>
20
19
  <string>ios</string>
21
- <key>SupportedPlatformVariant</key>
22
- <string>simulator</string>
23
20
  </dict>
24
21
  <dict>
25
22
  <key>BinaryPath</key>
26
23
  <string>DavoiceTTS.framework/DavoiceTTS</string>
27
24
  <key>LibraryIdentifier</key>
28
- <string>ios-arm64</string>
25
+ <string>ios-arm64_x86_64-simulator</string>
29
26
  <key>LibraryPath</key>
30
27
  <string>DavoiceTTS.framework</string>
31
28
  <key>SupportedArchitectures</key>
32
29
  <array>
33
30
  <string>arm64</string>
31
+ <string>x86_64</string>
34
32
  </array>
35
33
  <key>SupportedPlatform</key>
36
34
  <string>ios</string>
35
+ <key>SupportedPlatformVariant</key>
36
+ <string>simulator</string>
37
37
  </dict>
38
38
  </array>
39
39
  <key>CFBundlePackageType</key>
@@ -282,7 +282,9 @@ typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4)));
282
282
  #pragma clang diagnostic ignored "-Watimport-in-framework-header"
283
283
  #endif
284
284
  @import AVFAudio;
285
+ @import Foundation;
285
286
  @import ObjectiveC;
287
+ @import Speech;
286
288
  #endif
287
289
 
288
290
  #endif
@@ -324,6 +326,31 @@ SWIFT_CLASS("_TtC10DavoiceTTS10DaVoiceTTS")
324
326
  + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
325
327
  @end
326
328
 
329
+ @protocol STTDelegate;
330
+ @class SFSpeechRecognizer;
331
+ SWIFT_CLASS("_TtC10DavoiceTTS3STT")
332
+ @interface STT : NSObject <SFSpeechRecognizerDelegate>
333
+ @property (nonatomic, weak) id <STTDelegate> _Nullable delegate;
334
+ @property (nonatomic) BOOL continuous;
335
+ SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSArray<NSString *> * _Nonnull supportedEvents;)
336
+ + (NSArray<NSString *> * _Nonnull)supportedEvents SWIFT_WARN_UNUSED_RESULT;
337
+ - (void)isSpeechAvailable:(void (^ _Nonnull)(BOOL))completion;
338
+ - (BOOL)isRecognizing SWIFT_WARN_UNUSED_RESULT;
339
+ - (void)startSpeechWithLocaleStr:(NSString * _Nullable)localeStr;
340
+ - (void)stopSpeech:(void (^ _Nullable)(BOOL))completion;
341
+ - (void)cancelSpeech:(void (^ _Nullable)(BOOL))completion;
342
+ - (void)destroySpeech:(void (^ _Nullable)(BOOL))completion;
343
+ - (void)teardown;
344
+ - (void)teardown2;
345
+ - (void)speechRecognizer:(SFSpeechRecognizer * _Nonnull)speechRecognizer availabilityDidChange:(BOOL)available;
346
+ - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
347
+ @end
348
+
349
+ SWIFT_PROTOCOL("_TtP10DavoiceTTS11STTDelegate_")
350
+ @protocol STTDelegate
351
+ - (void)stt:(STT * _Nonnull)stt didEmitEvent:(NSString * _Nonnull)name body:(NSDictionary<NSString *, id> * _Nullable)body;
352
+ @end
353
+
327
354
  @class AVAudioPlayer;
328
355
  SWIFT_CLASS("_TtC10DavoiceTTS15SwiftSoundQueue")
329
356
  @interface SwiftSoundQueue : NSObject <AVAudioPlayerDelegate>