@react-native-firebase/crashlytics 20.0.0 → 20.2.0
Sign up to get free protection for your applications and to get access to all the features.
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
|
+
## [20.2.0](https://github.com/invertase/react-native-firebase/compare/v20.1.0...v20.2.0) (2024-07-15)
|
7
|
+
|
8
|
+
### Bug Fixes
|
9
|
+
|
10
|
+
- **app, android:** adopt firebase-android-sdk 31.1.1 ([dba1beb](https://github.com/invertase/react-native-firebase/commit/dba1beba97d88d1110e0838b6287fd4907cfa8a7))
|
11
|
+
- **crashlytics, ios:** init w/componentsToRegister vs configureWithApp ([ca07cad](https://github.com/invertase/react-native-firebase/commit/ca07cadd592487102b035a24b55f593f065ef4a5))
|
12
|
+
|
13
|
+
## [20.1.0](https://github.com/invertase/react-native-firebase/compare/v20.0.0...v20.1.0) (2024-06-04)
|
14
|
+
|
15
|
+
**Note:** Version bump only for package @react-native-firebase/crashlytics
|
16
|
+
|
6
17
|
## [20.0.0](https://github.com/invertase/react-native-firebase/compare/v19.3.0...v20.0.0) (2024-05-20)
|
7
18
|
|
8
19
|
### ⚠ BREAKING CHANGES
|
@@ -30,8 +30,4 @@
|
|
30
30
|
/// FIRApp and participate in dependency resolution and injection.
|
31
31
|
+ (NSArray<FIRComponent *> *)componentsToRegister;
|
32
32
|
|
33
|
-
/// Implement this method if the library needs notifications for lifecycle events. This method is
|
34
|
-
/// called when the developer calls `FirebaseApp.configure()`.
|
35
|
-
+ (void)configureWithApp:(FIRApp *)app;
|
36
|
-
|
37
33
|
@end
|
@@ -18,6 +18,11 @@
|
|
18
18
|
#import "RNFBCrashlyticsInitProvider.h"
|
19
19
|
#import <Firebase/Firebase.h>
|
20
20
|
#import <FirebaseCoreExtension/FIRAppInternal.h>
|
21
|
+
#import <FirebaseCoreExtension/FIRComponent.h>
|
22
|
+
#import <FirebaseCoreExtension/FIRComponentContainer.h>
|
23
|
+
#import <FirebaseCoreExtension/FIRComponentType.h>
|
24
|
+
#import <FirebaseCoreExtension/FIRLibrary.h>
|
25
|
+
#import <FirebaseCrashlytics/FIRCrashlytics.h>
|
21
26
|
#import "RNFBJSON.h"
|
22
27
|
#import "RNFBMeta.h"
|
23
28
|
#import "RNFBPreferences.h"
|
@@ -32,6 +37,19 @@ NSString *const KEY_CRASHLYTICS_IS_ERROR_GENERATION_ON_JS_CRASH_ENABLED =
|
|
32
37
|
NSString *const KEY_CRASHLYTICS_JAVASCRIPT_EXCEPTION_HANDLER_CHAINING_ENABLED =
|
33
38
|
@"crashlytics_javascript_exception_handler_chaining_enabled";
|
34
39
|
|
40
|
+
/// Empty protocol to register this provider as a component with Core.
|
41
|
+
@protocol RNFBCrashlyticsInitProviderProtocol
|
42
|
+
@end
|
43
|
+
|
44
|
+
/// The name of the Crashlytics component in FirebaseCore's component system. Reference:
|
45
|
+
// https://github.com/firebase/firebase-ios-sdk/blob/main/Crashlytics/Crashlytics/FIRCrashlytics.m#L87-L89
|
46
|
+
@protocol FIRCrashlyticsInstanceProvider <NSObject>
|
47
|
+
@end
|
48
|
+
|
49
|
+
/// Privately conform to the protocol for component registration.
|
50
|
+
@interface RNFBCrashlyticsInitProvider () <RNFBCrashlyticsInitProviderProtocol, FIRLibrary>
|
51
|
+
@end
|
52
|
+
|
35
53
|
@implementation RNFBCrashlyticsInitProvider
|
36
54
|
|
37
55
|
+ (void)load {
|
@@ -79,26 +97,47 @@ NSString *const KEY_CRASHLYTICS_JAVASCRIPT_EXCEPTION_HANDLER_CHAINING_ENABLED =
|
|
79
97
|
}
|
80
98
|
|
81
99
|
+ (NSArray<FIRComponent *> *)componentsToRegister {
|
82
|
-
|
83
|
-
|
100
|
+
// Goal: enable or disable crashlytics logging based on firebase.json settings at app startup
|
101
|
+
//
|
102
|
+
// Problem: We need a correctly instantiated Crashlytics component in order to configure it
|
103
|
+
//
|
104
|
+
// Solution:
|
105
|
+
// 1) put the desired startup logic that requires Crashlytics dependency in deferrable block...
|
106
|
+
FIRComponentCreationBlock creationBlock =
|
107
|
+
^id _Nullable(FIRComponentContainer *container, BOOL *isCacheable) {
|
108
|
+
if (!container.app.isDefaultApp) {
|
109
|
+
return nil;
|
110
|
+
}
|
84
111
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
112
|
+
// Ensure it's cached so it returns the same instance every time messaging is called.
|
113
|
+
*isCacheable = YES;
|
114
|
+
|
115
|
+
// 2) ... ask the SDK component system to get a correctly running dependency...
|
116
|
+
// Note: This is a FIRCrashlytics *, directly cast it later for practical use, reference:
|
117
|
+
// https://github.com/firebase/firebase-ios-sdk/blob/main/Crashlytics/Crashlytics/FIRCrashlytics.m#L282-L284
|
118
|
+
id<FIRCrashlyticsInstanceProvider> crashlytics =
|
119
|
+
FIR_COMPONENT(FIRCrashlyticsInstanceProvider, container);
|
120
|
+
|
121
|
+
// This setting is sticky. setCrashlyticsCollectionEnabled persists the setting to disk until it
|
122
|
+
// is explicitly set otherwise or the app is deleted. Jump to the
|
123
|
+
// setCrashlyticsCollectionEnabled definition to see implementation details.
|
124
|
+
[(FIRCrashlytics *)crashlytics
|
125
|
+
setCrashlyticsCollectionEnabled:self.isCrashlyticsCollectionEnabled];
|
126
|
+
|
127
|
+
// For testing: filter for this in logs to make sure this block executes via
|
128
|
+
// xcrun simctl spawn booted log stream --level debug --style compact |grep RNFBCrashlyticsInit
|
129
|
+
DLog(@"RNFBCrashlyticsInit initialization successful");
|
130
|
+
return nil;
|
131
|
+
};
|
132
|
+
|
133
|
+
// 3) ...finally: register startup block to run w/Crashlytics dependency when ready
|
134
|
+
FIRComponent *crashlyticsInitProvider =
|
135
|
+
[FIRComponent componentWithProtocol:@protocol(RNFBCrashlyticsInitProviderProtocol)
|
136
|
+
instantiationTiming:FIRInstantiationTimingEagerInDefaultApp
|
137
|
+
dependencies:@[] // note this will go away in firebase-ios-sdk v11+
|
138
|
+
creationBlock:creationBlock];
|
139
|
+
|
140
|
+
return @[ crashlyticsInitProvider ];
|
102
141
|
}
|
103
142
|
|
104
143
|
@end
|
package/lib/index.js
CHANGED
@@ -16,7 +16,13 @@
|
|
16
16
|
*
|
17
17
|
*/
|
18
18
|
|
19
|
-
import {
|
19
|
+
import {
|
20
|
+
isBoolean,
|
21
|
+
isError,
|
22
|
+
isObject,
|
23
|
+
isString,
|
24
|
+
isOther,
|
25
|
+
} from '@react-native-firebase/app/lib/common';
|
20
26
|
import {
|
21
27
|
createModuleNamespace,
|
22
28
|
FirebaseModule,
|
@@ -161,4 +167,8 @@ export default createModuleNamespace({
|
|
161
167
|
// crashlytics().X(...);
|
162
168
|
// firebase.crashlytics().X(...);
|
163
169
|
export const firebase = getFirebaseRoot();
|
164
|
-
|
170
|
+
|
171
|
+
// This will throw with 'Default App Not initialized' if the default app is not configured.
|
172
|
+
if (!isOther) {
|
173
|
+
firebase.crashlytics();
|
174
|
+
}
|
package/lib/version.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
// Generated by genversion.
|
2
|
-
module.exports = '20.
|
2
|
+
module.exports = '20.2.0';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@react-native-firebase/crashlytics",
|
3
|
-
"version": "20.
|
3
|
+
"version": "20.2.0",
|
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": "20.
|
32
|
+
"@react-native-firebase/app": "20.2.0",
|
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.
|
39
|
+
"expo": "^50.0.19"
|
40
40
|
},
|
41
41
|
"peerDependenciesMeta": {
|
42
42
|
"expo": {
|
@@ -46,5 +46,5 @@
|
|
46
46
|
"publishConfig": {
|
47
47
|
"access": "public"
|
48
48
|
},
|
49
|
-
"gitHead": "
|
49
|
+
"gitHead": "82c50138d07e673213cd8dee5ce9a2f9b5656649"
|
50
50
|
}
|