apps-sdk 1.0.129 → 1.0.130
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/index.js +5 -4
- package/package.json +2 -1
- package/src/libraries/Session.js +4 -0
- package/src/libraries/Voice.js +38 -0
- package/src/libraries/index.js +1 -0
- package/types/index.d.ts +1 -0
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {NotificationsPush, Networking, Storage, Session, Utils, PayWallLogic, Rating, AdJust, TrackingTransparency} from "./src/libraries";
|
|
1
|
+
import {NotificationsPush, Networking, Storage, Session, Utils, PayWallLogic, Rating, AdJust, TrackingTransparency, Voice} from "./src/libraries";
|
|
2
2
|
import PayWall from "./src/components/PayWall";
|
|
3
3
|
|
|
4
4
|
class AppsSDK {
|
|
@@ -11,13 +11,13 @@ class AppsSDK {
|
|
|
11
11
|
console.log('Overwriting console.log and console.debug...');
|
|
12
12
|
const originalConsoleLog = console.log;
|
|
13
13
|
const originalConsoleDebug = console.debug;
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
console.log = function() {
|
|
16
16
|
let date = new Date();
|
|
17
|
-
let timestamp = date.toLocaleDateString() + ' ' + date.toLocaleTimeString() + '.' + date.getMilliseconds();
|
|
17
|
+
let timestamp = date.toLocaleDateString() + ' ' + date.toLocaleTimeString() + '.' + date.getMilliseconds();
|
|
18
18
|
originalConsoleLog.apply(console, ['[' + timestamp + ']'].concat(Array.from(arguments)));
|
|
19
19
|
};
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
console.debug = function() {
|
|
22
22
|
let date = new Date();
|
|
23
23
|
let timestamp = date.toLocaleDateString() + ' ' + date.toLocaleTimeString() + '.' + date.getMilliseconds();
|
|
@@ -56,4 +56,5 @@ export default {
|
|
|
56
56
|
tracking: TrackingTransparency,
|
|
57
57
|
paywall: PayWall,
|
|
58
58
|
notifications: NotificationsPush,
|
|
59
|
+
voice: Voice
|
|
59
60
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apps-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.130",
|
|
4
4
|
"description": "Apps SDK",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"@expo/config-plugins": "~7.8.0",
|
|
13
13
|
"@react-native-async-storage/async-storage": "^1.21.0",
|
|
14
14
|
"@react-native-community/netinfo": "11.1.0",
|
|
15
|
+
"@react-native-voice/voice": "^3.2.4",
|
|
15
16
|
"apps-sdk": "^1.0.120",
|
|
16
17
|
"crypto-es": "^2.1.0",
|
|
17
18
|
"expo-constants": "~15.4.6",
|
package/src/libraries/Session.js
CHANGED
|
@@ -225,6 +225,10 @@ class Session {
|
|
|
225
225
|
getDeviceLanguage = () => {
|
|
226
226
|
return Localization.getLocales()[0].languageCode || 'en';
|
|
227
227
|
}
|
|
228
|
+
|
|
229
|
+
getDeviceLanguageAndRegion = () => {
|
|
230
|
+
return Localization.getLocales()[0].languageCode + '-' + Localization.getLocales()[0].regionCode;
|
|
231
|
+
}
|
|
228
232
|
}
|
|
229
233
|
|
|
230
234
|
export default new Session();
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import Voice from '@react-native-voice/voice';
|
|
2
|
+
import Session from "./Session";
|
|
3
|
+
|
|
4
|
+
class Voice {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.voice = Voice;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
async startRecognizing(onSpeechStart, onSpeechRecognized, onSpeechResults) {
|
|
10
|
+
try {
|
|
11
|
+
const language = Session.getDeviceLanguageAndRegion();
|
|
12
|
+
this.voice.onSpeechStart = onSpeechStart;
|
|
13
|
+
this.voice.onSpeechRecognized = onSpeechRecognized;
|
|
14
|
+
this.voice.onSpeechResults = (e) => onSpeechResults(e.value);
|
|
15
|
+
await this.voice.start(language);
|
|
16
|
+
} catch (e) {
|
|
17
|
+
console.error(e);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async stopRecognizing() {
|
|
22
|
+
try {
|
|
23
|
+
await this.voice.stop();
|
|
24
|
+
} catch (e) {
|
|
25
|
+
console.error(e);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async destroyVoice() {
|
|
30
|
+
try {
|
|
31
|
+
await this.voice.destroy();
|
|
32
|
+
} catch (e) {
|
|
33
|
+
console.error(e);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export default new Voice();
|
package/src/libraries/index.js
CHANGED
|
@@ -7,3 +7,4 @@ export { default as Rating } from './Rating';
|
|
|
7
7
|
export { default as AdJust } from './AdJust';
|
|
8
8
|
export { default as TrackingTransparency } from './TrackingTransparency';
|
|
9
9
|
export { default as PayWallLogic } from './PayWallLogic';
|
|
10
|
+
export { default as Voice } from './Voice';
|