react-native-davoice-tts 1.0.285 → 1.0.286

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.158" # Update to your package version
5
+ s.version = "1.0.159" # 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 .
@@ -39,9 +39,19 @@ class STTModule(private val rc: ReactApplicationContext)
39
39
  // ANDROID expects (locale, options, callback) like @react-native-voice
40
40
  @ReactMethod
41
41
  fun startSpeech(locale: String?, options: ReadableMap, cb: Callback) {
42
- // If you want, you can read options here (EXTRA_PARTIAL_RESULTS, etc.)
43
- // val wantPartials = if (options.hasKey("EXTRA_PARTIAL_RESULTS")) options.getBoolean("EXTRA_PARTIAL_RESULTS") else true
44
- ensure().startSpeech(locale)
42
+ var onboardingJson: String? = null
43
+ try {
44
+ if (options.hasKey("onboardingJsonPath") && !options.isNull("onboardingJsonPath")) {
45
+ val p = options.getString("onboardingJsonPath")
46
+ if (!p.isNullOrBlank()) {
47
+ onboardingJson = java.io.File(p).readText(Charsets.UTF_8)
48
+ }
49
+ }
50
+ } catch (_: Throwable) {
51
+ onboardingJson = null
52
+ }
53
+
54
+ ensure().startSpeech(locale, onboardingJson, null)
45
55
  cb.invoke(false) // parity with voice: callback(false) on success
46
56
  }
47
57
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-davoice-tts",
3
- "version": "1.0.285",
3
+ "version": "1.0.286",
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
@@ -419,6 +419,7 @@ class Speech {
419
419
  EXTRA_MAX_RESULTS: 5,
420
420
  EXTRA_PARTIAL_RESULTS: true,
421
421
  REQUEST_PERMISSIONS_AUTO: true,
422
+ onboardingJsonPath: opts.onboardingJsonPath ?? null,
422
423
  },
423
424
  (err: string) => (err ? reject(new Error(err)) : resolve())
424
425
  );