react-native-davoice-tts 1.0.7 → 1.0.9

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.
@@ -1 +1 @@
1
- 816ef1673c95bcc0057cde688884d928 tts-1.0.0.aar
1
+ 000421e906a1204cc96c96ee7e901737 tts-1.0.0.aar
@@ -1 +1 @@
1
- de4e7255b5b0db349376cc8034f6ced3ee91bf28 tts-1.0.0.aar
1
+ 8d9b848535ad51fd12426be1f22d01065c3a9e90 tts-1.0.0.aar
@@ -5,6 +5,7 @@ import com.facebook.react.bridge.Promise;
5
5
  import com.facebook.react.bridge.ReactApplicationContext;
6
6
  import com.facebook.react.bridge.ReactContextBaseJavaModule;
7
7
  import com.facebook.react.bridge.ReactMethod;
8
+ import com.facebook.react.bridge.ReadableMap;
8
9
 
9
10
  /**
10
11
  * Minimal RN bridge:
@@ -28,14 +29,21 @@ public class DaVoiceTTSBridge extends ReactContextBaseJavaModule {
28
29
  }
29
30
 
30
31
  @ReactMethod
31
- public void initTTS(String modelName, Promise promise) {
32
+ public void initTTS(ReadableMap config, Promise promise) {
32
33
  try {
33
- // Defaults match your AAR behavior
34
+ if (config == null || !config.hasKey("model") || config.isNull("model")) {
35
+ promise.reject("invalid_config", "Missing required 'model' key");
36
+ return;
37
+ }
38
+ final String modelName = config.getString("model");
39
+ // AAR handles the rest (tokens=<model>.json, espeak dir, etc.)
34
40
  DaVoiceTTSInterface.Config cfg = new DaVoiceTTSInterface.Config(
35
- modelName, // e.g., "model.onnx"
36
- "en-US", // default voice
37
- "phonemes_dir" // asset dir name
41
+ modelName, // e.g. "model.onnx"
42
+ "en-US", // default voice (ignored/overridden by AAR if needed)
43
+ "phonemes_dir" // asset dir name (AAR copies recursively)
38
44
  );
45
+
46
+
39
47
  boolean ok = tts.initTTS(cfg);
40
48
  if (!ok) {
41
49
  promise.reject("InitFailed", "Engine/TTS init failed");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-davoice-tts",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "tts library for React Native",
5
5
  "main": "tts/index.js",
6
6
  "types": "tts/index.d.ts",
@@ -1,6 +1,6 @@
1
1
  export class DaVoiceTTSInstance {
2
2
  constructor(instanceId?: string);
3
3
  instanceId: string;
4
- initTTS(config: any): Promise<any>;
4
+ initTTS(modelName: any): Promise<any>;
5
5
  speak(text: any, speakerId?: number): Promise<any>;
6
6
  }