@react-native-firebase/crashlytics 21.7.0 → 21.7.2

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
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
+ ## [21.7.2](https://github.com/invertase/react-native-firebase/compare/v21.7.1...v21.7.2) (2025-02-05)
7
+
8
+ **Note:** Version bump only for package @react-native-firebase/crashlytics
9
+
10
+ ## [21.7.1](https://github.com/invertase/react-native-firebase/compare/v21.7.0...v21.7.1) (2025-01-20)
11
+
12
+ **Note:** Version bump only for package @react-native-firebase/crashlytics
13
+
6
14
  ## [21.7.0](https://github.com/invertase/react-native-firebase/compare/v21.6.2...v21.7.0) (2025-01-16)
7
15
 
8
16
  **Note:** Version bump only for package @react-native-firebase/crashlytics
package/README.md CHANGED
@@ -49,7 +49,7 @@ yarn add @react-native-firebase/crashlytics
49
49
  ---
50
50
 
51
51
  <p>
52
- <img align="left" width="75px" src="https://static.invertase.io/assets/invertase-logo-small.png">
52
+ <img align="left" width="75px" src="https://static.invertase.io/assets/invertase/invertase-rounded.png">
53
53
  <p align="left">
54
54
  Built and maintained with 💛 by <a href="https://invertase.io">Invertase</a>.
55
55
  </p>
@@ -1,5 +1,10 @@
1
- import { describe, expect, it } from '@jest/globals';
2
-
1
+ import { describe, expect, it, jest, beforeEach } from '@jest/globals';
2
+ // @ts-ignore test
3
+ import FirebaseModule from '../../app/lib/internal/FirebaseModule';
4
+ import {
5
+ createCheckV9Deprecation,
6
+ CheckV9DeprecationFunction,
7
+ } from '../../app/lib/common/unitTestUtils';
3
8
  import {
4
9
  firebase,
5
10
  getCrashlytics,
@@ -79,4 +84,132 @@ describe('Crashlytics', function () {
79
84
  expect(setCrashlyticsCollectionEnabled).toBeDefined();
80
85
  });
81
86
  });
87
+
88
+ describe('test `console.warn` is called for RNFB v8 API & not called for v9 API', function () {
89
+ let checkV9Deprecation: CheckV9DeprecationFunction;
90
+
91
+ beforeEach(function () {
92
+ checkV9Deprecation = createCheckV9Deprecation(['crashlytics']);
93
+
94
+ // @ts-ignore test
95
+ jest.spyOn(FirebaseModule.prototype, 'native', 'get').mockImplementation(() => {
96
+ return new Proxy(
97
+ {},
98
+ {
99
+ get: () => jest.fn(),
100
+ },
101
+ );
102
+ });
103
+ });
104
+
105
+ it('checkForUnsentReports', function () {
106
+ const crashlytics = getCrashlytics();
107
+ checkV9Deprecation(
108
+ () => checkForUnsentReports(crashlytics),
109
+ () => crashlytics.checkForUnsentReports(),
110
+ 'checkForUnsentReports',
111
+ );
112
+ });
113
+
114
+ it('crash', function () {
115
+ const crashlytics = getCrashlytics();
116
+ checkV9Deprecation(
117
+ () => crash(crashlytics),
118
+ () => crashlytics.crash(),
119
+ 'crash',
120
+ );
121
+ });
122
+
123
+ it('deleteUnsentReports', function () {
124
+ const crashlytics = getCrashlytics();
125
+ checkV9Deprecation(
126
+ () => deleteUnsentReports(crashlytics),
127
+ () => crashlytics.deleteUnsentReports(),
128
+ 'deleteUnsentReports',
129
+ );
130
+ });
131
+
132
+ it('didCrashOnPreviousExecution', function () {
133
+ const crashlytics = getCrashlytics();
134
+ checkV9Deprecation(
135
+ () => didCrashOnPreviousExecution(crashlytics),
136
+ () => crashlytics.didCrashOnPreviousExecution(),
137
+ 'didCrashOnPreviousExecution',
138
+ );
139
+ });
140
+
141
+ it('log', function () {
142
+ const crashlytics = getCrashlytics();
143
+ checkV9Deprecation(
144
+ () => log(crashlytics, 'message'),
145
+ () => crashlytics.log('message'),
146
+ 'log',
147
+ );
148
+ });
149
+
150
+ it('setAttribute', function () {
151
+ const crashlytics = getCrashlytics();
152
+ checkV9Deprecation(
153
+ () => setAttribute(crashlytics, 'name', 'value'),
154
+ () => crashlytics.setAttribute('name', 'value'),
155
+ 'setAttribute',
156
+ );
157
+ });
158
+
159
+ it('setAttributes', function () {
160
+ const crashlytics = getCrashlytics();
161
+ checkV9Deprecation(
162
+ () => setAttributes(crashlytics, {}),
163
+ () => crashlytics.setAttributes({}),
164
+ 'setAttributes',
165
+ );
166
+ });
167
+
168
+ it('setUserId', function () {
169
+ const crashlytics = getCrashlytics();
170
+ checkV9Deprecation(
171
+ () => setUserId(crashlytics, 'id'),
172
+ () => crashlytics.setUserId('id'),
173
+ 'setUserId',
174
+ );
175
+ });
176
+
177
+ it('recordError', function () {
178
+ const crashlytics = getCrashlytics();
179
+ checkV9Deprecation(
180
+ () => recordError(crashlytics, new Error(), 'name'),
181
+ () => crashlytics.recordError(new Error(), 'name'),
182
+ 'recordError',
183
+ );
184
+ });
185
+
186
+ it('sendUnsentReports', function () {
187
+ const crashlytics = getCrashlytics();
188
+ checkV9Deprecation(
189
+ () => sendUnsentReports(crashlytics),
190
+ () => crashlytics.sendUnsentReports(),
191
+ 'sendUnsentReports',
192
+ );
193
+ });
194
+
195
+ it('setCrashlyticsCollectionEnabled', function () {
196
+ const crashlytics = getCrashlytics();
197
+ checkV9Deprecation(
198
+ () => setCrashlyticsCollectionEnabled(crashlytics, true),
199
+ () => crashlytics.setCrashlyticsCollectionEnabled(true),
200
+ 'setCrashlyticsCollectionEnabled',
201
+ );
202
+ });
203
+
204
+ it('isCrashlyticsCollectionEnabled', function () {
205
+ const crashlytics = getCrashlytics();
206
+ checkV9Deprecation(
207
+ // swapped order here because we're deprecating the modular method and keeping the property on Crashlytics instance
208
+ () => crashlytics.isCrashlyticsCollectionEnabled,
209
+ () => isCrashlyticsCollectionEnabled(crashlytics),
210
+ '',
211
+ '`isCrashlyticsCollectionEnabled()` is deprecated, please use `Crashlytics.isCrashlyticsCollectionEnabled` property instead',
212
+ );
213
+ });
214
+ });
82
215
  });
package/lib/handlers.js CHANGED
@@ -103,7 +103,7 @@ export const setGlobalErrorHandler = once(nativeModule => {
103
103
  timestamp: fatalTime,
104
104
  },
105
105
  );
106
- } catch (e) {
106
+ } catch (_) {
107
107
  // This just means analytics was not present, so we could not log the analytics event
108
108
  // console.log('error logging analytics app_exception: ' + e);
109
109
  }
@@ -114,7 +114,7 @@ export const setGlobalErrorHandler = once(nativeModule => {
114
114
  } else {
115
115
  await nativeModule.crashWithStackPromise(createNativeErrorObj(error, stackFrames, false));
116
116
  }
117
- } catch (e) {
117
+ } catch (_) {
118
118
  // do nothing
119
119
  // console.log('error logging handling the exception: ' + e);
120
120
  }
@@ -131,7 +131,7 @@ export const setGlobalErrorHandler = once(nativeModule => {
131
131
  });
132
132
 
133
133
  export const setOnUnhandledPromiseRejectionHandler = once(nativeModule => {
134
- async function onUnhandled(id, error) {
134
+ async function onUnhandled(_id, error) {
135
135
  if (!__DEV__) {
136
136
  // TODO(salakar): Option to disable
137
137
  try {
package/lib/index.d.ts CHANGED
@@ -50,7 +50,7 @@ import { ReactNativeFirebase } from '@react-native-firebase/app';
50
50
  export namespace FirebaseCrashlyticsTypes {
51
51
  import FirebaseModule = ReactNativeFirebase.FirebaseModule;
52
52
 
53
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
53
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
54
54
  export interface Statics {}
55
55
 
56
56
  /**
@@ -272,7 +272,6 @@ export * from './modular';
272
272
  * Attach namespace to `firebase.` and `FirebaseApp.`.
273
273
  */
274
274
  declare module '@react-native-firebase/app' {
275
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
276
275
  namespace ReactNativeFirebase {
277
276
  import FirebaseModuleWithStatics = ReactNativeFirebase.FirebaseModuleWithStatics;
278
277
  interface Module {
package/lib/index.js CHANGED
@@ -51,6 +51,7 @@ class FirebaseCrashlyticsModule extends FirebaseModule {
51
51
  }
52
52
 
53
53
  get isCrashlyticsCollectionEnabled() {
54
+ // Purposefully did not deprecate this as I think it should remain a property rather than a method.
54
55
  return this._isCrashlyticsCollectionEnabled;
55
56
  }
56
57
 
@@ -1,3 +1,4 @@
1
+ import { MODULAR_DEPRECATION_ARG } from '@react-native-firebase/app/lib/common';
1
2
  import { firebase } from '..';
2
3
 
3
4
  /**
@@ -31,6 +32,11 @@ export function getCrashlytics() {
31
32
  * @returns {boolean}
32
33
  */
33
34
  export function isCrashlyticsCollectionEnabled(crashlytics) {
35
+ // Unique. Deprecating modular method and allow it as a property on Crashlytics instance.
36
+ // eslint-disable-next-line no-console
37
+ console.warn(
38
+ '`isCrashlyticsCollectionEnabled()` is deprecated, please use `Crashlytics.isCrashlyticsCollectionEnabled` property instead',
39
+ );
34
40
  return crashlytics.isCrashlyticsCollectionEnabled;
35
41
  }
36
42
 
@@ -53,7 +59,7 @@ export function isCrashlyticsCollectionEnabled(crashlytics) {
53
59
  * @returns {Promise<boolean>}
54
60
  */
55
61
  export function checkForUnsentReports(crashlytics) {
56
- return crashlytics.checkForUnsentReports();
62
+ return crashlytics.checkForUnsentReports.call(crashlytics, MODULAR_DEPRECATION_ARG);
57
63
  }
58
64
 
59
65
  /**
@@ -70,7 +76,7 @@ export function checkForUnsentReports(crashlytics) {
70
76
  * @returns {Promise<void>}
71
77
  */
72
78
  export function deleteUnsentReports(crashlytics) {
73
- return crashlytics.deleteUnsentReports();
79
+ return crashlytics.deleteUnsentReports.call(crashlytics, MODULAR_DEPRECATION_ARG);
74
80
  }
75
81
 
76
82
  /**
@@ -91,7 +97,7 @@ export function deleteUnsentReports(crashlytics) {
91
97
  * @returns {Promise<boolean>}
92
98
  */
93
99
  export function didCrashOnPreviousExecution(crashlytics) {
94
- return crashlytics.didCrashOnPreviousExecution();
100
+ return crashlytics.didCrashOnPreviousExecution.call(crashlytics, MODULAR_DEPRECATION_ARG);
95
101
  }
96
102
 
97
103
  /**
@@ -109,7 +115,7 @@ export function didCrashOnPreviousExecution(crashlytics) {
109
115
  * @returns {void}
110
116
  */
111
117
  export function crash(crashlytics) {
112
- return crashlytics.crash();
118
+ return crashlytics.crash.call(crashlytics, MODULAR_DEPRECATION_ARG);
113
119
  }
114
120
 
115
121
  /**
@@ -127,7 +133,7 @@ export function crash(crashlytics) {
127
133
  * @returns {void}
128
134
  */
129
135
  export function log(crashlytics, message) {
130
- return crashlytics.log(message);
136
+ return crashlytics.log.call(crashlytics, message, MODULAR_DEPRECATION_ARG);
131
137
  }
132
138
 
133
139
  /**
@@ -152,7 +158,7 @@ export function log(crashlytics, message) {
152
158
  * @returns {void}
153
159
  */
154
160
  export function recordError(crashlytics, error, jsErrorName) {
155
- return crashlytics.recordError(error, jsErrorName);
161
+ return crashlytics.recordError.call(crashlytics, error, jsErrorName, MODULAR_DEPRECATION_ARG);
156
162
  }
157
163
 
158
164
  /**
@@ -169,7 +175,7 @@ export function recordError(crashlytics, error, jsErrorName) {
169
175
  * @returns {void}
170
176
  */
171
177
  export function sendUnsentReports(crashlytics) {
172
- return crashlytics.sendUnsentReports();
178
+ return crashlytics.sendUnsentReports.call(crashlytics, MODULAR_DEPRECATION_ARG);
173
179
  }
174
180
 
175
181
  /**
@@ -196,7 +202,7 @@ export function sendUnsentReports(crashlytics) {
196
202
  * @returns {Promise<null>}
197
203
  */
198
204
  export function setUserId(crashlytics, userId) {
199
- return crashlytics.setUserId(userId);
205
+ return crashlytics.setUserId.call(crashlytics, userId, MODULAR_DEPRECATION_ARG);
200
206
  }
201
207
 
202
208
  /**
@@ -214,7 +220,7 @@ export function setUserId(crashlytics, userId) {
214
220
  * @returns {Promise<null>}
215
221
  */
216
222
  export function setAttribute(crashlytics, name, value) {
217
- return crashlytics.setAttribute(name, value);
223
+ return crashlytics.setAttribute.call(crashlytics, name, value, MODULAR_DEPRECATION_ARG);
218
224
  }
219
225
 
220
226
  /**
@@ -234,7 +240,7 @@ export function setAttribute(crashlytics, name, value) {
234
240
  * @returns {Promise<null>}
235
241
  */
236
242
  export function setAttributes(crashlytics, attributes) {
237
- return crashlytics.setAttributes(attributes);
243
+ return crashlytics.setAttributes.call(crashlytics, attributes, MODULAR_DEPRECATION_ARG);
238
244
  }
239
245
 
240
246
  /**
@@ -254,5 +260,9 @@ export function setAttributes(crashlytics, attributes) {
254
260
  * @returns {Promise<null>}
255
261
  */
256
262
  export function setCrashlyticsCollectionEnabled(crashlytics, enabled) {
257
- return crashlytics.setCrashlyticsCollectionEnabled(enabled);
263
+ return crashlytics.setCrashlyticsCollectionEnabled.call(
264
+ crashlytics,
265
+ enabled,
266
+ MODULAR_DEPRECATION_ARG,
267
+ );
258
268
  }
package/lib/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- module.exports = '21.7.0';
2
+ module.exports = '21.7.2';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-firebase/crashlytics",
3
- "version": "21.7.0",
3
+ "version": "21.7.2",
4
4
  "author": "Invertase <oss@invertase.io> (http://invertase.io)",
5
5
  "description": "React Native Firebase - Firebase Crashlytics is a lightweight, realtime crash reporter that helps you track, prioritize, and fix stability issues that erode your app quality. React Native Firebase provides automatic crash reporting for both native and JavaScript errors, including unhandled promise rejections.",
6
6
  "main": "lib/index.js",
@@ -29,14 +29,14 @@
29
29
  "crashlytics"
30
30
  ],
31
31
  "peerDependencies": {
32
- "@react-native-firebase/app": "21.7.0",
32
+ "@react-native-firebase/app": "21.7.2",
33
33
  "expo": ">=47.0.0"
34
34
  },
35
35
  "dependencies": {
36
36
  "stacktrace-js": "^2.0.2"
37
37
  },
38
38
  "devDependencies": {
39
- "expo": "^50.0.21"
39
+ "expo": "^52.0.30"
40
40
  },
41
41
  "peerDependenciesMeta": {
42
42
  "expo": {
@@ -46,5 +46,5 @@
46
46
  "publishConfig": {
47
47
  "access": "public"
48
48
  },
49
- "gitHead": "c027ef2d772882c091383b7ff81b65573f549b5d"
49
+ "gitHead": "209b36e4b469355e4d024ecdeb6c875f8bd8a187"
50
50
  }
@@ -1 +1 @@
1
- {"root":["./src/index.ts","./src/android/applyPlugin.ts","./src/android/buildscriptDependency.ts","./src/android/constants.ts","./src/android/index.ts"],"version":"5.6.2"}
1
+ {"root":["./src/index.ts","./src/android/applyPlugin.ts","./src/android/buildscriptDependency.ts","./src/android/constants.ts","./src/android/index.ts"],"version":"5.7.3"}