apps-sdk 2.0.5 → 2.0.7

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apps-sdk",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
4
4
  "description": "Apps SDK - Compatible with Expo SDK 54 + React 19",
5
5
  "main": "index.js",
6
6
  "author": "ASD",
@@ -199,6 +199,15 @@ class Adapty {
199
199
  }
200
200
  }
201
201
 
202
+ async setFirebaseIntegrationIdentifier(integrationIdentifier) {
203
+ try {
204
+ await adapty.setIntegrationIdentifier('firebase_app_instance_id', integrationIdentifier);
205
+ config.DEBUG_MODE && console.log('Adapty Firebase integration identifier set successfully:', integrationIdentifier);
206
+ } catch (error) {
207
+ console.error('Error setting Firebase integration identifier:', error);
208
+ }
209
+ }
210
+
202
211
  async getOnboardingForPlacement(placementID, lang) {
203
212
  try {
204
213
  return await adapty.getOnboarding(placementID, lang);
@@ -0,0 +1,53 @@
1
+ import analytics from '@react-native-firebase/analytics';
2
+ import config from '../../config';
3
+
4
+ class Firebase {
5
+ async initialize() {
6
+ try {
7
+ // Firebase should already be initialized by the app
8
+ config.DEBUG_MODE && console.log('Firebase Analytics is ready to use');
9
+ } catch (error) {
10
+ console.error('Error initializing Firebase:', error);
11
+ }
12
+ }
13
+
14
+ async getAppInstanceId() {
15
+ try {
16
+ const appInstanceId = await analytics().getAppInstanceId();
17
+ config.DEBUG_MODE && console.log('Firebase App Instance ID:', appInstanceId);
18
+ return appInstanceId;
19
+ } catch (error) {
20
+ console.error('Error getting Firebase App Instance ID:', error);
21
+ return null;
22
+ }
23
+ }
24
+
25
+ async logEvent(eventName, params = {}) {
26
+ try {
27
+ await analytics().logEvent(eventName, params);
28
+ config.DEBUG_MODE && console.log('Firebase event logged:', eventName, params);
29
+ } catch (error) {
30
+ console.error('Error logging Firebase event:', error);
31
+ }
32
+ }
33
+
34
+ async setUserId(userId) {
35
+ try {
36
+ await analytics().setUserId(userId);
37
+ config.DEBUG_MODE && console.log('Firebase user ID set:', userId);
38
+ } catch (error) {
39
+ console.error('Error setting Firebase user ID:', error);
40
+ }
41
+ }
42
+
43
+ async setUserProperty(name, value) {
44
+ try {
45
+ await analytics().setUserProperty(name, value);
46
+ config.DEBUG_MODE && console.log('Firebase user property set:', name, value);
47
+ } catch (error) {
48
+ console.error('Error setting Firebase user property:', error);
49
+ }
50
+ }
51
+ }
52
+
53
+ export default new Firebase();
@@ -10,10 +10,11 @@ class VoiceService {
10
10
  constructor() {
11
11
  this.inactivityTimeout = null;
12
12
  this.resultListener = null;
13
+ this.volumeListener = null;
13
14
  this.isRecognizing = false;
14
15
  }
15
16
 
16
- async startRecognizing(onSpeechStart, onSpeechRecognized, onSpeechResults, onInactivityTimeout, inactivitySeconds = 3) {
17
+ async startRecognizing(onSpeechStart, onSpeechRecognized, onSpeechResults, onInactivityTimeout, inactivitySeconds = 3, onVolumeChange = null, onNoSpeech = null) {
17
18
  try {
18
19
  const { status } = await ExpoSpeechRecognitionModule.requestPermissionsAsync();
19
20
  if (status !== 'granted') {
@@ -36,6 +37,12 @@ class VoiceService {
36
37
  this.resultListener.remove();
37
38
  }
38
39
 
40
+ this.volumeListener = ExpoSpeechRecognitionModule.addListener("volumechange" , ({value}) => {
41
+ if (onVolumeChange) {
42
+ onVolumeChange(value);
43
+ }
44
+ })
45
+
39
46
  ExpoSpeechRecognitionModule.addListener('start', () => {
40
47
  onSpeechStart();
41
48
  this.resetInactivityTimeout(inactivitySeconds, onInactivityTimeout);
@@ -51,6 +58,12 @@ class VoiceService {
51
58
 
52
59
  ExpoSpeechRecognitionModule.addListener('error', (event) => {
53
60
  console.error('Speech recognition error:', event.error, event.message);
61
+
62
+ // Handle "no-speech" error specifically
63
+ if (event.error === 'no-speech' && onNoSpeech) {
64
+ onNoSpeech();
65
+ // Don't stop recognition, just notify user
66
+ }
54
67
  });
55
68
 
56
69
  await ExpoSpeechRecognitionModule.start({
@@ -58,6 +71,10 @@ class VoiceService {
58
71
  interimResults: true,
59
72
  maxAlternatives: 1,
60
73
  continuous: true,
74
+ volumeChangeEventOptions : {
75
+ enabled : true,
76
+ intervalMillis:150
77
+ }
61
78
  });
62
79
 
63
80
  this.isRecognizing = true;
@@ -89,6 +106,10 @@ class VoiceService {
89
106
  this.resultListener.remove();
90
107
  this.resultListener = null;
91
108
  }
109
+ if (this.volumeListener) {
110
+ this.volumeListener.remove();
111
+ this.volumeListener = null;
112
+ }
92
113
  if (this.isRecognizing) {
93
114
  await ExpoSpeechRecognitionModule.stop();
94
115
  this.isRecognizing = false;
@@ -12,4 +12,5 @@ export { default as Voice } from './Voice';
12
12
  export { default as Adapty } from './Adapty';
13
13
  export { default as HomeActions } from './QuickActions';
14
14
  export { default as Facebook } from './Facebook';
15
+ export { default as Firebase } from './Firebase';
15
16
  export { default as Legal } from './Legal';
package/types/index.d.ts CHANGED
@@ -106,7 +106,7 @@ declare module 'apps-sdk' {
106
106
  handleRequestGalleryPermission(): Promise<string>;
107
107
  setTrackingPermissionGranted(value: boolean): Promise<void>;
108
108
  setTrackingPermissionFromStorage(): Promise<void>;
109
- selectImageFromGallery(galleryNotGrantedTitle: string, galleryNotGrantedMessage: string, cancelText:string, openSettingsText:string): Promise<string>;
109
+ selectImageFromGallery(galleryNotGrantedTitle: string, galleryNotGrantedMessage: string, cancelText:string, openSettingsText:string, maxPerPick?: number): Promise<string>;
110
110
  removeAllKeys(): Promise<void>;
111
111
  deleteTempFiles(): Promise<void>;
112
112
  compressImage(imageURI: string, maxSizeMB: number): Promise<string>;
@@ -135,6 +135,8 @@ declare module 'apps-sdk' {
135
135
  onSpeechResults: (results: string[]) => void,
136
136
  onInactivityTimeout: () => void,
137
137
  inactivitySeconds?: number,
138
+ onVolumeChange?: ((volumeValue: number) => void) | null,
139
+ onNoSpeech?: (() => void) | null
138
140
  ): Promise<void>;
139
141
 
140
142
  stopRecognizing(): Promise<void>;