react-native-davoice-tts 1.0.345 → 1.0.346

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/android/src/main/java/com/davoice/stt/rn/STTModule.kt +3 -0
  6. package/ios/TTSRNBridge/DaVoiceTTSBridge.m +24 -1
  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 +8276 -8256
  9. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.private.swiftinterface +57 -57
  10. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.swiftinterface +57 -57
  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 +5766 -5746
  13. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +63 -63
  14. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftinterface +63 -63
  15. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.abi.json +5766 -5746
  16. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +63 -63
  17. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +63 -63
  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 -24
  21. package/package.json +1 -1
  22. package/speech/index.ts +83 -17
@@ -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.245" # Update to your package version
5
+ s.version = "1.0.248" # 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
- 31339323b8cc47df42fbc34611b21639 tts-1.0.0.aar
1
+ bd97a4af4a770e3cc8f004ed838378bc tts-1.0.0.aar
@@ -1 +1 @@
1
- dfb8006150a99e45bd872ce911b1e890b920c93d tts-1.0.0.aar
1
+ d6f35be0cf970cfafd23ef6ab3283b98ea8b9458 tts-1.0.0.aar
@@ -6,6 +6,7 @@ import com.facebook.react.modules.core.DeviceEventManagerModule
6
6
  import com.davoice.stt.STT
7
7
  import com.davoice.stt.STTDelegate
8
8
  import com.davoice.tts.LicenseManager
9
+ import android.util.Log
9
10
 
10
11
  @ReactModule(name = STTModule.NAME)
11
12
  class STTModule(private val rc: ReactApplicationContext)
@@ -22,6 +23,7 @@ class STTModule(private val rc: ReactApplicationContext)
22
23
  @ReactMethod fun removeListeners(count: Double) {}
23
24
 
24
25
  private fun send(name: String, body: WritableMap? = null) {
26
+ Log.w("STTModule", "[RNDBG] emitting $name to JS")
25
27
  rc.runOnUiQueueThread {
26
28
  rc.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
27
29
  .emit(name, body)
@@ -225,6 +227,7 @@ class STTModule(private val rc: ReactApplicationContext)
225
227
  }
226
228
 
227
229
  override fun onSpeechPartialResults(list: List<String>) {
230
+ Log.w("STTModule", "[RNDBG] onSpeechPartialResults delegate reached size=${list.size}")
228
231
  val arr = Arguments.createArray().apply { list.forEach { pushString(it) } }
229
232
  val m = Arguments.createMap().apply { putArray("value", arr) }
230
233
  send("onSpeechPartialResults", m)
@@ -99,7 +99,9 @@ RCT_EXPORT_METHOD(initTTS:(NSDictionary *)configDict
99
99
  return;
100
100
  }
101
101
 
102
- NSURL *modelURL = [NSURL fileURLWithPath:modelPath];
102
+ NSURL *modelURL = [modelPath hasPrefix:@"file://"]
103
+ ? [NSURL URLWithString:modelPath]
104
+ : [NSURL fileURLWithPath:modelPath];
103
105
 
104
106
  dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), ^{
105
107
  NSError *error = nil;
@@ -110,6 +112,9 @@ RCT_EXPORT_METHOD(initTTS:(NSDictionary *)configDict
110
112
  }
111
113
 
112
114
  dispatch_async(dispatch_get_main_queue(), ^{
115
+ if (self.ttsInstance) {
116
+ @try { [self.ttsInstance stopSpeaking]; [self.ttsInstance destroy]; } @catch (__unused id e) {}
117
+ }
113
118
  self.ttsInstance = tts;
114
119
 
115
120
  __weak typeof(self) weakSelf = self;
@@ -142,6 +147,24 @@ RCT_EXPORT_METHOD(initTTS:(NSDictionary *)configDict
142
147
  });
143
148
  }
144
149
 
150
+ RCT_EXPORT_METHOD(speakWithSpeed:(NSString *)text
151
+ speakerId:(nonnull NSNumber *)speakerId
152
+ speed:(nonnull NSNumber *)speed
153
+ resolver:(RCTPromiseResolveBlock)resolve
154
+ rejecter:(RCTPromiseRejectBlock)reject)
155
+ {
156
+ if (!self.ttsInstance) {
157
+ reject(@"no_instance", @"TTS not initialized", nil);
158
+ return;
159
+ }
160
+
161
+ dispatch_async(dispatch_get_main_queue(), ^{
162
+ float s = speed ? speed.floatValue : 1.0f;
163
+ [self.ttsInstance speak:text sid:speakerId.intValue speed:s];
164
+ resolve(@"Speaking");
165
+ });
166
+ }
167
+
145
168
  RCT_EXPORT_METHOD(stopSpeaking:(RCTPromiseResolveBlock)resolve
146
169
  rejecter:(RCTPromiseRejectBlock)reject)
147
170
  {