@react-native-firebase/crashlytics 25.0.1 → 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 +20 -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
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateModuleH.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include <ReactCommon/TurboModule.h>
|
|
13
|
+
#include <react/bridging/Bridging.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
#pragma mark - NativeRNFBTurboCrashlyticsCrashlyticsStackFrame
|
|
20
|
+
|
|
21
|
+
template <typename P0, typename P1, typename P2, typename P3, typename P4>
|
|
22
|
+
struct NativeRNFBTurboCrashlyticsCrashlyticsStackFrame {
|
|
23
|
+
P0 src;
|
|
24
|
+
P1 line;
|
|
25
|
+
P2 col;
|
|
26
|
+
P3 fn;
|
|
27
|
+
P4 file;
|
|
28
|
+
bool operator==(const NativeRNFBTurboCrashlyticsCrashlyticsStackFrame &other) const {
|
|
29
|
+
return src == other.src && line == other.line && col == other.col && fn == other.fn && file == other.file;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
template <typename T>
|
|
34
|
+
struct NativeRNFBTurboCrashlyticsCrashlyticsStackFrameBridging {
|
|
35
|
+
static T types;
|
|
36
|
+
|
|
37
|
+
static T fromJs(
|
|
38
|
+
jsi::Runtime &rt,
|
|
39
|
+
const jsi::Object &value,
|
|
40
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
41
|
+
T result{
|
|
42
|
+
bridging::fromJs<decltype(types.src)>(rt, value.getProperty(rt, "src"), jsInvoker),
|
|
43
|
+
bridging::fromJs<decltype(types.line)>(rt, value.getProperty(rt, "line"), jsInvoker),
|
|
44
|
+
bridging::fromJs<decltype(types.col)>(rt, value.getProperty(rt, "col"), jsInvoker),
|
|
45
|
+
bridging::fromJs<decltype(types.fn)>(rt, value.getProperty(rt, "fn"), jsInvoker),
|
|
46
|
+
bridging::fromJs<decltype(types.file)>(rt, value.getProperty(rt, "file"), jsInvoker)};
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
#ifdef DEBUG
|
|
51
|
+
static jsi::String srcToJs(jsi::Runtime &rt, decltype(types.src) value) {
|
|
52
|
+
return bridging::toJs(rt, value);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
static double lineToJs(jsi::Runtime &rt, decltype(types.line) value) {
|
|
56
|
+
return bridging::toJs(rt, value);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
static double colToJs(jsi::Runtime &rt, decltype(types.col) value) {
|
|
60
|
+
return bridging::toJs(rt, value);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
static jsi::String fnToJs(jsi::Runtime &rt, decltype(types.fn) value) {
|
|
64
|
+
return bridging::toJs(rt, value);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
static jsi::String fileToJs(jsi::Runtime &rt, decltype(types.file) value) {
|
|
68
|
+
return bridging::toJs(rt, value);
|
|
69
|
+
}
|
|
70
|
+
#endif
|
|
71
|
+
|
|
72
|
+
static jsi::Object toJs(
|
|
73
|
+
jsi::Runtime &rt,
|
|
74
|
+
const T &value,
|
|
75
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
76
|
+
auto result = facebook::jsi::Object(rt);
|
|
77
|
+
result.setProperty(rt, "src", bridging::toJs(rt, value.src, jsInvoker));
|
|
78
|
+
result.setProperty(rt, "line", bridging::toJs(rt, value.line, jsInvoker));
|
|
79
|
+
result.setProperty(rt, "col", bridging::toJs(rt, value.col, jsInvoker));
|
|
80
|
+
result.setProperty(rt, "fn", bridging::toJs(rt, value.fn, jsInvoker));
|
|
81
|
+
result.setProperty(rt, "file", bridging::toJs(rt, value.file, jsInvoker));
|
|
82
|
+
return result;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
#pragma mark - NativeRNFBTurboCrashlyticsJavaScriptErrorObject
|
|
89
|
+
|
|
90
|
+
template <typename P0, typename P1, typename P2>
|
|
91
|
+
struct NativeRNFBTurboCrashlyticsJavaScriptErrorObject {
|
|
92
|
+
P0 message;
|
|
93
|
+
P1 isUnhandledRejection;
|
|
94
|
+
P2 frames;
|
|
95
|
+
bool operator==(const NativeRNFBTurboCrashlyticsJavaScriptErrorObject &other) const {
|
|
96
|
+
return message == other.message && isUnhandledRejection == other.isUnhandledRejection && frames == other.frames;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
template <typename T>
|
|
101
|
+
struct NativeRNFBTurboCrashlyticsJavaScriptErrorObjectBridging {
|
|
102
|
+
static T types;
|
|
103
|
+
|
|
104
|
+
static T fromJs(
|
|
105
|
+
jsi::Runtime &rt,
|
|
106
|
+
const jsi::Object &value,
|
|
107
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
108
|
+
T result{
|
|
109
|
+
bridging::fromJs<decltype(types.message)>(rt, value.getProperty(rt, "message"), jsInvoker),
|
|
110
|
+
bridging::fromJs<decltype(types.isUnhandledRejection)>(rt, value.getProperty(rt, "isUnhandledRejection"), jsInvoker),
|
|
111
|
+
bridging::fromJs<decltype(types.frames)>(rt, value.getProperty(rt, "frames"), jsInvoker)};
|
|
112
|
+
return result;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
#ifdef DEBUG
|
|
116
|
+
static jsi::String messageToJs(jsi::Runtime &rt, decltype(types.message) value) {
|
|
117
|
+
return bridging::toJs(rt, value);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
static bool isUnhandledRejectionToJs(jsi::Runtime &rt, decltype(types.isUnhandledRejection) value) {
|
|
121
|
+
return bridging::toJs(rt, value);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
static jsi::Array framesToJs(jsi::Runtime &rt, decltype(types.frames) value) {
|
|
125
|
+
return bridging::toJs(rt, value);
|
|
126
|
+
}
|
|
127
|
+
#endif
|
|
128
|
+
|
|
129
|
+
static jsi::Object toJs(
|
|
130
|
+
jsi::Runtime &rt,
|
|
131
|
+
const T &value,
|
|
132
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
133
|
+
auto result = facebook::jsi::Object(rt);
|
|
134
|
+
result.setProperty(rt, "message", bridging::toJs(rt, value.message, jsInvoker));
|
|
135
|
+
result.setProperty(rt, "isUnhandledRejection", bridging::toJs(rt, value.isUnhandledRejection, jsInvoker));
|
|
136
|
+
result.setProperty(rt, "frames", bridging::toJs(rt, value.frames, jsInvoker));
|
|
137
|
+
return result;
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
class JSI_EXPORT NativeRNFBTurboCrashlyticsCxxSpecJSI : public TurboModule {
|
|
142
|
+
protected:
|
|
143
|
+
NativeRNFBTurboCrashlyticsCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
144
|
+
|
|
145
|
+
public:
|
|
146
|
+
virtual jsi::Object getConstants(jsi::Runtime &rt) = 0;
|
|
147
|
+
virtual jsi::Value checkForUnsentReports(jsi::Runtime &rt) = 0;
|
|
148
|
+
virtual void crash(jsi::Runtime &rt) = 0;
|
|
149
|
+
virtual jsi::Value crashWithStackPromise(jsi::Runtime &rt, jsi::Object jsErrorDict) = 0;
|
|
150
|
+
virtual jsi::Value deleteUnsentReports(jsi::Runtime &rt) = 0;
|
|
151
|
+
virtual jsi::Value didCrashOnPreviousExecution(jsi::Runtime &rt) = 0;
|
|
152
|
+
virtual void log(jsi::Runtime &rt, jsi::String message) = 0;
|
|
153
|
+
virtual jsi::Value logPromise(jsi::Runtime &rt, jsi::String message) = 0;
|
|
154
|
+
virtual void sendUnsentReports(jsi::Runtime &rt) = 0;
|
|
155
|
+
virtual jsi::Value setAttribute(jsi::Runtime &rt, jsi::String key, jsi::String value) = 0;
|
|
156
|
+
virtual jsi::Value setAttributes(jsi::Runtime &rt, jsi::Object attributes) = 0;
|
|
157
|
+
virtual jsi::Value setUserId(jsi::Runtime &rt, jsi::String userId) = 0;
|
|
158
|
+
virtual void recordError(jsi::Runtime &rt, jsi::Object jsErrorDict) = 0;
|
|
159
|
+
virtual jsi::Value recordErrorPromise(jsi::Runtime &rt, jsi::Object jsErrorDict) = 0;
|
|
160
|
+
virtual jsi::Value setCrashlyticsCollectionEnabled(jsi::Runtime &rt, bool enabled) = 0;
|
|
161
|
+
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
template <typename T>
|
|
165
|
+
class JSI_EXPORT NativeRNFBTurboCrashlyticsCxxSpec : public TurboModule {
|
|
166
|
+
public:
|
|
167
|
+
jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
168
|
+
return delegate_.create(rt, propName);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
|
|
172
|
+
return delegate_.getPropertyNames(runtime);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
static constexpr std::string_view kModuleName = "NativeRNFBTurboCrashlytics";
|
|
176
|
+
|
|
177
|
+
protected:
|
|
178
|
+
NativeRNFBTurboCrashlyticsCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
179
|
+
: TurboModule(std::string{NativeRNFBTurboCrashlyticsCxxSpec::kModuleName}, jsInvoker),
|
|
180
|
+
delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
private:
|
|
184
|
+
class Delegate : public NativeRNFBTurboCrashlyticsCxxSpecJSI {
|
|
185
|
+
public:
|
|
186
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
187
|
+
NativeRNFBTurboCrashlyticsCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
|
|
188
|
+
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
jsi::Object getConstants(jsi::Runtime &rt) override {
|
|
192
|
+
static_assert(
|
|
193
|
+
bridging::getParameterCount(&T::getConstants) == 1,
|
|
194
|
+
"Expected getConstants(...) to have 1 parameters");
|
|
195
|
+
|
|
196
|
+
return bridging::callFromJs<jsi::Object>(
|
|
197
|
+
rt, &T::getConstants, jsInvoker_, instance_);
|
|
198
|
+
}
|
|
199
|
+
jsi::Value checkForUnsentReports(jsi::Runtime &rt) override {
|
|
200
|
+
static_assert(
|
|
201
|
+
bridging::getParameterCount(&T::checkForUnsentReports) == 1,
|
|
202
|
+
"Expected checkForUnsentReports(...) to have 1 parameters");
|
|
203
|
+
|
|
204
|
+
return bridging::callFromJs<jsi::Value>(
|
|
205
|
+
rt, &T::checkForUnsentReports, jsInvoker_, instance_);
|
|
206
|
+
}
|
|
207
|
+
void crash(jsi::Runtime &rt) override {
|
|
208
|
+
static_assert(
|
|
209
|
+
bridging::getParameterCount(&T::crash) == 1,
|
|
210
|
+
"Expected crash(...) to have 1 parameters");
|
|
211
|
+
|
|
212
|
+
return bridging::callFromJs<void>(
|
|
213
|
+
rt, &T::crash, jsInvoker_, instance_);
|
|
214
|
+
}
|
|
215
|
+
jsi::Value crashWithStackPromise(jsi::Runtime &rt, jsi::Object jsErrorDict) override {
|
|
216
|
+
static_assert(
|
|
217
|
+
bridging::getParameterCount(&T::crashWithStackPromise) == 2,
|
|
218
|
+
"Expected crashWithStackPromise(...) to have 2 parameters");
|
|
219
|
+
|
|
220
|
+
return bridging::callFromJs<jsi::Value>(
|
|
221
|
+
rt, &T::crashWithStackPromise, jsInvoker_, instance_, std::move(jsErrorDict));
|
|
222
|
+
}
|
|
223
|
+
jsi::Value deleteUnsentReports(jsi::Runtime &rt) override {
|
|
224
|
+
static_assert(
|
|
225
|
+
bridging::getParameterCount(&T::deleteUnsentReports) == 1,
|
|
226
|
+
"Expected deleteUnsentReports(...) to have 1 parameters");
|
|
227
|
+
|
|
228
|
+
return bridging::callFromJs<jsi::Value>(
|
|
229
|
+
rt, &T::deleteUnsentReports, jsInvoker_, instance_);
|
|
230
|
+
}
|
|
231
|
+
jsi::Value didCrashOnPreviousExecution(jsi::Runtime &rt) override {
|
|
232
|
+
static_assert(
|
|
233
|
+
bridging::getParameterCount(&T::didCrashOnPreviousExecution) == 1,
|
|
234
|
+
"Expected didCrashOnPreviousExecution(...) to have 1 parameters");
|
|
235
|
+
|
|
236
|
+
return bridging::callFromJs<jsi::Value>(
|
|
237
|
+
rt, &T::didCrashOnPreviousExecution, jsInvoker_, instance_);
|
|
238
|
+
}
|
|
239
|
+
void log(jsi::Runtime &rt, jsi::String message) override {
|
|
240
|
+
static_assert(
|
|
241
|
+
bridging::getParameterCount(&T::log) == 2,
|
|
242
|
+
"Expected log(...) to have 2 parameters");
|
|
243
|
+
|
|
244
|
+
return bridging::callFromJs<void>(
|
|
245
|
+
rt, &T::log, jsInvoker_, instance_, std::move(message));
|
|
246
|
+
}
|
|
247
|
+
jsi::Value logPromise(jsi::Runtime &rt, jsi::String message) override {
|
|
248
|
+
static_assert(
|
|
249
|
+
bridging::getParameterCount(&T::logPromise) == 2,
|
|
250
|
+
"Expected logPromise(...) to have 2 parameters");
|
|
251
|
+
|
|
252
|
+
return bridging::callFromJs<jsi::Value>(
|
|
253
|
+
rt, &T::logPromise, jsInvoker_, instance_, std::move(message));
|
|
254
|
+
}
|
|
255
|
+
void sendUnsentReports(jsi::Runtime &rt) override {
|
|
256
|
+
static_assert(
|
|
257
|
+
bridging::getParameterCount(&T::sendUnsentReports) == 1,
|
|
258
|
+
"Expected sendUnsentReports(...) to have 1 parameters");
|
|
259
|
+
|
|
260
|
+
return bridging::callFromJs<void>(
|
|
261
|
+
rt, &T::sendUnsentReports, jsInvoker_, instance_);
|
|
262
|
+
}
|
|
263
|
+
jsi::Value setAttribute(jsi::Runtime &rt, jsi::String key, jsi::String value) override {
|
|
264
|
+
static_assert(
|
|
265
|
+
bridging::getParameterCount(&T::setAttribute) == 3,
|
|
266
|
+
"Expected setAttribute(...) to have 3 parameters");
|
|
267
|
+
|
|
268
|
+
return bridging::callFromJs<jsi::Value>(
|
|
269
|
+
rt, &T::setAttribute, jsInvoker_, instance_, std::move(key), std::move(value));
|
|
270
|
+
}
|
|
271
|
+
jsi::Value setAttributes(jsi::Runtime &rt, jsi::Object attributes) override {
|
|
272
|
+
static_assert(
|
|
273
|
+
bridging::getParameterCount(&T::setAttributes) == 2,
|
|
274
|
+
"Expected setAttributes(...) to have 2 parameters");
|
|
275
|
+
|
|
276
|
+
return bridging::callFromJs<jsi::Value>(
|
|
277
|
+
rt, &T::setAttributes, jsInvoker_, instance_, std::move(attributes));
|
|
278
|
+
}
|
|
279
|
+
jsi::Value setUserId(jsi::Runtime &rt, jsi::String userId) override {
|
|
280
|
+
static_assert(
|
|
281
|
+
bridging::getParameterCount(&T::setUserId) == 2,
|
|
282
|
+
"Expected setUserId(...) to have 2 parameters");
|
|
283
|
+
|
|
284
|
+
return bridging::callFromJs<jsi::Value>(
|
|
285
|
+
rt, &T::setUserId, jsInvoker_, instance_, std::move(userId));
|
|
286
|
+
}
|
|
287
|
+
void recordError(jsi::Runtime &rt, jsi::Object jsErrorDict) override {
|
|
288
|
+
static_assert(
|
|
289
|
+
bridging::getParameterCount(&T::recordError) == 2,
|
|
290
|
+
"Expected recordError(...) to have 2 parameters");
|
|
291
|
+
|
|
292
|
+
return bridging::callFromJs<void>(
|
|
293
|
+
rt, &T::recordError, jsInvoker_, instance_, std::move(jsErrorDict));
|
|
294
|
+
}
|
|
295
|
+
jsi::Value recordErrorPromise(jsi::Runtime &rt, jsi::Object jsErrorDict) override {
|
|
296
|
+
static_assert(
|
|
297
|
+
bridging::getParameterCount(&T::recordErrorPromise) == 2,
|
|
298
|
+
"Expected recordErrorPromise(...) to have 2 parameters");
|
|
299
|
+
|
|
300
|
+
return bridging::callFromJs<jsi::Value>(
|
|
301
|
+
rt, &T::recordErrorPromise, jsInvoker_, instance_, std::move(jsErrorDict));
|
|
302
|
+
}
|
|
303
|
+
jsi::Value setCrashlyticsCollectionEnabled(jsi::Runtime &rt, bool enabled) override {
|
|
304
|
+
static_assert(
|
|
305
|
+
bridging::getParameterCount(&T::setCrashlyticsCollectionEnabled) == 2,
|
|
306
|
+
"Expected setCrashlyticsCollectionEnabled(...) to have 2 parameters");
|
|
307
|
+
|
|
308
|
+
return bridging::callFromJs<jsi::Value>(
|
|
309
|
+
rt, &T::setCrashlyticsCollectionEnabled, jsInvoker_, instance_, std::move(enabled));
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
private:
|
|
313
|
+
friend class NativeRNFBTurboCrashlyticsCxxSpec;
|
|
314
|
+
T *instance_;
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
Delegate delegate_;
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
#
|
|
3
|
+
# This source code is licensed under the MIT license found in the
|
|
4
|
+
# LICENSE file in the root directory of this source tree.
|
|
5
|
+
|
|
6
|
+
version = "0.78.3"
|
|
7
|
+
source = { :git => 'https://github.com/facebook/react-native.git' }
|
|
8
|
+
if version == '1000.0.0'
|
|
9
|
+
# This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
|
|
10
|
+
source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
|
|
11
|
+
else
|
|
12
|
+
source[:tag] = "v#{version}"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
Pod::Spec.new do |s|
|
|
16
|
+
s.name = "ReactAppDependencyProvider"
|
|
17
|
+
s.version = version
|
|
18
|
+
s.summary = "The third party dependency provider for the app"
|
|
19
|
+
s.homepage = "https://reactnative.dev/"
|
|
20
|
+
s.documentation_url = "https://reactnative.dev/"
|
|
21
|
+
s.license = "MIT"
|
|
22
|
+
s.author = "Meta Platforms, Inc. and its affiliates"
|
|
23
|
+
s.platforms = min_supported_versions
|
|
24
|
+
s.source = source
|
|
25
|
+
s.source_files = "**/RCTAppDependencyProvider.{h,mm}"
|
|
26
|
+
|
|
27
|
+
# This guard prevent to install the dependencies when we run `pod install` in the old architecture.
|
|
28
|
+
s.pod_target_xcconfig = {
|
|
29
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(),
|
|
30
|
+
"DEFINES_MODULE" => "YES"
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
s.dependency "ReactCodegen"
|
|
34
|
+
end
|
package/lib/handlers.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
import {
|
|
18
|
+
import { getApp } from '@react-native-firebase/app';
|
|
19
19
|
import { isError, once } from '@react-native-firebase/app/dist/module/common';
|
|
20
20
|
// @ts-ignore - No declaration file for promise/setimmediate/rejection-tracking
|
|
21
21
|
import tracking from 'promise/setimmediate/rejection-tracking';
|
|
@@ -125,35 +125,16 @@ export const setGlobalErrorHandler = once((nativeModule: NativeModule) => {
|
|
|
125
125
|
// Flag the Crashlytics backend that we have a fatal error, they will transform it
|
|
126
126
|
await nativeModule.setAttribute(FATAL_FLAG, fatalTime);
|
|
127
127
|
|
|
128
|
-
// remember our current deprecation warning state in case users
|
|
129
|
-
// have set it to non-default
|
|
130
|
-
const currentDeprecationWarningToggle =
|
|
131
|
-
globalThis.RNFB_SILENCE_MODULAR_DEPRECATION_WARNINGS;
|
|
132
|
-
|
|
133
|
-
// Notify analytics, if it exists - throws error if not
|
|
134
128
|
try {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
globalThis.RNFB_SILENCE_MODULAR_DEPRECATION_WARNINGS = true;
|
|
141
|
-
// @ts-ignore - analytics types not available in crashlytics
|
|
142
|
-
await firebase.app().analytics().logEvent(
|
|
143
|
-
'app_exception', // 'app_exception' is reserved but we make an exception for JS->fatal transforms
|
|
144
|
-
{
|
|
145
|
-
fatal: 1, // as in firebase-android-sdk
|
|
146
|
-
timestamp: fatalTime,
|
|
147
|
-
},
|
|
148
|
-
);
|
|
129
|
+
const { getAnalytics, logEvent } = require('@react-native-firebase/analytics');
|
|
130
|
+
await logEvent(getAnalytics(getApp()), 'app_exception', {
|
|
131
|
+
fatal: 1,
|
|
132
|
+
timestamp: fatalTime,
|
|
133
|
+
});
|
|
149
134
|
} catch (_) {
|
|
150
|
-
//
|
|
151
|
-
// console.log('error logging analytics app_exception: ' + e);
|
|
152
|
-
} finally {
|
|
153
|
-
globalThis.RNFB_SILENCE_MODULAR_DEPRECATION_WARNINGS = currentDeprecationWarningToggle;
|
|
135
|
+
// analytics not present
|
|
154
136
|
}
|
|
155
137
|
|
|
156
|
-
// If we are chaining to other handlers, just record the error, otherwise we need to crash with it
|
|
157
138
|
if (nativeModule.isCrashlyticsJavascriptExceptionHandlerChainingEnabled) {
|
|
158
139
|
await nativeModule.recordErrorPromise(createNativeErrorObj(error, stackFrames, false));
|
|
159
140
|
} else {
|
package/lib/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
1
2
|
/*
|
|
2
3
|
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
4
|
*
|
|
@@ -15,12 +16,213 @@
|
|
|
15
16
|
*
|
|
16
17
|
*/
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
import type { FirebaseApp } from '@react-native-firebase/app';
|
|
20
|
+
import {
|
|
21
|
+
isBoolean,
|
|
22
|
+
isError,
|
|
23
|
+
isObject,
|
|
24
|
+
isString,
|
|
25
|
+
} from '@react-native-firebase/app/dist/module/common';
|
|
26
|
+
import {
|
|
27
|
+
FirebaseModule,
|
|
28
|
+
getOrCreateModularInstance,
|
|
29
|
+
} from '@react-native-firebase/app/dist/module/internal';
|
|
30
|
+
import type { ModuleConfig } from '@react-native-firebase/app/dist/module/internal';
|
|
31
|
+
import './types/internal';
|
|
32
|
+
import StackTrace from 'stacktrace-js';
|
|
33
|
+
import {
|
|
34
|
+
createNativeErrorObj,
|
|
35
|
+
setGlobalErrorHandler,
|
|
36
|
+
setOnUnhandledPromiseRejectionHandler,
|
|
37
|
+
} from './handlers';
|
|
38
|
+
import { version } from './version';
|
|
39
|
+
import type { Crashlytics } from './types/crashlytics';
|
|
40
|
+
import type { CrashlyticsInternal } from './types/internal';
|
|
41
|
+
import type { ReactNativeFirebase } from '@react-native-firebase/app';
|
|
20
42
|
|
|
21
|
-
|
|
22
|
-
export * from './modular';
|
|
43
|
+
const nativeModuleName = 'NativeRNFBTurboCrashlytics';
|
|
23
44
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
45
|
+
class FirebaseCrashlyticsModule extends FirebaseModule {
|
|
46
|
+
_isCrashlyticsCollectionEnabled: boolean;
|
|
47
|
+
|
|
48
|
+
constructor(
|
|
49
|
+
app: ReactNativeFirebase.FirebaseAppBase,
|
|
50
|
+
config: ModuleConfig,
|
|
51
|
+
customUrlOrRegion?: string | null,
|
|
52
|
+
) {
|
|
53
|
+
super(app, config, customUrlOrRegion);
|
|
54
|
+
setGlobalErrorHandler(this.native);
|
|
55
|
+
setOnUnhandledPromiseRejectionHandler(this.native);
|
|
56
|
+
this._isCrashlyticsCollectionEnabled = this.native.isCrashlyticsCollectionEnabled;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
get isCrashlyticsCollectionEnabled(): boolean {
|
|
60
|
+
// Purposefully did not deprecate this as I think it should remain a property rather than a method.
|
|
61
|
+
return this._isCrashlyticsCollectionEnabled;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
checkForUnsentReports(): Promise<boolean> {
|
|
65
|
+
if (this.isCrashlyticsCollectionEnabled) {
|
|
66
|
+
throw new Error(
|
|
67
|
+
"firebase.crashlytics().setCrashlyticsCollectionEnabled(*) has been set to 'true', all reports are automatically sent.",
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
return this.native.checkForUnsentReports();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
crash(): void {
|
|
74
|
+
this.native.crash();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
async deleteUnsentReports(): Promise<void> {
|
|
78
|
+
await this.native.deleteUnsentReports();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
didCrashOnPreviousExecution(): Promise<boolean> {
|
|
82
|
+
return this.native.didCrashOnPreviousExecution();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
log(message: string): void {
|
|
86
|
+
this.native.log(`${message}`);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
setAttribute(name: string, value: string): Promise<null> {
|
|
90
|
+
if (!isString(name)) {
|
|
91
|
+
throw new Error(
|
|
92
|
+
'firebase.crashlytics().setAttribute(*, _): The supplied property name must be a string.',
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (!isString(value)) {
|
|
97
|
+
throw new Error(
|
|
98
|
+
'firebase.crashlytics().setAttribute(_, *): The supplied property value must be a string value.',
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return this.native.setAttribute(name, value);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
setAttributes(object: { [key: string]: string }): Promise<null> {
|
|
106
|
+
if (!isObject(object)) {
|
|
107
|
+
throw new Error(
|
|
108
|
+
'firebase.crashlytics().setAttributes(*): The supplied arg must be an object of key value strings.',
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return this.native.setAttributes(object);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
setUserId(userId: string): Promise<null> {
|
|
116
|
+
if (!isString(userId)) {
|
|
117
|
+
throw new Error(
|
|
118
|
+
'firebase.crashlytics().setUserId(*): The supplied userId must be a string value.',
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return this.native.setUserId(userId);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
recordError(error: Error, jsErrorName?: string): void {
|
|
126
|
+
if (isError(error)) {
|
|
127
|
+
StackTrace.fromError(error, { offline: true })
|
|
128
|
+
.then(stackFrames =>
|
|
129
|
+
this.native.recordErrorPromise(
|
|
130
|
+
createNativeErrorObj(error, stackFrames, false, jsErrorName),
|
|
131
|
+
),
|
|
132
|
+
)
|
|
133
|
+
.catch(() => {});
|
|
134
|
+
} else {
|
|
135
|
+
console.warn(
|
|
136
|
+
'firebase.crashlytics().recordError(*) expects an instance of Error. Non Errors will be ignored.',
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
sendUnsentReports(): void {
|
|
142
|
+
if (this.isCrashlyticsCollectionEnabled) {
|
|
143
|
+
this.native.sendUnsentReports();
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
setCrashlyticsCollectionEnabled(enabled: boolean): Promise<null> {
|
|
148
|
+
if (!isBoolean(enabled)) {
|
|
149
|
+
throw new Error(
|
|
150
|
+
"firebase.crashlytics().setCrashlyticsCollectionEnabled(*) 'enabled' must be a boolean.",
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
this._isCrashlyticsCollectionEnabled = enabled;
|
|
155
|
+
return this.native.setCrashlyticsCollectionEnabled(enabled);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const config: ModuleConfig = {
|
|
160
|
+
namespace: 'crashlytics',
|
|
161
|
+
nativeModuleName,
|
|
162
|
+
nativeEvents: false,
|
|
163
|
+
hasMultiAppSupport: false,
|
|
164
|
+
hasCustomUrlOrRegionSupport: false,
|
|
165
|
+
turboModule: true,
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
export const SDK_VERSION = version;
|
|
169
|
+
|
|
170
|
+
export function getCrashlytics(app?: FirebaseApp): Crashlytics {
|
|
171
|
+
return getOrCreateModularInstance(
|
|
172
|
+
FirebaseCrashlyticsModule,
|
|
173
|
+
config,
|
|
174
|
+
app,
|
|
175
|
+
) as unknown as Crashlytics;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export function checkForUnsentReports(crashlytics: Crashlytics): Promise<boolean> {
|
|
179
|
+
return (crashlytics as CrashlyticsInternal).checkForUnsentReports();
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export function deleteUnsentReports(crashlytics: Crashlytics): Promise<void> {
|
|
183
|
+
return (crashlytics as CrashlyticsInternal).deleteUnsentReports();
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export function didCrashOnPreviousExecution(crashlytics: Crashlytics): Promise<boolean> {
|
|
187
|
+
return (crashlytics as CrashlyticsInternal).didCrashOnPreviousExecution();
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export function crash(crashlytics: Crashlytics): void {
|
|
191
|
+
return (crashlytics as CrashlyticsInternal).crash();
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export function log(crashlytics: Crashlytics, message: string): void {
|
|
195
|
+
return (crashlytics as CrashlyticsInternal).log(message);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export function recordError(crashlytics: Crashlytics, error: Error, jsErrorName?: string): void {
|
|
199
|
+
return (crashlytics as CrashlyticsInternal).recordError(error, jsErrorName);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export function sendUnsentReports(crashlytics: Crashlytics): void {
|
|
203
|
+
return (crashlytics as CrashlyticsInternal).sendUnsentReports();
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export function setUserId(crashlytics: Crashlytics, userId: string): Promise<null> {
|
|
207
|
+
return (crashlytics as CrashlyticsInternal).setUserId(userId);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export function setAttribute(crashlytics: Crashlytics, name: string, value: string): Promise<null> {
|
|
211
|
+
return (crashlytics as CrashlyticsInternal).setAttribute(name, value);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export function setAttributes(
|
|
215
|
+
crashlytics: Crashlytics,
|
|
216
|
+
attributes: { [key: string]: string },
|
|
217
|
+
): Promise<null> {
|
|
218
|
+
return (crashlytics as CrashlyticsInternal).setAttributes(attributes);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export function setCrashlyticsCollectionEnabled(
|
|
222
|
+
crashlytics: Crashlytics,
|
|
223
|
+
enabled: boolean,
|
|
224
|
+
): Promise<null> {
|
|
225
|
+
return (crashlytics as CrashlyticsInternal).setCrashlyticsCollectionEnabled(enabled);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export type { Crashlytics } from './types/crashlytics';
|
package/lib/types/crashlytics.ts
CHANGED
|
@@ -125,35 +125,5 @@ export interface Statics {
|
|
|
125
125
|
/**
|
|
126
126
|
* FirebaseApp type with crashlytics() method.
|
|
127
127
|
* @deprecated Import FirebaseApp from '@react-native-firebase/app' instead.
|
|
128
|
-
* The crashlytics() method is added via module augmentation.
|
|
129
128
|
*/
|
|
130
129
|
export type FirebaseApp = ReactNativeFirebase.FirebaseApp;
|
|
131
|
-
|
|
132
|
-
// ============ Module Augmentation ============
|
|
133
|
-
|
|
134
|
-
/* eslint-disable @typescript-eslint/no-namespace */
|
|
135
|
-
declare module '@react-native-firebase/app' {
|
|
136
|
-
namespace ReactNativeFirebase {
|
|
137
|
-
interface Module {
|
|
138
|
-
crashlytics: FirebaseModuleWithStaticsAndApp<Crashlytics, Statics>;
|
|
139
|
-
}
|
|
140
|
-
interface FirebaseApp {
|
|
141
|
-
crashlytics(): Crashlytics;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
/* eslint-enable @typescript-eslint/no-namespace */
|
|
146
|
-
// ============ Backwards Compatibility Namespace - to be removed with namespaced exports ============
|
|
147
|
-
type _Statics = Statics;
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* @deprecated Use the exported types directly instead.
|
|
151
|
-
* FirebaseCrashlyticsTypes namespace is kept for backwards compatibility.
|
|
152
|
-
*/
|
|
153
|
-
/* eslint-disable @typescript-eslint/no-namespace */
|
|
154
|
-
export namespace FirebaseCrashlyticsTypes {
|
|
155
|
-
// Short name aliases referencing top-level types
|
|
156
|
-
export type Module = Crashlytics;
|
|
157
|
-
export type Statics = _Statics;
|
|
158
|
-
}
|
|
159
|
-
/* eslint-enable @typescript-eslint/no-namespace */
|