apps-sdk 1.1.87 → 2.0.0-beta.1
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 +11 -10
- package/src/components/PayWall.js +1 -2
- package/src/libraries/MixPanel.js +1 -26
- package/src/libraries/Notifications.js +1 -11
- package/src/libraries/Session.js +2 -6
- package/src/libraries/Voice.js +19 -47
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apps-sdk",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Apps SDK",
|
|
3
|
+
"version": "2.0.0-beta.1",
|
|
4
|
+
"description": "Apps SDK - Compatible with Expo SDK 54",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "ASD",
|
|
7
7
|
"license": "ISC",
|
|
8
8
|
"peerDependencies": {
|
|
9
9
|
"expo": ">=52.0.0",
|
|
10
|
-
"expo-asset": ">=11.0.0 <
|
|
10
|
+
"expo-asset": ">=11.0.0 <13.0.0",
|
|
11
11
|
"expo-constants": ">=17.0.0",
|
|
12
12
|
"expo-device": ">=7.0.0",
|
|
13
13
|
"expo-file-system": ">=18.0.0",
|
|
@@ -16,26 +16,27 @@
|
|
|
16
16
|
"expo-media-library": ">=17.0.0",
|
|
17
17
|
"expo-notifications": ">=0.29.0",
|
|
18
18
|
"expo-sharing": ">=13.0.0",
|
|
19
|
-
"expo-speech": ">=
|
|
20
|
-
"expo-speech-recognition": ">=0.1.0",
|
|
19
|
+
"expo-speech": ">=14.0.0",
|
|
21
20
|
"expo-store-review": ">=8.0.0",
|
|
22
21
|
"expo-tracking-transparency": ">=5.1.0",
|
|
23
|
-
"react
|
|
22
|
+
"react": ">=18.3.0",
|
|
23
|
+
"react-native": ">=0.76.0 <0.82.0",
|
|
24
24
|
"react-native-adapty": ">=3.11.0",
|
|
25
25
|
"react-native-adjust": ">=5.4.0",
|
|
26
26
|
"react-native-fbsdk-next": ">=13.4.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"expo": "~
|
|
30
|
-
"expo-asset": "
|
|
29
|
+
"expo": "~54.0.0",
|
|
30
|
+
"expo-asset": "~12.0.0",
|
|
31
|
+
"react": "19.1.0"
|
|
31
32
|
},
|
|
32
33
|
"dependencies": {
|
|
33
34
|
"@expo/config-plugins": "~9.0.0",
|
|
34
35
|
"@react-native-async-storage/async-storage": "1.23.1",
|
|
35
36
|
"@react-native-community/netinfo": "11.4.1",
|
|
36
|
-
"
|
|
37
|
+
"@react-native-voice/voice": "^3.2.4",
|
|
37
38
|
"franc-min": "^6.2.0",
|
|
38
|
-
"mixpanel-react-native": "^3.
|
|
39
|
+
"mixpanel-react-native": "^3.0.9",
|
|
39
40
|
"react-native-btr": "^2.2.1",
|
|
40
41
|
"react-native-webview": "13.12.5",
|
|
41
42
|
"semver": "^7.6.0"
|
|
@@ -29,8 +29,7 @@ class PayWall extends React.Component {
|
|
|
29
29
|
componentDidMount() {
|
|
30
30
|
const { type, keyword } = this.props;
|
|
31
31
|
this.initPayWall();
|
|
32
|
-
|
|
33
|
-
this.getPayWallData(type, keyword);
|
|
32
|
+
this.getPayWallDataWithRetry(type, keyword);
|
|
34
33
|
}
|
|
35
34
|
|
|
36
35
|
initPayWall = async () => {
|
|
@@ -105,43 +105,18 @@ class MixPanel {
|
|
|
105
105
|
async identifyUser(userID) {
|
|
106
106
|
if (!this.mixpanel) {
|
|
107
107
|
console.log('Mixpanel is not initialized');
|
|
108
|
-
Networking.sendEvent('other', 'mixpanel_sdk_identify_failed', {
|
|
109
|
-
user_id: userID,
|
|
110
|
-
error: 'mixpanel_not_initialized'
|
|
111
|
-
});
|
|
112
108
|
return;
|
|
113
109
|
}
|
|
114
110
|
|
|
115
111
|
try {
|
|
116
|
-
|
|
117
|
-
const userIDRegex = /^\d{14}_[a-f0-9]+$/;
|
|
118
|
-
const isValidFormat = userIDRegex.test(userID);
|
|
119
|
-
|
|
120
|
-
if (!this.devMode && userID && isValidFormat) {
|
|
112
|
+
if (!this.devMode && userID) {
|
|
121
113
|
await this.mixpanel.identify(userID);
|
|
122
|
-
|
|
123
|
-
Networking.sendEvent('other', 'mixpanel_sdk_identify_success', {
|
|
124
|
-
user_id: userID
|
|
125
|
-
});
|
|
126
|
-
|
|
127
114
|
config.DEBUG_MODE && console.log('MixPanel User identified:', userID);
|
|
128
|
-
} else if (!this.devMode && userID && !isValidFormat) {
|
|
129
|
-
console.error('MixPanel: Invalid userID format. Expected format: YYYYMMDDHHMMSS_[hex], received:', userID);
|
|
130
|
-
|
|
131
|
-
Networking.sendEvent('other', 'mixpanel_sdk_identify_failed', {
|
|
132
|
-
user_id: userID,
|
|
133
|
-
error: 'invalid_format'
|
|
134
|
-
});
|
|
135
115
|
} else {
|
|
136
116
|
config.DEBUG_MODE && console.log('MixPanel User identified but not send (DEV_MODE ON):', userID);
|
|
137
117
|
}
|
|
138
118
|
} catch (error) {
|
|
139
119
|
console.error('Error identifying user:', error);
|
|
140
|
-
|
|
141
|
-
Networking.sendEvent('other', 'mixpanel_sdk_identify_failed', {
|
|
142
|
-
user_id: userID,
|
|
143
|
-
error: error.message
|
|
144
|
-
});
|
|
145
120
|
}
|
|
146
121
|
}
|
|
147
122
|
|
|
@@ -51,23 +51,13 @@ class NotificationsPush {
|
|
|
51
51
|
try {
|
|
52
52
|
const {status: existingStatus} = await Notifications.getPermissionsAsync();
|
|
53
53
|
let finalStatus = existingStatus;
|
|
54
|
-
|
|
55
54
|
if (existingStatus !== 'granted') {
|
|
56
|
-
Networking.sendEvent('other', 'push_banner_shown', { platform: Platform.OS });
|
|
57
|
-
MixPanel.trackEvent('push_banner_shown', { platform: Platform.OS });
|
|
58
|
-
|
|
59
55
|
const {status} = await Notifications.requestPermissionsAsync();
|
|
60
56
|
finalStatus = status;
|
|
61
|
-
|
|
62
57
|
if (finalStatus === 'granted') {
|
|
63
|
-
Networking.sendEvent('
|
|
64
|
-
MixPanel.trackEvent('push_permission_granted', { platform: Platform.OS });
|
|
65
|
-
} else {
|
|
66
|
-
Networking.sendEvent('other', 'push_permission_denied', { platform: Platform.OS });
|
|
67
|
-
MixPanel.trackEvent('push_permission_denied', { platform: Platform.OS });
|
|
58
|
+
Networking.sendEvent('action', 'allow_notifications');
|
|
68
59
|
}
|
|
69
60
|
}
|
|
70
|
-
|
|
71
61
|
if (finalStatus === 'granted') {
|
|
72
62
|
token = (await Notifications.getExpoPushTokenAsync({"projectId": Constants.expoConfig.extra.eas.projectId})).data;
|
|
73
63
|
console.log('Notification token', token);
|
package/src/libraries/Session.js
CHANGED
|
@@ -37,16 +37,12 @@ class Session {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
storeSessionStructure = async () => {
|
|
40
|
-
const packageName = Platform.OS === 'android'
|
|
41
|
-
? Constants.expoConfig.android.package
|
|
42
|
-
: Constants.expoConfig.ios.bundleIdentifier;
|
|
43
|
-
|
|
44
40
|
this.sessionData = {
|
|
45
41
|
user_id: null,
|
|
46
42
|
isFirstOpen: !(await Storage.getData("FirstOpenAlreadyExecuted")),
|
|
47
43
|
app: {
|
|
48
44
|
shortVersion: Constants.expoConfig.version,
|
|
49
|
-
package:
|
|
45
|
+
package: Constants.expoConfig.android.package || Constants.expoConfig.ios.bundleIdentifier,
|
|
50
46
|
languageCode : Localization.getLocales()[0].languageCode || 'en',
|
|
51
47
|
regionCode: Localization.getLocales()[0].regionCode,
|
|
52
48
|
buildVersionNumber: Constants.expoConfig.version,
|
|
@@ -68,7 +64,7 @@ class Session {
|
|
|
68
64
|
},
|
|
69
65
|
dev : false,
|
|
70
66
|
lang : Localization.getLocales()[0].languageCode || 'en',
|
|
71
|
-
package :
|
|
67
|
+
package : Platform.OS === 'android' ? Constants.expoConfig.android.package : Constants.expoConfig.ios.bundleIdentifier,
|
|
72
68
|
};
|
|
73
69
|
config.DEBUG_MODE && console.debug("storeSessionStructure - sessionData: ", this.sessionData);
|
|
74
70
|
}
|
package/src/libraries/Voice.js
CHANGED
|
@@ -1,54 +1,34 @@
|
|
|
1
1
|
import * as config from '../../config';
|
|
2
|
-
import
|
|
2
|
+
import Voice from '@react-native-voice/voice';
|
|
3
3
|
import Session from "./Session";
|
|
4
4
|
import * as Speech from 'expo-speech';
|
|
5
5
|
import { franc } from 'franc-min';
|
|
6
6
|
|
|
7
7
|
class VoiceService {
|
|
8
8
|
constructor() {
|
|
9
|
+
this.voice = Voice;
|
|
9
10
|
this.inactivityTimeout = null;
|
|
10
|
-
this.resultListener = null;
|
|
11
|
-
this.isRecognizing = false;
|
|
12
11
|
}
|
|
13
12
|
|
|
14
13
|
async startRecognizing(onSpeechStart, onSpeechRecognized, onSpeechResults, onInactivityTimeout, inactivitySeconds = 3) {
|
|
15
14
|
try {
|
|
16
|
-
const { status } = await ExpoSpeechRecognitionModule.requestPermissionsAsync();
|
|
17
|
-
if (status !== 'granted') {
|
|
18
|
-
throw new Error('Speech recognition permission not granted');
|
|
19
|
-
}
|
|
20
|
-
|
|
21
15
|
const language = Session.getDeviceLanguageAndRegion();
|
|
22
16
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
this.voice.onSpeechStart = () => {
|
|
18
|
+
onSpeechStart();
|
|
19
|
+
this.resetInactivityTimeout(inactivitySeconds, onInactivityTimeout);
|
|
20
|
+
};
|
|
26
21
|
|
|
27
|
-
this.
|
|
28
|
-
if (event.results && event.results.length > 0) {
|
|
29
|
-
const results = event.results.map(r => r.transcript);
|
|
30
|
-
onSpeechResults(results);
|
|
31
|
-
this.resetInactivityTimeout(inactivitySeconds, onInactivityTimeout);
|
|
32
|
-
}
|
|
33
|
-
if (event.isFinal) {
|
|
34
|
-
this.stopRecognizing();
|
|
35
|
-
}
|
|
36
|
-
});
|
|
22
|
+
this.voice.onSpeechRecognized = onSpeechRecognized;
|
|
37
23
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
continuous: false,
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
this.isRecognizing = true;
|
|
46
|
-
onSpeechStart();
|
|
47
|
-
this.resetInactivityTimeout(inactivitySeconds, onInactivityTimeout);
|
|
24
|
+
this.voice.onSpeechResults = (e) => {
|
|
25
|
+
onSpeechResults(e.value);
|
|
26
|
+
this.resetInactivityTimeout(inactivitySeconds, onInactivityTimeout);
|
|
27
|
+
};
|
|
48
28
|
|
|
29
|
+
await this.voice.start(language);
|
|
49
30
|
} catch (e) {
|
|
50
|
-
console.error(
|
|
51
|
-
this.isRecognizing = false;
|
|
31
|
+
console.error(e);
|
|
52
32
|
}
|
|
53
33
|
}
|
|
54
34
|
|
|
@@ -66,27 +46,19 @@ class VoiceService {
|
|
|
66
46
|
|
|
67
47
|
async stopRecognizing() {
|
|
68
48
|
try {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
if (this.resultListener) {
|
|
73
|
-
this.resultListener.remove();
|
|
74
|
-
this.resultListener = null;
|
|
75
|
-
}
|
|
76
|
-
if (this.isRecognizing) {
|
|
77
|
-
await ExpoSpeechRecognitionModule.stop();
|
|
78
|
-
this.isRecognizing = false;
|
|
79
|
-
}
|
|
49
|
+
clearTimeout(this.inactivityTimeout);
|
|
50
|
+
await this.voice.stop();
|
|
80
51
|
} catch (e) {
|
|
81
|
-
console.error(
|
|
52
|
+
console.error(e);
|
|
82
53
|
}
|
|
83
54
|
}
|
|
84
55
|
|
|
85
56
|
async destroyVoice() {
|
|
86
57
|
try {
|
|
87
|
-
|
|
58
|
+
clearTimeout(this.inactivityTimeout);
|
|
59
|
+
await this.voice.destroy();
|
|
88
60
|
} catch (e) {
|
|
89
|
-
console.error(
|
|
61
|
+
console.error(e);
|
|
90
62
|
}
|
|
91
63
|
}
|
|
92
64
|
|