@react-native-firebase/analytics 18.1.0 → 18.3.0
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/CHANGELOG.md +11 -0
- package/android/src/main/java/io/invertase/firebase/analytics/UniversalFirebaseAnalyticsModule.java +4 -0
- package/android/src/reactnative/java/io/invertase/firebase/analytics/ReactNativeFirebaseAnalyticsModule.java +15 -0
- package/ios/RNFBAnalytics/RNFBAnalyticsModule.m +14 -1
- package/lib/index.d.ts +14 -0
- package/lib/index.js +5 -0
- package/lib/version.js +1 -1
- package/modular/index.js +10 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,17 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [18.3.0](https://github.com/invertase/react-native-firebase/compare/v18.2.0...v18.3.0) (2023-07-19)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @react-native-firebase/analytics
|
9
|
+
|
10
|
+
## [18.2.0](https://github.com/invertase/react-native-firebase/compare/v18.1.0...v18.2.0) (2023-07-13)
|
11
|
+
|
12
|
+
### Features
|
13
|
+
|
14
|
+
- **analytics, ios:** implement setSessionTimeoutDuration for ios ([b3ce13f](https://github.com/invertase/react-native-firebase/commit/b3ce13ff5f7922e4a253aa58377e5c3c436e74f0))
|
15
|
+
- **analytics:** implement getSessionId ([566470c](https://github.com/invertase/react-native-firebase/commit/566470cfc0e919a46c0a119835187257bf046df7))
|
16
|
+
|
6
17
|
## [18.1.0](https://github.com/invertase/react-native-firebase/compare/v18.0.0...v18.1.0) (2023-06-22)
|
7
18
|
|
8
19
|
**Note:** Version bump only for package @react-native-firebase/analytics
|
package/android/src/main/java/io/invertase/firebase/analytics/UniversalFirebaseAnalyticsModule.java
CHANGED
@@ -60,6 +60,10 @@ public class UniversalFirebaseAnalyticsModule extends UniversalFirebaseModule {
|
|
60
60
|
return FirebaseAnalytics.getInstance(getContext()).getAppInstanceId();
|
61
61
|
}
|
62
62
|
|
63
|
+
Task<Long> getSessionId() {
|
64
|
+
return FirebaseAnalytics.getInstance(getContext()).getSessionId();
|
65
|
+
}
|
66
|
+
|
63
67
|
Task<Void> setUserId(String id) {
|
64
68
|
return Tasks.call(
|
65
69
|
() -> {
|
@@ -93,6 +93,21 @@ public class ReactNativeFirebaseAnalyticsModule extends ReactNativeFirebaseModul
|
|
93
93
|
});
|
94
94
|
}
|
95
95
|
|
96
|
+
@ReactMethod
|
97
|
+
public void getSessionId(Promise promise) {
|
98
|
+
module
|
99
|
+
.getSessionId()
|
100
|
+
.addOnCompleteListener(
|
101
|
+
task -> {
|
102
|
+
if (task.isSuccessful()) {
|
103
|
+
Long result = task.getResult();
|
104
|
+
promise.resolve(result != null ? result.doubleValue() : null);
|
105
|
+
} else {
|
106
|
+
rejectPromiseWithExceptionMap(promise, task.getException());
|
107
|
+
}
|
108
|
+
});
|
109
|
+
}
|
110
|
+
|
96
111
|
@ReactMethod
|
97
112
|
public void setUserId(String id, Promise promise) {
|
98
113
|
module
|
@@ -115,7 +115,7 @@ RCT_EXPORT_METHOD(setSessionTimeoutDuration
|
|
115
115
|
: (double)milliseconds resolver
|
116
116
|
: (RCTPromiseResolveBlock)resolve rejecter
|
117
117
|
: (RCTPromiseRejectBlock)reject) {
|
118
|
-
|
118
|
+
[FIRAnalytics setSessionTimeoutInterval:milliseconds / 1000];
|
119
119
|
return resolve([NSNull null]);
|
120
120
|
}
|
121
121
|
|
@@ -125,6 +125,19 @@ RCT_EXPORT_METHOD(getAppInstanceId
|
|
125
125
|
return resolve([FIRAnalytics appInstanceID]);
|
126
126
|
}
|
127
127
|
|
128
|
+
RCT_EXPORT_METHOD(getSessionId
|
129
|
+
: (RCTPromiseResolveBlock)resolve rejecter
|
130
|
+
: (RCTPromiseRejectBlock)reject) {
|
131
|
+
[FIRAnalytics sessionIDWithCompletion:^(int64_t sessionID, NSError *_Nullable error) {
|
132
|
+
if (error) {
|
133
|
+
DLog(@"Error getting session ID: %@", error);
|
134
|
+
return resolve([NSNull null]);
|
135
|
+
} else {
|
136
|
+
return resolve([NSNumber numberWithLongLong:sessionID]);
|
137
|
+
}
|
138
|
+
}];
|
139
|
+
}
|
140
|
+
|
128
141
|
RCT_EXPORT_METHOD(setDefaultEventParameters
|
129
142
|
: (NSDictionary *)params resolver
|
130
143
|
: (RCTPromiseResolveBlock)resolve rejecter
|
package/lib/index.d.ts
CHANGED
@@ -869,6 +869,20 @@ export namespace FirebaseAnalyticsTypes {
|
|
869
869
|
*/
|
870
870
|
getAppInstanceId(): Promise<string | null>;
|
871
871
|
|
872
|
+
/**
|
873
|
+
* Retrieves the session id from the client.
|
874
|
+
* On iOS, Firebase SDK may return an error that is handled internally and may take many minutes to return a valid value. Check native debug logs for more details.
|
875
|
+
*
|
876
|
+
* #### Example
|
877
|
+
*
|
878
|
+
* ```js
|
879
|
+
* const sessionId = await firebase.analytics().getSessionId();
|
880
|
+
* ```
|
881
|
+
*
|
882
|
+
* @returns Returns the session id or null if session is expired, null on android if FirebaseAnalytics.ConsentType.ANALYTICS_STORAGE has been set to FirebaseAnalytics.ConsentStatus.DENIED and null on iOS if ConsentType.analyticsStorage has been set to ConsentStatus.denied.
|
883
|
+
*/
|
884
|
+
getSessionId(): Promise<number | null>;
|
885
|
+
|
872
886
|
/**
|
873
887
|
* Gives a user a unique identification.
|
874
888
|
*
|
package/lib/index.js
CHANGED
@@ -43,6 +43,7 @@ export {
|
|
43
43
|
setAnalyticsCollectionEnabled,
|
44
44
|
setSessionTimeoutDuration,
|
45
45
|
getAppInstanceId,
|
46
|
+
getSessionId,
|
46
47
|
setUserId,
|
47
48
|
setUserProperty,
|
48
49
|
setUserProperties,
|
@@ -196,6 +197,10 @@ class FirebaseAnalyticsModule extends FirebaseModule {
|
|
196
197
|
return this.native.getAppInstanceId();
|
197
198
|
}
|
198
199
|
|
200
|
+
getSessionId() {
|
201
|
+
return this.native.getSessionId();
|
202
|
+
}
|
203
|
+
|
199
204
|
setUserId(id) {
|
200
205
|
if (!isNull(id) && !isString(id)) {
|
201
206
|
throw new Error("firebase.analytics().setUserId(*) 'id' expected a string value.");
|
package/lib/version.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
// Generated by genversion.
|
2
|
-
module.exports = '18.
|
2
|
+
module.exports = '18.3.0';
|
package/modular/index.js
CHANGED
@@ -70,6 +70,16 @@ export function setSessionTimeoutDuration(analytics, milliseconds = 1800000) {
|
|
70
70
|
export function getAppInstanceId(analytics) {
|
71
71
|
return analytics.getAppInstanceId();
|
72
72
|
}
|
73
|
+
/**
|
74
|
+
* Retrieves the session id from the client.
|
75
|
+
* On iOS, Firebase SDK may return an error that is handled internally and may take many minutes to return a valid value. Check native debug logs for more details.
|
76
|
+
*
|
77
|
+
* @param analytics Analytics instance.
|
78
|
+
* @returns Returns the session id or null if session is expired, null on android if FirebaseAnalytics.ConsentType.ANALYTICS_STORAGE has been set to FirebaseAnalytics.ConsentStatus.DENIED and null on iOS if ConsentType.analyticsStorage has been set to ConsentStatus.denied.
|
79
|
+
*/
|
80
|
+
export function getSessionId(analytics) {
|
81
|
+
return analytics.getSessionId();
|
82
|
+
}
|
73
83
|
/**
|
74
84
|
* Gives a user a unique identification.
|
75
85
|
*
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@react-native-firebase/analytics",
|
3
|
-
"version": "18.
|
3
|
+
"version": "18.3.0",
|
4
4
|
"author": "Invertase <oss@invertase.io> (http://invertase.io)",
|
5
5
|
"description": "React Native Firebase - The analytics module provides out of the box support with Google Analytics for Firebase. Integration with the Android & iOS allows for in-depth analytical insight reporting, such as device information, location, user actions and more.",
|
6
6
|
"main": "lib/index.js",
|
@@ -22,10 +22,10 @@
|
|
22
22
|
"analytics"
|
23
23
|
],
|
24
24
|
"peerDependencies": {
|
25
|
-
"@react-native-firebase/app": "18.
|
25
|
+
"@react-native-firebase/app": "18.3.0"
|
26
26
|
},
|
27
27
|
"publishConfig": {
|
28
28
|
"access": "public"
|
29
29
|
},
|
30
|
-
"gitHead": "
|
30
|
+
"gitHead": "cca7053a12ea04c8476f880bd2220f44ee4ae17a"
|
31
31
|
}
|