apps-sdk 2.1.6 → 2.1.8
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/config.js +1 -0
- package/package.json +2 -2
- package/src/libraries/MixPanel.js +3 -3
- package/src/libraries/Voice.js +28 -3
package/config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apps-sdk",
|
|
3
|
-
"version": "2.1.
|
|
4
|
-
"description": "Apps SDK - Compatible with Expo SDK 54 + React 19 -
|
|
3
|
+
"version": "2.1.8",
|
|
4
|
+
"description": "Apps SDK - Compatible with Expo SDK 54 + React 19 - update url server for MixPanel events",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "ASD",
|
|
7
7
|
"license": "ISC",
|
|
@@ -9,13 +9,13 @@ class MixPanel {
|
|
|
9
9
|
this.devMode = false;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
async initialize(token = null, trackAutomaticEvents = false, useNative = false, devMode = false) {
|
|
12
|
+
async initialize(token = null, trackAutomaticEvents = false, useNative = false, devMode = false, serverURL = null) {
|
|
13
13
|
this.devMode = devMode;
|
|
14
14
|
const finalToken = token || config.MIXPANEL.TOKEN;
|
|
15
|
-
|
|
15
|
+
const finalServerURL = serverURL || config.MIXPANEL.SERVER_URL || 'https://api-eu.mixpanel.com';
|
|
16
16
|
try {
|
|
17
17
|
this.mixpanel = new Mixpanel(finalToken, trackAutomaticEvents, useNative);
|
|
18
|
-
await this.mixpanel.init();
|
|
18
|
+
await this.mixpanel.init(false, {}, finalServerURL);
|
|
19
19
|
config.DEBUG_MODE && console.log('MixPanel initialized: OK');
|
|
20
20
|
Networking.sendEvent('other', 'mixpanel_init_ok');
|
|
21
21
|
} catch (error) {
|
package/src/libraries/Voice.js
CHANGED
|
@@ -17,6 +17,7 @@ class VoiceService {
|
|
|
17
17
|
this.startListener = null;
|
|
18
18
|
this.resultListener = null;
|
|
19
19
|
this.errorListener = null;
|
|
20
|
+
this.endListener = null;
|
|
20
21
|
this.volumeListener = null;
|
|
21
22
|
|
|
22
23
|
// State flags used to prevent race conditions
|
|
@@ -35,7 +36,7 @@ class VoiceService {
|
|
|
35
36
|
|
|
36
37
|
/** Remove ALL tracked listeners in one call. */
|
|
37
38
|
_removeAllListeners() {
|
|
38
|
-
const listeners = ['startListener', 'resultListener', 'errorListener', 'volumeListener'];
|
|
39
|
+
const listeners = ['startListener', 'resultListener', 'errorListener', 'endListener', 'volumeListener'];
|
|
39
40
|
listeners.forEach(key => {
|
|
40
41
|
if (this[key]) {
|
|
41
42
|
try { this[key].remove(); } catch (_) {}
|
|
@@ -134,6 +135,7 @@ class VoiceService {
|
|
|
134
135
|
}
|
|
135
136
|
});
|
|
136
137
|
|
|
138
|
+
|
|
137
139
|
// ── error ───────────────────────────────────────────────────
|
|
138
140
|
this.errorListener = ExpoSpeechRecognitionModule.addListener('error', (event) => {
|
|
139
141
|
config.DEBUG_MODE && console.log('Voice - ERROR', event);
|
|
@@ -145,6 +147,16 @@ class VoiceService {
|
|
|
145
147
|
}
|
|
146
148
|
});
|
|
147
149
|
|
|
150
|
+
// ── end ─────────────────────────────────────────────────────
|
|
151
|
+
this.endListener = ExpoSpeechRecognitionModule.addListener('end', () => {
|
|
152
|
+
console.log('SPEECH - end');
|
|
153
|
+
// Recognition has fully stopped - trigger cleanup
|
|
154
|
+
if (this._endPromiseResolve) {
|
|
155
|
+
this._endPromiseResolve();
|
|
156
|
+
this._endPromiseResolve = null;
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
|
|
148
160
|
await ExpoSpeechRecognitionModule.start({
|
|
149
161
|
lang: language,
|
|
150
162
|
interimResults: true,
|
|
@@ -154,6 +166,12 @@ class VoiceService {
|
|
|
154
166
|
enabled: true,
|
|
155
167
|
intervalMillis: 150,
|
|
156
168
|
},
|
|
169
|
+
androidIntentOptions : {
|
|
170
|
+
EXTRA_LANGUAGE_MODEL: "web_search",
|
|
171
|
+
EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS: 10000, // wait 10s of silence before finalizing
|
|
172
|
+
EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS: 8000, // wait 8s before possibly complete
|
|
173
|
+
EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS: 1000, // minimum recording time
|
|
174
|
+
}
|
|
157
175
|
});
|
|
158
176
|
|
|
159
177
|
this.isRecognizing = true;
|
|
@@ -209,8 +227,7 @@ class VoiceService {
|
|
|
209
227
|
this.inactivityTimeout = null;
|
|
210
228
|
}
|
|
211
229
|
|
|
212
|
-
|
|
213
|
-
this._removeAllListeners();
|
|
230
|
+
|
|
214
231
|
|
|
215
232
|
if (this.isRecognizing) {
|
|
216
233
|
// Android needs a short pause before stop() is accepted reliably
|
|
@@ -218,8 +235,16 @@ class VoiceService {
|
|
|
218
235
|
await this._delay(ANDROID_STOP_DELAY_MS);
|
|
219
236
|
}
|
|
220
237
|
await ExpoSpeechRecognitionModule.stop();
|
|
238
|
+
|
|
239
|
+
// Wait for any final result events to be processed before removing listeners
|
|
240
|
+
// This ensures we don't miss the last words spoken
|
|
241
|
+
await this._delay(500);
|
|
242
|
+
|
|
221
243
|
this.isRecognizing = false;
|
|
222
244
|
}
|
|
245
|
+
|
|
246
|
+
// Remove all event listeners after giving time for final results
|
|
247
|
+
this._removeAllListeners();
|
|
223
248
|
} catch (e) {
|
|
224
249
|
console.error('Stop recognition error:', e);
|
|
225
250
|
this.isRecognizing = false;
|