apps-sdk 1.0.135 → 1.0.136
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/package.json +2 -1
- package/src/libraries/Voice.js +24 -0
- package/types/index.d.ts +9 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apps-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.136",
|
|
4
4
|
"description": "Apps SDK",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"expo-media-library": "~15.9.2",
|
|
24
24
|
"expo-notifications": "~0.27.8",
|
|
25
25
|
"expo-sharing": "^11.10.0",
|
|
26
|
+
"expo-speech": "^13.0.0",
|
|
26
27
|
"expo-store-review": "~6.8.3",
|
|
27
28
|
"expo-tracking-transparency": "~3.3.0",
|
|
28
29
|
"react-native": "0.73.6",
|
package/src/libraries/Voice.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Voice from '@react-native-voice/voice';
|
|
2
2
|
import Session from "./Session";
|
|
3
|
+
import * as Speech from 'expo-speech';
|
|
3
4
|
|
|
4
5
|
class VoiceService {
|
|
5
6
|
constructor() {
|
|
@@ -58,6 +59,29 @@ class VoiceService {
|
|
|
58
59
|
console.error(e);
|
|
59
60
|
}
|
|
60
61
|
}
|
|
62
|
+
|
|
63
|
+
speak(message, language = null, voice = null, onStart, onDone, onError) {
|
|
64
|
+
const deviceLanguage = Session.getDeviceLanguageAndRegion();
|
|
65
|
+
|
|
66
|
+
const finalLanguage = language || deviceLanguage;
|
|
67
|
+
const finalVoice = voice || `${deviceLanguage}-language`;
|
|
68
|
+
|
|
69
|
+
Speech.speak(message, {
|
|
70
|
+
language: finalLanguage,
|
|
71
|
+
voice: finalVoice,
|
|
72
|
+
rate: 1,
|
|
73
|
+
pitch: 1,
|
|
74
|
+
onStart: () => {
|
|
75
|
+
if (onStart) onStart();
|
|
76
|
+
},
|
|
77
|
+
onDone: () => {
|
|
78
|
+
if (onDone) onDone();
|
|
79
|
+
},
|
|
80
|
+
onError: (error) => {
|
|
81
|
+
if (onError) onError(error);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
61
85
|
}
|
|
62
86
|
|
|
63
87
|
export default new VoiceService();
|
package/types/index.d.ts
CHANGED
|
@@ -131,11 +131,19 @@ declare module 'apps-sdk' {
|
|
|
131
131
|
onSpeechRecognized: () => void,
|
|
132
132
|
onSpeechResults: (results: string[]) => void,
|
|
133
133
|
onInactivityTimeout: () => void,
|
|
134
|
-
inactivitySeconds?: number
|
|
134
|
+
inactivitySeconds?: number,
|
|
135
135
|
): Promise<void>;
|
|
136
136
|
|
|
137
137
|
stopRecognizing(): Promise<void>;
|
|
138
138
|
destroyVoice(): Promise<void>;
|
|
139
|
+
speak(
|
|
140
|
+
message: string,
|
|
141
|
+
language?: string | null,
|
|
142
|
+
voice?: string | null,
|
|
143
|
+
onStart?: () => void,
|
|
144
|
+
onDone?: () => void,
|
|
145
|
+
onError?: (error: any) => void
|
|
146
|
+
): void;
|
|
139
147
|
}
|
|
140
148
|
|
|
141
149
|
export interface PayWallProps {
|