@react-native-firebase/crashlytics 25.1.0 → 26.0.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 +16 -0
- package/RNFBCrashlytics.podspec +10 -6
- package/android/build.gradle +23 -0
- package/android/src/main/java/io/invertase/firebase/crashlytics/{ReactNativeFirebaseCrashlyticsModule.java → NativeRNFBTurboCrashlytics.java} +44 -39
- package/android/src/main/java/io/invertase/firebase/crashlytics/ReactNativeFirebaseCrashlyticsPackage.java +1 -1
- package/android/src/main/java/io/invertase/firebase/crashlytics/generated/java/com/facebook/fbreact/specs/NativeRNFBTurboCrashlyticsSpec.java +125 -0
- package/android/src/main/java/io/invertase/firebase/crashlytics/generated/jni/CMakeLists.txt +36 -0
- package/android/src/main/java/io/invertase/firebase/crashlytics/generated/jni/RNFBCrashlyticsTurboModules-generated.cpp +116 -0
- package/android/src/main/java/io/invertase/firebase/crashlytics/generated/jni/RNFBCrashlyticsTurboModules.h +31 -0
- package/android/src/main/java/io/invertase/firebase/crashlytics/generated/jni/react/renderer/components/RNFBCrashlyticsTurboModules/RNFBCrashlyticsTurboModulesJSI-generated.cpp +124 -0
- package/android/src/main/java/io/invertase/firebase/crashlytics/generated/jni/react/renderer/components/RNFBCrashlyticsTurboModules/RNFBCrashlyticsTurboModulesJSI.h +320 -0
- package/app.plugin.js +1 -1
- package/dist/module/handlers.js +7 -24
- package/dist/module/handlers.js.map +1 -1
- package/dist/module/index.js +125 -8
- package/dist/module/index.js.map +1 -1
- package/dist/module/types/crashlytics.js +1 -40
- package/dist/module/types/crashlytics.js.map +1 -1
- package/dist/module/types/internal.js +4 -0
- package/dist/module/types/internal.js.map +1 -0
- package/dist/module/version.js +1 -1
- package/dist/typescript/lib/handlers.d.ts.map +1 -1
- package/dist/typescript/lib/index.d.ts +19 -4
- package/dist/typescript/lib/index.d.ts.map +1 -1
- package/dist/typescript/lib/types/crashlytics.d.ts +0 -21
- package/dist/typescript/lib/types/crashlytics.d.ts.map +1 -1
- package/dist/typescript/lib/types/internal.d.ts +44 -0
- package/dist/typescript/lib/types/internal.d.ts.map +1 -0
- package/dist/typescript/lib/version.d.ts +1 -1
- package/ios/RNFBCrashlytics/RNFBCrashlyticsModule.h +2 -3
- package/ios/RNFBCrashlytics/{RNFBCrashlyticsModule.m → RNFBCrashlyticsModule.mm} +64 -72
- package/ios/RNFBCrashlytics.xcodeproj/project.pbxproj +8 -8
- package/ios/generated/RCTAppDependencyProvider.h +25 -0
- package/ios/generated/RCTAppDependencyProvider.mm +55 -0
- package/ios/generated/RCTModulesConformingToProtocolsProvider.h +18 -0
- package/ios/generated/RCTModulesConformingToProtocolsProvider.mm +33 -0
- package/ios/generated/RCTThirdPartyComponentsProvider.h +16 -0
- package/ios/generated/RCTThirdPartyComponentsProvider.mm +23 -0
- package/ios/generated/RNFBCrashlyticsTurboModules/RNFBCrashlyticsTurboModules-generated.mm +148 -0
- package/ios/generated/RNFBCrashlyticsTurboModules/RNFBCrashlyticsTurboModules.h +214 -0
- package/ios/generated/RNFBCrashlyticsTurboModulesJSI-generated.cpp +124 -0
- package/ios/generated/RNFBCrashlyticsTurboModulesJSI.h +320 -0
- package/ios/generated/ReactAppDependencyProvider.podspec +34 -0
- package/lib/handlers.ts +7 -26
- package/lib/index.ts +209 -7
- package/lib/types/crashlytics.ts +0 -30
- package/lib/types/internal.ts +59 -0
- package/lib/version.ts +1 -1
- package/package.json +30 -5
- package/plugin/build/app.plugin.d.ts +2 -0
- package/plugin/build/app.plugin.js +6 -0
- package/plugin/src/app.plugin.ts +3 -0
- package/plugin/tsconfig.tsbuildinfo +1 -1
- package/react-native.config.js +3 -28
- package/specs/NativeRNFBTurboCrashlytics.ts +41 -0
- package/typedoc.json +2 -3
- package/dist/module/modular.js +0 -241
- package/dist/module/modular.js.map +0 -1
- package/dist/module/namespaced.js +0 -135
- package/dist/module/namespaced.js.map +0 -1
- package/dist/typescript/lib/modular.d.ts +0 -193
- package/dist/typescript/lib/modular.d.ts.map +0 -1
- package/dist/typescript/lib/namespaced.d.ts +0 -12
- package/dist/typescript/lib/namespaced.d.ts.map +0 -1
- package/lib/modular.ts +0 -249
- package/lib/namespaced.ts +0 -206
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
import type { Crashlytics } from './types/crashlytics';
|
|
2
|
-
/**
|
|
3
|
-
* Returns Crashlytics instance.
|
|
4
|
-
* #### Example
|
|
5
|
-
* ```js
|
|
6
|
-
* const crashlytics = getCrashlytics();
|
|
7
|
-
* ```
|
|
8
|
-
*/
|
|
9
|
-
export declare function getCrashlytics(): Crashlytics;
|
|
10
|
-
/**
|
|
11
|
-
* Determines whether there are any unsent crash reports cached on the device. The callback only executes
|
|
12
|
-
* if automatic data collection is disabled.
|
|
13
|
-
*
|
|
14
|
-
* #### Example
|
|
15
|
-
*
|
|
16
|
-
* ```js
|
|
17
|
-
* async checkReports() {
|
|
18
|
-
* // returns boolean value
|
|
19
|
-
* const crashlytics = getCrashlytics();
|
|
20
|
-
* const unsentReports = await checkForUnsentReports(crashlytics);
|
|
21
|
-
* }
|
|
22
|
-
*
|
|
23
|
-
* checkReports();
|
|
24
|
-
* ```
|
|
25
|
-
* @param crashlytics A crashlytics instance.
|
|
26
|
-
* @returns Promise that resolves to a boolean indicating if there are unsent reports.
|
|
27
|
-
*/
|
|
28
|
-
export declare function checkForUnsentReports(crashlytics: Crashlytics): Promise<boolean>;
|
|
29
|
-
/**
|
|
30
|
-
* Deletes any unsent reports on the device. This method only applies if automatic data collection is
|
|
31
|
-
* disabled.
|
|
32
|
-
*
|
|
33
|
-
* #### Example
|
|
34
|
-
*
|
|
35
|
-
* ```js
|
|
36
|
-
* const crashlytics = getCrashlytics();
|
|
37
|
-
* deleteUnsentReports(crashlytics);
|
|
38
|
-
* ```
|
|
39
|
-
* @param crashlytics A crashlytics instance.
|
|
40
|
-
*/
|
|
41
|
-
export declare function deleteUnsentReports(crashlytics: Crashlytics): Promise<void>;
|
|
42
|
-
/**
|
|
43
|
-
* Returns a boolean value indicating whether the app crashed during the previous execution.
|
|
44
|
-
*
|
|
45
|
-
* #### Example
|
|
46
|
-
*
|
|
47
|
-
* ```js
|
|
48
|
-
* async didCrashPreviously() {
|
|
49
|
-
* // returns boolean value
|
|
50
|
-
* const crashlytics = getCrashlytics();
|
|
51
|
-
* const didCrash = await didCrashOnPreviousExecution(crashlytics);
|
|
52
|
-
* }
|
|
53
|
-
*
|
|
54
|
-
* didCrashPreviously();
|
|
55
|
-
* ```
|
|
56
|
-
* @param crashlytics A crashlytics instance.
|
|
57
|
-
* @returns Promise that resolves to a boolean indicating if the app crashed previously.
|
|
58
|
-
*/
|
|
59
|
-
export declare function didCrashOnPreviousExecution(crashlytics: Crashlytics): Promise<boolean>;
|
|
60
|
-
/**
|
|
61
|
-
* Cause your app to crash for testing purposes. This is a native crash and will not contain a javascript stack trace.
|
|
62
|
-
* Note that crashes are intercepted by debuggers on iOS so no report will be seen under those conditions. Additionally
|
|
63
|
-
* if it is a debug build you will need to ensure your firebase.json is configured to enable crashlytics even in debug mode.
|
|
64
|
-
*
|
|
65
|
-
* #### Example
|
|
66
|
-
*
|
|
67
|
-
* ```js
|
|
68
|
-
* const crashlytics = getCrashlytics();
|
|
69
|
-
* crash(crashlytics);
|
|
70
|
-
* ```
|
|
71
|
-
* @param crashlytics A crashlytics instance.
|
|
72
|
-
*/
|
|
73
|
-
export declare function crash(crashlytics: Crashlytics): void;
|
|
74
|
-
/**
|
|
75
|
-
* Log a message that will appear in any subsequent Crash or Non-fatal error reports.
|
|
76
|
-
*
|
|
77
|
-
* #### Example
|
|
78
|
-
*
|
|
79
|
-
* ```js
|
|
80
|
-
* const crashlytics = getCrashlytics();
|
|
81
|
-
* log(crashlytics, 'Testing a crash');
|
|
82
|
-
* crash(crashlytics);
|
|
83
|
-
* ```
|
|
84
|
-
* @param crashlytics A crashlytics instance.
|
|
85
|
-
* @param message The message to log.
|
|
86
|
-
*/
|
|
87
|
-
export declare function log(crashlytics: Crashlytics, message: string): void;
|
|
88
|
-
/**
|
|
89
|
-
* Record a JavaScript Error.
|
|
90
|
-
*
|
|
91
|
-
* The JavaScript stack trace is converted into a mock native iOS or Android exception before submission.
|
|
92
|
-
* The line numbers in the stack trace (if available) will be relative to the javascript bundle built by your packager,
|
|
93
|
-
* after whatever transpilation or minimization steps happen. You will need to maintain sourcemaps to decode them if desired.
|
|
94
|
-
*
|
|
95
|
-
* #### Example
|
|
96
|
-
*
|
|
97
|
-
* ```js
|
|
98
|
-
* const crashlytics = getCrashlytics();
|
|
99
|
-
* recordError(
|
|
100
|
-
* crashlytics,
|
|
101
|
-
* new Error('An error was caught')
|
|
102
|
-
* );
|
|
103
|
-
* ```
|
|
104
|
-
* @param crashlytics A crashlytics instance.
|
|
105
|
-
* @param error Expects an instance of Error; e.g. classes that extend Error will also be supported.
|
|
106
|
-
* @param jsErrorName Optional string containing Javascript error name
|
|
107
|
-
*/
|
|
108
|
-
export declare function recordError(crashlytics: Crashlytics, error: Error, jsErrorName?: string): void;
|
|
109
|
-
/**
|
|
110
|
-
* Enqueues any unsent reports on the device to upload to Crashlytics. This method only applies if
|
|
111
|
-
* automatic data collection is disabled.
|
|
112
|
-
*
|
|
113
|
-
* #### Example
|
|
114
|
-
*
|
|
115
|
-
* ```js
|
|
116
|
-
* const crashlytics = getCrashlytics();
|
|
117
|
-
* sendUnsentReports(crashlytics);
|
|
118
|
-
* ```
|
|
119
|
-
* @param crashlytics A crashlytics instance.
|
|
120
|
-
*/
|
|
121
|
-
export declare function sendUnsentReports(crashlytics: Crashlytics): void;
|
|
122
|
-
/**
|
|
123
|
-
* Specify a user identifier which will be visible in the Firebase Crashlytics console.
|
|
124
|
-
*
|
|
125
|
-
* It is recommended for privacy purposes that this value be a value that's meaningless to a third-party
|
|
126
|
-
* observer; such as an arbitrary string that ties an end-user to a record in your system e.g. a database record id.
|
|
127
|
-
*
|
|
128
|
-
* #### Example
|
|
129
|
-
*
|
|
130
|
-
* ```js
|
|
131
|
-
* const auth = getAuth();
|
|
132
|
-
* const crashlytics = getCrashlytics();
|
|
133
|
-
* // Custom user id
|
|
134
|
-
* await setUserId(crashlytics, '123456789');
|
|
135
|
-
* // Firebase auth uid
|
|
136
|
-
* await setUserId(
|
|
137
|
-
* crashlytics,
|
|
138
|
-
* auth.currentUser.uid
|
|
139
|
-
* );
|
|
140
|
-
* ```
|
|
141
|
-
* @param crashlytics A crashlytics instance.
|
|
142
|
-
* @param userId An arbitrary string that ties an end-user to a record in your system e.g. a database record id.
|
|
143
|
-
*/
|
|
144
|
-
export declare function setUserId(crashlytics: Crashlytics, userId: string): Promise<null>;
|
|
145
|
-
/**
|
|
146
|
-
* Sets a string value to be associated with the given attribute name which will be visible in the Firebase Crashlytics console.
|
|
147
|
-
*
|
|
148
|
-
* #### Example
|
|
149
|
-
*
|
|
150
|
-
* ```js
|
|
151
|
-
* const crashlytics = getCrashlytics();
|
|
152
|
-
* await setAttribute(crashlytics, 'role', 'admin');
|
|
153
|
-
* ```
|
|
154
|
-
* @param crashlytics A crashlytics instance.
|
|
155
|
-
* @param name The name of the attribute to set.
|
|
156
|
-
* @param value A string value for the given attribute.
|
|
157
|
-
*/
|
|
158
|
-
export declare function setAttribute(crashlytics: Crashlytics, name: string, value: string): Promise<null>;
|
|
159
|
-
/**
|
|
160
|
-
* Like `setAttribute` but for multiple attributes.
|
|
161
|
-
*
|
|
162
|
-
* #### Example
|
|
163
|
-
*
|
|
164
|
-
* ```js
|
|
165
|
-
* const crashlytics = getCrashlytics();
|
|
166
|
-
* await setAttributes(crashlytics, {
|
|
167
|
-
* role: 'admin',
|
|
168
|
-
* followers: '13',
|
|
169
|
-
* });
|
|
170
|
-
* ```
|
|
171
|
-
* @param crashlytics A crashlytics instance.
|
|
172
|
-
* @param attributes An object of key/value attribute name and values.
|
|
173
|
-
*/
|
|
174
|
-
export declare function setAttributes(crashlytics: Crashlytics, attributes: {
|
|
175
|
-
[key: string]: string;
|
|
176
|
-
}): Promise<null>;
|
|
177
|
-
/**
|
|
178
|
-
* Enable/disable Crashlytics reporting.
|
|
179
|
-
*
|
|
180
|
-
* Use this for opt-in first user data collection flows combined with `firebase.json` settings to disable auto collection.
|
|
181
|
-
*
|
|
182
|
-
* #### Example
|
|
183
|
-
*
|
|
184
|
-
* ```js
|
|
185
|
-
* const crashlytics = getCrashlytics();
|
|
186
|
-
* // Disable crash reporting
|
|
187
|
-
* await setCrashlyticsCollectionEnabled(crashlytics, false);
|
|
188
|
-
* ```
|
|
189
|
-
* @param crashlytics A crashlytics instance.
|
|
190
|
-
* @param enabled A boolean value representing whether to enable Crashlytics error collection.
|
|
191
|
-
*/
|
|
192
|
-
export declare function setCrashlyticsCollectionEnabled(crashlytics: Crashlytics, enabled: boolean): Promise<null>;
|
|
193
|
-
//# sourceMappingURL=modular.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"modular.d.ts","sourceRoot":"","sources":["../../../lib/modular.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;;;GAMG;AACH,wBAAgB,cAAc,IAAI,WAAW,CAE5C;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAGhF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAG3E;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAGtF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,KAAK,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,CAGpD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,GAAG,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAGnE;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,WAAW,CAAC,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAG9F;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,CAGhE;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,SAAS,CAAC,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGjF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGjG;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,CAC3B,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GACpC,OAAO,CAAC,IAAI,CAAC,CAGf;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,+BAA+B,CAC7C,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,IAAI,CAAC,CAOf"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { Crashlytics, Statics } from './types/crashlytics';
|
|
2
|
-
import type { ReactNativeFirebase } from '@react-native-firebase/app';
|
|
3
|
-
export declare const SDK_VERSION = "25.1.0";
|
|
4
|
-
type CrashlyticsNamespace = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp<Crashlytics, Statics> & {
|
|
5
|
-
crashlytics: ReactNativeFirebase.FirebaseModuleWithStaticsAndApp<Crashlytics, Statics>;
|
|
6
|
-
firebase: ReactNativeFirebase.Module;
|
|
7
|
-
app(name?: string): ReactNativeFirebase.FirebaseApp;
|
|
8
|
-
};
|
|
9
|
-
declare const _default: CrashlyticsNamespace;
|
|
10
|
-
export default _default;
|
|
11
|
-
export declare const firebase: ReactNativeFirebase.FirebaseNamespacedExport<"crashlytics", Crashlytics, Statics, false>;
|
|
12
|
-
//# sourceMappingURL=namespaced.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"namespaced.d.ts","sourceRoot":"","sources":["../../../lib/namespaced.ts"],"names":[],"mappings":"AAwCA,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAuHtE,eAAO,MAAM,WAAW,WAAU,CAAC;AAanC,KAAK,oBAAoB,GAAG,mBAAmB,CAAC,+BAA+B,CAC7E,WAAW,EACX,OAAO,CACR,GAAG;IACF,WAAW,EAAE,mBAAmB,CAAC,+BAA+B,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IACvF,QAAQ,EAAE,mBAAmB,CAAC,MAAM,CAAC;IACrC,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,mBAAmB,CAAC,WAAW,CAAC;CACrD,CAAC;wBAIgD,oBAAoB;AAAtE,wBAAuE;AAKvE,eAAO,MAAM,QAAQ,EACa,mBAAmB,CAAC,wBAAwB,CAC1E,aAAa,EACb,WAAW,EACX,OAAO,EACP,KAAK,CACN,CAAC"}
|
package/lib/modular.ts
DELETED
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
import { getApp } from '@react-native-firebase/app';
|
|
2
|
-
import { MODULAR_DEPRECATION_ARG } from '@react-native-firebase/app/dist/module/common';
|
|
3
|
-
import type { Crashlytics } from './types/crashlytics';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Returns Crashlytics instance.
|
|
7
|
-
* #### Example
|
|
8
|
-
* ```js
|
|
9
|
-
* const crashlytics = getCrashlytics();
|
|
10
|
-
* ```
|
|
11
|
-
*/
|
|
12
|
-
export function getCrashlytics(): Crashlytics {
|
|
13
|
-
return getApp().crashlytics();
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Determines whether there are any unsent crash reports cached on the device. The callback only executes
|
|
18
|
-
* if automatic data collection is disabled.
|
|
19
|
-
*
|
|
20
|
-
* #### Example
|
|
21
|
-
*
|
|
22
|
-
* ```js
|
|
23
|
-
* async checkReports() {
|
|
24
|
-
* // returns boolean value
|
|
25
|
-
* const crashlytics = getCrashlytics();
|
|
26
|
-
* const unsentReports = await checkForUnsentReports(crashlytics);
|
|
27
|
-
* }
|
|
28
|
-
*
|
|
29
|
-
* checkReports();
|
|
30
|
-
* ```
|
|
31
|
-
* @param crashlytics A crashlytics instance.
|
|
32
|
-
* @returns Promise that resolves to a boolean indicating if there are unsent reports.
|
|
33
|
-
*/
|
|
34
|
-
export function checkForUnsentReports(crashlytics: Crashlytics): Promise<boolean> {
|
|
35
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is not defined in the global scope
|
|
36
|
-
return crashlytics.checkForUnsentReports.call(crashlytics, MODULAR_DEPRECATION_ARG);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Deletes any unsent reports on the device. This method only applies if automatic data collection is
|
|
41
|
-
* disabled.
|
|
42
|
-
*
|
|
43
|
-
* #### Example
|
|
44
|
-
*
|
|
45
|
-
* ```js
|
|
46
|
-
* const crashlytics = getCrashlytics();
|
|
47
|
-
* deleteUnsentReports(crashlytics);
|
|
48
|
-
* ```
|
|
49
|
-
* @param crashlytics A crashlytics instance.
|
|
50
|
-
*/
|
|
51
|
-
export function deleteUnsentReports(crashlytics: Crashlytics): Promise<void> {
|
|
52
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is not defined in the global scope
|
|
53
|
-
return crashlytics.deleteUnsentReports.call(crashlytics, MODULAR_DEPRECATION_ARG);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Returns a boolean value indicating whether the app crashed during the previous execution.
|
|
58
|
-
*
|
|
59
|
-
* #### Example
|
|
60
|
-
*
|
|
61
|
-
* ```js
|
|
62
|
-
* async didCrashPreviously() {
|
|
63
|
-
* // returns boolean value
|
|
64
|
-
* const crashlytics = getCrashlytics();
|
|
65
|
-
* const didCrash = await didCrashOnPreviousExecution(crashlytics);
|
|
66
|
-
* }
|
|
67
|
-
*
|
|
68
|
-
* didCrashPreviously();
|
|
69
|
-
* ```
|
|
70
|
-
* @param crashlytics A crashlytics instance.
|
|
71
|
-
* @returns Promise that resolves to a boolean indicating if the app crashed previously.
|
|
72
|
-
*/
|
|
73
|
-
export function didCrashOnPreviousExecution(crashlytics: Crashlytics): Promise<boolean> {
|
|
74
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is not defined in the global scope
|
|
75
|
-
return crashlytics.didCrashOnPreviousExecution.call(crashlytics, MODULAR_DEPRECATION_ARG);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Cause your app to crash for testing purposes. This is a native crash and will not contain a javascript stack trace.
|
|
80
|
-
* Note that crashes are intercepted by debuggers on iOS so no report will be seen under those conditions. Additionally
|
|
81
|
-
* if it is a debug build you will need to ensure your firebase.json is configured to enable crashlytics even in debug mode.
|
|
82
|
-
*
|
|
83
|
-
* #### Example
|
|
84
|
-
*
|
|
85
|
-
* ```js
|
|
86
|
-
* const crashlytics = getCrashlytics();
|
|
87
|
-
* crash(crashlytics);
|
|
88
|
-
* ```
|
|
89
|
-
* @param crashlytics A crashlytics instance.
|
|
90
|
-
*/
|
|
91
|
-
export function crash(crashlytics: Crashlytics): void {
|
|
92
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is not defined in the global scope
|
|
93
|
-
return crashlytics.crash.call(crashlytics, MODULAR_DEPRECATION_ARG);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Log a message that will appear in any subsequent Crash or Non-fatal error reports.
|
|
98
|
-
*
|
|
99
|
-
* #### Example
|
|
100
|
-
*
|
|
101
|
-
* ```js
|
|
102
|
-
* const crashlytics = getCrashlytics();
|
|
103
|
-
* log(crashlytics, 'Testing a crash');
|
|
104
|
-
* crash(crashlytics);
|
|
105
|
-
* ```
|
|
106
|
-
* @param crashlytics A crashlytics instance.
|
|
107
|
-
* @param message The message to log.
|
|
108
|
-
*/
|
|
109
|
-
export function log(crashlytics: Crashlytics, message: string): void {
|
|
110
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is not defined in the global scope
|
|
111
|
-
return crashlytics.log.call(crashlytics, message, MODULAR_DEPRECATION_ARG);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Record a JavaScript Error.
|
|
116
|
-
*
|
|
117
|
-
* The JavaScript stack trace is converted into a mock native iOS or Android exception before submission.
|
|
118
|
-
* The line numbers in the stack trace (if available) will be relative to the javascript bundle built by your packager,
|
|
119
|
-
* after whatever transpilation or minimization steps happen. You will need to maintain sourcemaps to decode them if desired.
|
|
120
|
-
*
|
|
121
|
-
* #### Example
|
|
122
|
-
*
|
|
123
|
-
* ```js
|
|
124
|
-
* const crashlytics = getCrashlytics();
|
|
125
|
-
* recordError(
|
|
126
|
-
* crashlytics,
|
|
127
|
-
* new Error('An error was caught')
|
|
128
|
-
* );
|
|
129
|
-
* ```
|
|
130
|
-
* @param crashlytics A crashlytics instance.
|
|
131
|
-
* @param error Expects an instance of Error; e.g. classes that extend Error will also be supported.
|
|
132
|
-
* @param jsErrorName Optional string containing Javascript error name
|
|
133
|
-
*/
|
|
134
|
-
export function recordError(crashlytics: Crashlytics, error: Error, jsErrorName?: string): void {
|
|
135
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is not defined in the global scope
|
|
136
|
-
return crashlytics.recordError.call(crashlytics, error, jsErrorName, MODULAR_DEPRECATION_ARG);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Enqueues any unsent reports on the device to upload to Crashlytics. This method only applies if
|
|
141
|
-
* automatic data collection is disabled.
|
|
142
|
-
*
|
|
143
|
-
* #### Example
|
|
144
|
-
*
|
|
145
|
-
* ```js
|
|
146
|
-
* const crashlytics = getCrashlytics();
|
|
147
|
-
* sendUnsentReports(crashlytics);
|
|
148
|
-
* ```
|
|
149
|
-
* @param crashlytics A crashlytics instance.
|
|
150
|
-
*/
|
|
151
|
-
export function sendUnsentReports(crashlytics: Crashlytics): void {
|
|
152
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is not defined in the global scope
|
|
153
|
-
return crashlytics.sendUnsentReports.call(crashlytics, MODULAR_DEPRECATION_ARG);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Specify a user identifier which will be visible in the Firebase Crashlytics console.
|
|
158
|
-
*
|
|
159
|
-
* It is recommended for privacy purposes that this value be a value that's meaningless to a third-party
|
|
160
|
-
* observer; such as an arbitrary string that ties an end-user to a record in your system e.g. a database record id.
|
|
161
|
-
*
|
|
162
|
-
* #### Example
|
|
163
|
-
*
|
|
164
|
-
* ```js
|
|
165
|
-
* const auth = getAuth();
|
|
166
|
-
* const crashlytics = getCrashlytics();
|
|
167
|
-
* // Custom user id
|
|
168
|
-
* await setUserId(crashlytics, '123456789');
|
|
169
|
-
* // Firebase auth uid
|
|
170
|
-
* await setUserId(
|
|
171
|
-
* crashlytics,
|
|
172
|
-
* auth.currentUser.uid
|
|
173
|
-
* );
|
|
174
|
-
* ```
|
|
175
|
-
* @param crashlytics A crashlytics instance.
|
|
176
|
-
* @param userId An arbitrary string that ties an end-user to a record in your system e.g. a database record id.
|
|
177
|
-
*/
|
|
178
|
-
export function setUserId(crashlytics: Crashlytics, userId: string): Promise<null> {
|
|
179
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is not defined in the global scope
|
|
180
|
-
return crashlytics.setUserId.call(crashlytics, userId, MODULAR_DEPRECATION_ARG);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Sets a string value to be associated with the given attribute name which will be visible in the Firebase Crashlytics console.
|
|
185
|
-
*
|
|
186
|
-
* #### Example
|
|
187
|
-
*
|
|
188
|
-
* ```js
|
|
189
|
-
* const crashlytics = getCrashlytics();
|
|
190
|
-
* await setAttribute(crashlytics, 'role', 'admin');
|
|
191
|
-
* ```
|
|
192
|
-
* @param crashlytics A crashlytics instance.
|
|
193
|
-
* @param name The name of the attribute to set.
|
|
194
|
-
* @param value A string value for the given attribute.
|
|
195
|
-
*/
|
|
196
|
-
export function setAttribute(crashlytics: Crashlytics, name: string, value: string): Promise<null> {
|
|
197
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is not defined in the global scope
|
|
198
|
-
return crashlytics.setAttribute.call(crashlytics, name, value, MODULAR_DEPRECATION_ARG);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Like `setAttribute` but for multiple attributes.
|
|
203
|
-
*
|
|
204
|
-
* #### Example
|
|
205
|
-
*
|
|
206
|
-
* ```js
|
|
207
|
-
* const crashlytics = getCrashlytics();
|
|
208
|
-
* await setAttributes(crashlytics, {
|
|
209
|
-
* role: 'admin',
|
|
210
|
-
* followers: '13',
|
|
211
|
-
* });
|
|
212
|
-
* ```
|
|
213
|
-
* @param crashlytics A crashlytics instance.
|
|
214
|
-
* @param attributes An object of key/value attribute name and values.
|
|
215
|
-
*/
|
|
216
|
-
export function setAttributes(
|
|
217
|
-
crashlytics: Crashlytics,
|
|
218
|
-
attributes: { [key: string]: string },
|
|
219
|
-
): Promise<null> {
|
|
220
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is not defined in the global scope
|
|
221
|
-
return crashlytics.setAttributes.call(crashlytics, attributes, MODULAR_DEPRECATION_ARG);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* Enable/disable Crashlytics reporting.
|
|
226
|
-
*
|
|
227
|
-
* Use this for opt-in first user data collection flows combined with `firebase.json` settings to disable auto collection.
|
|
228
|
-
*
|
|
229
|
-
* #### Example
|
|
230
|
-
*
|
|
231
|
-
* ```js
|
|
232
|
-
* const crashlytics = getCrashlytics();
|
|
233
|
-
* // Disable crash reporting
|
|
234
|
-
* await setCrashlyticsCollectionEnabled(crashlytics, false);
|
|
235
|
-
* ```
|
|
236
|
-
* @param crashlytics A crashlytics instance.
|
|
237
|
-
* @param enabled A boolean value representing whether to enable Crashlytics error collection.
|
|
238
|
-
*/
|
|
239
|
-
export function setCrashlyticsCollectionEnabled(
|
|
240
|
-
crashlytics: Crashlytics,
|
|
241
|
-
enabled: boolean,
|
|
242
|
-
): Promise<null> {
|
|
243
|
-
return crashlytics.setCrashlyticsCollectionEnabled.call(
|
|
244
|
-
crashlytics,
|
|
245
|
-
enabled,
|
|
246
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is not defined in the global scope
|
|
247
|
-
MODULAR_DEPRECATION_ARG,
|
|
248
|
-
);
|
|
249
|
-
}
|
package/lib/namespaced.ts
DELETED
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this library except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
import { getApp } from '@react-native-firebase/app';
|
|
20
|
-
import {
|
|
21
|
-
isBoolean,
|
|
22
|
-
isError,
|
|
23
|
-
isObject,
|
|
24
|
-
isString,
|
|
25
|
-
isOther,
|
|
26
|
-
MODULAR_DEPRECATION_ARG,
|
|
27
|
-
} from '@react-native-firebase/app/dist/module/common';
|
|
28
|
-
import type { ModuleConfig } from '@react-native-firebase/app/dist/module/internal';
|
|
29
|
-
import {
|
|
30
|
-
createModuleNamespace,
|
|
31
|
-
FirebaseModule,
|
|
32
|
-
getFirebaseRoot,
|
|
33
|
-
} from '@react-native-firebase/app/dist/module/internal';
|
|
34
|
-
import StackTrace from 'stacktrace-js';
|
|
35
|
-
import {
|
|
36
|
-
createNativeErrorObj,
|
|
37
|
-
setGlobalErrorHandler,
|
|
38
|
-
setOnUnhandledPromiseRejectionHandler,
|
|
39
|
-
} from './handlers';
|
|
40
|
-
import { version } from './version';
|
|
41
|
-
import type { Crashlytics, Statics } from './types/crashlytics';
|
|
42
|
-
import type { ReactNativeFirebase } from '@react-native-firebase/app';
|
|
43
|
-
|
|
44
|
-
const statics: Partial<Statics> = {};
|
|
45
|
-
|
|
46
|
-
const namespace = 'crashlytics';
|
|
47
|
-
|
|
48
|
-
const nativeModuleName = 'RNFBCrashlyticsModule';
|
|
49
|
-
|
|
50
|
-
class FirebaseCrashlyticsModule extends FirebaseModule {
|
|
51
|
-
_isCrashlyticsCollectionEnabled: boolean;
|
|
52
|
-
|
|
53
|
-
constructor(
|
|
54
|
-
app: ReactNativeFirebase.FirebaseAppBase,
|
|
55
|
-
config: ModuleConfig,
|
|
56
|
-
customUrlOrRegion?: string | null,
|
|
57
|
-
) {
|
|
58
|
-
super(app, config, customUrlOrRegion);
|
|
59
|
-
setGlobalErrorHandler(this.native);
|
|
60
|
-
setOnUnhandledPromiseRejectionHandler(this.native);
|
|
61
|
-
this._isCrashlyticsCollectionEnabled = this.native.isCrashlyticsCollectionEnabled;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
get isCrashlyticsCollectionEnabled(): boolean {
|
|
65
|
-
// Purposefully did not deprecate this as I think it should remain a property rather than a method.
|
|
66
|
-
return this._isCrashlyticsCollectionEnabled;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
checkForUnsentReports(): Promise<boolean> {
|
|
70
|
-
if (this.isCrashlyticsCollectionEnabled) {
|
|
71
|
-
throw new Error(
|
|
72
|
-
"firebase.crashlytics().setCrashlyticsCollectionEnabled(*) has been set to 'true', all reports are automatically sent.",
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
return this.native.checkForUnsentReports();
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
crash(): void {
|
|
79
|
-
this.native.crash();
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
async deleteUnsentReports(): Promise<void> {
|
|
83
|
-
await this.native.deleteUnsentReports();
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
didCrashOnPreviousExecution(): Promise<boolean> {
|
|
87
|
-
return this.native.didCrashOnPreviousExecution();
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
log(message: string): void {
|
|
91
|
-
this.native.log(`${message}`);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
setAttribute(name: string, value: string): Promise<null> {
|
|
95
|
-
if (!isString(name)) {
|
|
96
|
-
throw new Error(
|
|
97
|
-
'firebase.crashlytics().setAttribute(*, _): The supplied property name must be a string.',
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (!isString(value)) {
|
|
102
|
-
throw new Error(
|
|
103
|
-
'firebase.crashlytics().setAttribute(_, *): The supplied property value must be a string value.',
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
return this.native.setAttribute(name, value);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
setAttributes(object: { [key: string]: string }): Promise<null> {
|
|
111
|
-
if (!isObject(object)) {
|
|
112
|
-
throw new Error(
|
|
113
|
-
'firebase.crashlytics().setAttributes(*): The supplied arg must be an object of key value strings.',
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
return this.native.setAttributes(object);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
setUserId(userId: string): Promise<null> {
|
|
121
|
-
if (!isString(userId)) {
|
|
122
|
-
throw new Error(
|
|
123
|
-
'firebase.crashlytics().setUserId(*): The supplied userId must be a string value.',
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
return this.native.setUserId(userId);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
recordError(error: Error, jsErrorName?: string): void {
|
|
131
|
-
if (isError(error)) {
|
|
132
|
-
StackTrace.fromError(error, { offline: true }).then(stackFrames => {
|
|
133
|
-
this.native.recordError(createNativeErrorObj(error, stackFrames, false, jsErrorName));
|
|
134
|
-
});
|
|
135
|
-
} else {
|
|
136
|
-
console.warn(
|
|
137
|
-
'firebase.crashlytics().recordError(*) expects an instance of Error. Non Errors will be ignored.',
|
|
138
|
-
);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
sendUnsentReports(): void {
|
|
143
|
-
if (this.isCrashlyticsCollectionEnabled) {
|
|
144
|
-
this.native.sendUnsentReports();
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
setCrashlyticsCollectionEnabled(enabled: boolean): Promise<null> {
|
|
149
|
-
if (!isBoolean(enabled)) {
|
|
150
|
-
throw new Error(
|
|
151
|
-
"firebase.crashlytics().setCrashlyticsCollectionEnabled(*) 'enabled' must be a boolean.",
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
this._isCrashlyticsCollectionEnabled = enabled;
|
|
156
|
-
return this.native.setCrashlyticsCollectionEnabled(enabled);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// import { SDK_VERSION } from '@react-native-firebase/crashlytics';
|
|
161
|
-
export const SDK_VERSION = version;
|
|
162
|
-
|
|
163
|
-
const crashlyticsNamespace = createModuleNamespace({
|
|
164
|
-
statics,
|
|
165
|
-
version,
|
|
166
|
-
namespace,
|
|
167
|
-
nativeModuleName,
|
|
168
|
-
nativeEvents: false,
|
|
169
|
-
hasMultiAppSupport: false,
|
|
170
|
-
hasCustomUrlOrRegionSupport: false,
|
|
171
|
-
ModuleClass: FirebaseCrashlyticsModule,
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
type CrashlyticsNamespace = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp<
|
|
175
|
-
Crashlytics,
|
|
176
|
-
Statics
|
|
177
|
-
> & {
|
|
178
|
-
crashlytics: ReactNativeFirebase.FirebaseModuleWithStaticsAndApp<Crashlytics, Statics>;
|
|
179
|
-
firebase: ReactNativeFirebase.Module;
|
|
180
|
-
app(name?: string): ReactNativeFirebase.FirebaseApp;
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
// import crashlytics from '@react-native-firebase/crashlytics';
|
|
184
|
-
// crashlytics().X(...);
|
|
185
|
-
export default crashlyticsNamespace as unknown as CrashlyticsNamespace;
|
|
186
|
-
|
|
187
|
-
// import crashlytics, { firebase } from '@react-native-firebase/crashlytics';
|
|
188
|
-
// crashlytics().X(...);
|
|
189
|
-
// firebase.crashlytics().X(...);
|
|
190
|
-
export const firebase =
|
|
191
|
-
getFirebaseRoot() as unknown as ReactNativeFirebase.FirebaseNamespacedExport<
|
|
192
|
-
'crashlytics',
|
|
193
|
-
Crashlytics,
|
|
194
|
-
Statics,
|
|
195
|
-
false
|
|
196
|
-
>;
|
|
197
|
-
|
|
198
|
-
// Register the interop module for non-native platforms.
|
|
199
|
-
// Note: This package doesn't have a web fallback module like functions does
|
|
200
|
-
// setReactNativeModule(nativeModuleName, fallBackModule);
|
|
201
|
-
|
|
202
|
-
// This will throw with 'Default App Not initialized' if the default app is not configured.
|
|
203
|
-
if (!isOther) {
|
|
204
|
-
// @ts-ignore - Extra arg used by deprecation proxy to detect namespaced calls
|
|
205
|
-
firebase.crashlytics.call(null, getApp(), MODULAR_DEPRECATION_ARG);
|
|
206
|
-
}
|