react-native-davoice-tts 1.0.308 → 1.0.310
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.
- package/TTSRNBridge.podspec +1 -1
- package/android/libs/com/davoice/tts/1.0.0/tts-1.0.0.aar +0 -0
- package/android/libs/com/davoice/tts/1.0.0/tts-1.0.0.aar.md5 +1 -1
- package/android/libs/com/davoice/tts/1.0.0/tts-1.0.0.aar.sha1 +1 -1
- package/android/src/main/java/com/davoice/stt/rn/STTModule.kt +27 -0
- package/android/src/main/java/com/davoice/tts/rn/DaVoiceTTSBridge.java +27 -0
- package/ios/STTRNBridge/STTBridge.m +27 -0
- package/ios/SpeechBridge/SpeechBridge.m +32 -0
- package/ios/TTSRNBridge/DaVoiceTTSBridge.m +30 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/DavoiceTTS +0 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Headers/DavoiceTTS-Swift.h +10 -1
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.abi.json +8340 -10292
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.private.swiftinterface +80 -111
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.swiftinterface +80 -111
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/DavoiceTTS +0 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Headers/DavoiceTTS-Swift.h +20 -2
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.abi.json +8866 -10818
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +80 -111
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftinterface +80 -111
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.abi.json +8866 -10818
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +80 -111
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +80 -111
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeDirectory +0 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeRequirements-1 +0 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeResources +27 -27
- package/package.json +1 -1
- package/speech/index.ts +32 -2
- package/stt/index.d.ts +2 -0
- package/stt/index.ts +20 -0
- package/tts/DaVoiceTTSBridge.d.ts +2 -0
- package/tts/DaVoiceTTSBridge.js +8 -0
package/speech/index.ts
CHANGED
|
@@ -724,6 +724,34 @@ class Speech {
|
|
|
724
724
|
return !!(await NativeSpeech.requestSpeechRecognitionPermissions(wait_timeout));
|
|
725
725
|
}
|
|
726
726
|
|
|
727
|
+
async setLicense(licenseKey: string): Promise<boolean> {
|
|
728
|
+
if (!licenseKey) throw new Error('setLicense: missing licenseKey');
|
|
729
|
+
|
|
730
|
+
if (Platform.OS === 'ios' && NativeSpeech?.setLicense) {
|
|
731
|
+
return !!(await NativeSpeech.setLicense(licenseKey));
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
const results = await Promise.all([
|
|
735
|
+
NativeTTS?.setLicense ? NativeTTS.setLicense(licenseKey) : Promise.resolve(false),
|
|
736
|
+
NativeSTT?.setLicense ? NativeSTT.setLicense(licenseKey) : Promise.resolve(false),
|
|
737
|
+
]);
|
|
738
|
+
return results.every(Boolean);
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
async isLicenseValid(licenseKey: string): Promise<boolean> {
|
|
742
|
+
if (!licenseKey) throw new Error('isLicenseValid: missing licenseKey');
|
|
743
|
+
|
|
744
|
+
if (Platform.OS === 'ios' && NativeSpeech?.isLicenseValid) {
|
|
745
|
+
return !!(await NativeSpeech.isLicenseValid(licenseKey));
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
const results = await Promise.all([
|
|
749
|
+
NativeTTS?.isLicenseValid ? NativeTTS.isLicenseValid(licenseKey) : Promise.resolve(false),
|
|
750
|
+
NativeSTT?.isLicenseValid ? NativeSTT.isLicenseValid(licenseKey) : Promise.resolve(false),
|
|
751
|
+
]);
|
|
752
|
+
return results.every(Boolean);
|
|
753
|
+
}
|
|
754
|
+
|
|
727
755
|
// ---------- TTS ----------
|
|
728
756
|
async initTTS(modelOrConfig: ModelRef | { model: ModelRef }) {
|
|
729
757
|
const cfg =
|
|
@@ -954,7 +982,7 @@ class Speech {
|
|
|
954
982
|
|
|
955
983
|
// iOS unified: subscribe once on the unified emitter
|
|
956
984
|
if (Platform.OS === 'ios' && this.unifiedEmitter) {
|
|
957
|
-
const map: Record<NativeEventName, (...args: any[]) => void
|
|
985
|
+
const map: Partial<Record<NativeEventName, (...args: any[]) => void>> = {
|
|
958
986
|
onSpeechStart: (e) => this.handlers.onSpeechStart(e),
|
|
959
987
|
onSpeechRecognized: (e) => this.handlers.onSpeechRecognized(e),
|
|
960
988
|
onSpeechEnd: (e) => this.handlers.onSpeechEnd(e),
|
|
@@ -966,7 +994,9 @@ class Speech {
|
|
|
966
994
|
};
|
|
967
995
|
(Object.keys(map) as NativeEventName[]).forEach((name) => {
|
|
968
996
|
try {
|
|
969
|
-
const
|
|
997
|
+
const handler = map[name];
|
|
998
|
+
if (!handler) return;
|
|
999
|
+
const sub = this.unifiedEmitter!.addListener(name, handler);
|
|
970
1000
|
this.subs.push(sub);
|
|
971
1001
|
} catch {}
|
|
972
1002
|
});
|
package/stt/index.d.ts
CHANGED
|
@@ -37,6 +37,8 @@ declare class RCTSTT {
|
|
|
37
37
|
start(locale: string, options?: Record<string, any>): Promise<void>;
|
|
38
38
|
stop(): Promise<void>;
|
|
39
39
|
cancel(): Promise<void>;
|
|
40
|
+
setLicense(licenseKey: string): Promise<boolean>;
|
|
41
|
+
isLicenseValid(licenseKey: string): Promise<boolean>;
|
|
40
42
|
isAvailable(): Promise<0 | 1>;
|
|
41
43
|
isRecognizing(): Promise<0 | 1>;
|
|
42
44
|
set onSpeechStart(fn: (e: SpeechStartEvent) => void);
|
package/stt/index.ts
CHANGED
|
@@ -145,6 +145,26 @@ class RCTSTT {
|
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
+
setLicense(licenseKey: string): Promise<boolean> {
|
|
149
|
+
return new Promise((resolve, reject) => {
|
|
150
|
+
if (!STTNative?.setLicense) {
|
|
151
|
+
reject(new Error('STTNative.setLicense not available'));
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
STTNative.setLicense(licenseKey).then(resolve).catch(reject);
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
isLicenseValid(licenseKey: string): Promise<boolean> {
|
|
159
|
+
return new Promise((resolve, reject) => {
|
|
160
|
+
if (!STTNative?.isLicenseValid) {
|
|
161
|
+
reject(new Error('STTNative.isLicenseValid not available'));
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
STTNative.isLicenseValid(licenseKey).then(resolve).catch(reject);
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
|
|
148
168
|
isAvailable(): Promise<0 | 1> {
|
|
149
169
|
return new Promise((resolve, reject) => {
|
|
150
170
|
if (!STTNative?.isSpeechAvailable) {
|
|
@@ -4,6 +4,8 @@ export class DaVoiceTTSInstance {
|
|
|
4
4
|
_emitter: NativeEventEmitter | null;
|
|
5
5
|
_subs: any[];
|
|
6
6
|
initTTS(modelOrConfig: any): Promise<any>;
|
|
7
|
+
setLicense(licenseKey: any): Promise<any>;
|
|
8
|
+
isLicenseValid(licenseKey: any): Promise<any>;
|
|
7
9
|
speak(text: any, speakerId?: number): Promise<any>;
|
|
8
10
|
stopSpeaking(): Promise<any>;
|
|
9
11
|
destroy(): Promise<any>;
|
package/tts/DaVoiceTTSBridge.js
CHANGED
|
@@ -28,6 +28,14 @@ export class DaVoiceTTSInstance {
|
|
|
28
28
|
return await DaVoiceTTSBridge.initTTS(modelOrConfig);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
async setLicense(licenseKey) {
|
|
32
|
+
return await DaVoiceTTSBridge.setLicense(licenseKey);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async isLicenseValid(licenseKey) {
|
|
36
|
+
return await DaVoiceTTSBridge.isLicenseValid(licenseKey);
|
|
37
|
+
}
|
|
38
|
+
|
|
31
39
|
async speak(text, speakerId = 0) {
|
|
32
40
|
return await DaVoiceTTSBridge.speak(text, speakerId);
|
|
33
41
|
}
|