diff --git a/android/src/main/java/io/invertase/firebase/crash/RNFirebaseCrash.java b/android/src/main/java/io/invertase/firebase/crash/RNFirebaseCrash.java deleted file mode 100644 index bcd8bbc6..00000000 --- a/android/src/main/java/io/invertase/firebase/crash/RNFirebaseCrash.java +++ /dev/null @@ -1,52 +0,0 @@ -package io.invertase.firebase.crash; - -import android.util.Log; - -import com.facebook.react.bridge.Promise; -import com.facebook.react.bridge.ReactMethod; -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.bridge.ReactContextBaseJavaModule; - -import com.google.firebase.crash.FirebaseCrash; - - -public class RNFirebaseCrash extends ReactContextBaseJavaModule { - - private static final String TAG = "RNFirebaseCrash"; - - public RNFirebaseCrash(ReactApplicationContext reactContext) { - super(reactContext); - Log.d(TAG, "New instance"); - } - - @Override - public String getName() { - return TAG; - } - - @ReactMethod - public void log(final String message) { - FirebaseCrash.log(message); - } - - @ReactMethod - public void logcat(final int level, final String tag, final String message) { - FirebaseCrash.logcat(level, tag, message); - } - - @ReactMethod - public void report(String message) { - FirebaseCrash.report(new Exception(message)); - } - - @ReactMethod - public void setCrashCollectionEnabled(Boolean enabled) { - FirebaseCrash.setCrashCollectionEnabled(enabled); - } - - @ReactMethod - public void isCrashCollectionEnabled(Promise promise) { - Boolean isEnabled = FirebaseCrash.isCrashCollectionEnabled(); - promise.resolve(isEnabled); - } -} diff --git a/android/src/main/java/io/invertase/firebase/crash/RNFirebaseCrashPackage.java b/android/src/main/java/io/invertase/firebase/crash/RNFirebaseCrashPackage.java deleted file mode 100644 index 4ab83e78..00000000 --- a/android/src/main/java/io/invertase/firebase/crash/RNFirebaseCrashPackage.java +++ /dev/null @@ -1,39 +0,0 @@ -package io.invertase.firebase.crash; - -import com.facebook.react.ReactPackage; -import com.facebook.react.bridge.JavaScriptModule; -import com.facebook.react.bridge.NativeModule; -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.uimanager.UIManagerModule; -import com.facebook.react.uimanager.ViewManager; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -@SuppressWarnings("unused") -public class RNFirebaseCrashPackage implements ReactPackage { - public RNFirebaseCrashPackage() { - } - - /** - * @param reactContext react application context that can be used to create modules - * @return list of native modules to register with the newly created catalyst instance - */ - @Override - public List createNativeModules(ReactApplicationContext reactContext) { - List modules = new ArrayList<>(); - modules.add(new RNFirebaseCrash(reactContext)); - - return modules; - } - - /** - * @param reactContext - * @return a list of view managers that should be registered with {@link UIManagerModule} - */ - @Override - public List createViewManagers(ReactApplicationContext reactContext) { - return Collections.emptyList(); - } -} diff --git a/bridge/android/app/build.gradle b/bridge/android/app/build.gradle index 367ed07b..49fa2a45 100755 --- a/bridge/android/app/build.gradle +++ b/bridge/android/app/build.gradle @@ -99,7 +99,6 @@ dependencies { implementation "com.google.firebase:firebase-ads:15.0.1" implementation "com.google.firebase:firebase-auth:16.0.2" implementation "com.google.firebase:firebase-config:16.0.0" - implementation "com.google.firebase:firebase-crash:16.0.1" implementation "com.google.firebase:firebase-database:16.0.1" implementation "com.google.firebase:firebase-firestore:17.0.2" implementation "com.google.firebase:firebase-functions:16.0.1" diff --git a/bridge/e2e/crash/crash.e2e.js b/bridge/e2e/crash/crash.e2e.js deleted file mode 100644 index 498c3af0..00000000 --- a/bridge/e2e/crash/crash.e2e.js +++ /dev/null @@ -1,52 +0,0 @@ -describe('crash()', () => { - describe('setCrashCollectionEnabled()', () => { - it('true', async () => { - await firebase.crash().setCrashCollectionEnabled(true); - await sleep(100); - const enabled = await firebase.crash().isCrashCollectionEnabled(); - should.equal(enabled, true, 'collection enabled boolean should be true'); - }); - - it('false', async () => { - await firebase.crash().setCrashCollectionEnabled(false); - - // does not exist on ios - if (device.getPlatform() === 'android') { - await sleep(150); - const enabled = await firebase.crash().isCrashCollectionEnabled(); - should.equal( - enabled, - false, - 'collection enabled boolean should be false' - ); - } - }); - }); - - describe('log()', () => { - it('accepts a string log', async () => { - await firebase.crash().log('hello world'); - await sleep(50); - }); - }); - - describe('logcat()', () => { - it('accepts a log level, log tag and message', async () => { - await firebase.crash().logcat(0, 'HELLO_TAG', 'hello world'); - await sleep(50); - }); - }); - - describe('report()', () => { - it('accepts an error with customisable stack size', async () => { - const error = new Error('Oh noes!'); - await firebase.crash().report(error); - await firebase.crash().report(error, 5); - error.code = 'NETWORK_ERROR'; - await firebase.crash().report(error); - delete error.message; - await firebase.crash().report(error); - await sleep(50); - }); - }); -}); diff --git a/bridge/ios/Podfile b/bridge/ios/Podfile index 5bd2f566..054d740a 100644 --- a/bridge/ios/Podfile +++ b/bridge/ios/Podfile @@ -21,7 +21,6 @@ target 'testing' do pod 'Firebase/AdMob', '~> 5.3.0' pod 'Firebase/Auth', '~> 5.3.0' pod 'Firebase/Core', '~> 5.3.0' - pod 'Firebase/Crash', '~> 5.3.0' pod 'Firebase/Database', '~> 5.3.0' pod 'Firebase/Functions', '~> 5.3.0' pod 'Firebase/DynamicLinks', '~> 5.3.0' diff --git a/bridge/ios/Podfile.lock b/bridge/ios/Podfile.lock index 4e947e5f..0fde1565 100644 --- a/bridge/ios/Podfile.lock +++ b/bridge/ios/Podfile.lock @@ -212,7 +212,7 @@ PODS: - React/Core - React/fishhook - React/RCTBlob - - RNFirebase (4.2.0): + - RNFirebase (4.3.8): - Firebase/Core - React - yoga (0.55.3.React) diff --git a/ios/RNFirebase.xcodeproj/project.pbxproj b/ios/RNFirebase.xcodeproj/project.pbxproj index 88370b00..9212415b 100644 --- a/ios/RNFirebase.xcodeproj/project.pbxproj +++ b/ios/RNFirebase.xcodeproj/project.pbxproj @@ -27,7 +27,6 @@ 839D916F1EF3E20B0077C7C8 /* RNFirebaseAnalytics.m in Sources */ = {isa = PBXBuildFile; fileRef = 839D91561EF3E20A0077C7C8 /* RNFirebaseAnalytics.m */; }; 839D91701EF3E20B0077C7C8 /* RNFirebaseAuth.m in Sources */ = {isa = PBXBuildFile; fileRef = 839D91591EF3E20A0077C7C8 /* RNFirebaseAuth.m */; }; 839D91711EF3E20B0077C7C8 /* RNFirebaseRemoteConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 839D915C1EF3E20A0077C7C8 /* RNFirebaseRemoteConfig.m */; }; - 839D91721EF3E20B0077C7C8 /* RNFirebaseCrash.m in Sources */ = {isa = PBXBuildFile; fileRef = 839D915F1EF3E20A0077C7C8 /* RNFirebaseCrash.m */; }; 839D91731EF3E20B0077C7C8 /* RNFirebaseDatabase.m in Sources */ = {isa = PBXBuildFile; fileRef = 839D91621EF3E20A0077C7C8 /* RNFirebaseDatabase.m */; }; 839D91751EF3E20B0077C7C8 /* RNFirebasePerformance.m in Sources */ = {isa = PBXBuildFile; fileRef = 839D91681EF3E20A0077C7C8 /* RNFirebasePerformance.m */; }; 83AAA0792063DEC2007EC5F7 /* RNFirebaseInvites.m in Sources */ = {isa = PBXBuildFile; fileRef = 83AAA0772063DEC2007EC5F7 /* RNFirebaseInvites.m */; }; @@ -90,8 +89,6 @@ 839D91591EF3E20A0077C7C8 /* RNFirebaseAuth.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNFirebaseAuth.m; sourceTree = ""; }; 839D915B1EF3E20A0077C7C8 /* RNFirebaseRemoteConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNFirebaseRemoteConfig.h; sourceTree = ""; }; 839D915C1EF3E20A0077C7C8 /* RNFirebaseRemoteConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNFirebaseRemoteConfig.m; sourceTree = ""; }; - 839D915E1EF3E20A0077C7C8 /* RNFirebaseCrash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNFirebaseCrash.h; sourceTree = ""; }; - 839D915F1EF3E20A0077C7C8 /* RNFirebaseCrash.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNFirebaseCrash.m; sourceTree = ""; }; 839D91611EF3E20A0077C7C8 /* RNFirebaseDatabase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNFirebaseDatabase.h; sourceTree = ""; }; 839D91621EF3E20A0077C7C8 /* RNFirebaseDatabase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNFirebaseDatabase.m; sourceTree = ""; }; 839D91671EF3E20A0077C7C8 /* RNFirebasePerformance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNFirebasePerformance.h; sourceTree = ""; }; @@ -160,7 +157,6 @@ 839D91541EF3E20A0077C7C8 /* analytics */, 839D91571EF3E20A0077C7C8 /* auth */, 839D915A1EF3E20A0077C7C8 /* config */, - 839D915D1EF3E20A0077C7C8 /* crash */, 839D91601EF3E20A0077C7C8 /* database */, 8376F70D1F7C141500D45A85 /* firestore */, 839D91631EF3E20A0077C7C8 /* messaging */, @@ -277,16 +273,6 @@ path = RNFirebase/config; sourceTree = ""; }; - 839D915D1EF3E20A0077C7C8 /* crash */ = { - isa = PBXGroup; - children = ( - 839D915E1EF3E20A0077C7C8 /* RNFirebaseCrash.h */, - 839D915F1EF3E20A0077C7C8 /* RNFirebaseCrash.m */, - ); - name = crash; - path = RNFirebase/crash; - sourceTree = ""; - }; 839D91601EF3E20A0077C7C8 /* database */ = { isa = PBXGroup; children = ( @@ -416,7 +402,6 @@ 83AAA0792063DEC2007EC5F7 /* RNFirebaseInvites.m in Sources */, 8323CF071F6FBD870071420B /* NativeExpressComponent.m in Sources */, 83C3EEEE1FA1EACC00B64D3C /* RNFirebaseUtil.m in Sources */, - 839D91721EF3E20B0077C7C8 /* RNFirebaseCrash.m in Sources */, 839D91751EF3E20B0077C7C8 /* RNFirebasePerformance.m in Sources */, 8323CF061F6FBD870071420B /* BannerComponent.m in Sources */, 839D916D1EF3E20B0077C7C8 /* RNFirebaseAdMobInterstitial.m in Sources */, @@ -520,7 +505,6 @@ "$(SRCROOT)/../../../ios/Pods/FirebaseAnalytics/Frameworks", "$(SRCROOT)/../../../ios/Pods/FirebaseAuth/Frameworks", "$(SRCROOT)/../../../ios/Pods/FirebaseCore/Frameworks", - "$(SRCROOT)/../../../ios/Pods/FirebaseCrash/Frameworks", "$(SRCROOT)/../../../ios/Pods/FirebaseDatabase/Frameworks", "$(SRCROOT)/../../../ios/Pods/FirebaseDynamicLinks/Frameworks", "$(SRCROOT)/../../../ios/Pods/FirebaseFirestore/Frameworks", @@ -564,7 +548,6 @@ "$(SRCROOT)/../../../ios/Pods/FirebaseAnalytics/Frameworks", "$(SRCROOT)/../../../ios/Pods/FirebaseAuth/Frameworks", "$(SRCROOT)/../../../ios/Pods/FirebaseCore/Frameworks", - "$(SRCROOT)/../../../ios/Pods/FirebaseCrash/Frameworks", "$(SRCROOT)/../../../ios/Pods/FirebaseDatabase/Frameworks", "$(SRCROOT)/../../../ios/Pods/FirebaseDynamicLinks/Frameworks", "$(SRCROOT)/../../../ios/Pods/FirebaseFirestore/Frameworks", diff --git a/ios/RNFirebase/crash/RNFirebaseCrash.h b/ios/RNFirebase/crash/RNFirebaseCrash.h deleted file mode 100644 index 4b2058a1..00000000 --- a/ios/RNFirebase/crash/RNFirebaseCrash.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef RNFirebaseCrash_h -#define RNFirebaseCrash_h -#import - -#if __has_include() -#import - -@interface RNFirebaseCrash : NSObject { - -} - -@end - -#else -@interface RNFirebaseCrash : NSObject -@end -#endif - -#endif diff --git a/ios/RNFirebase/crash/RNFirebaseCrash.m b/ios/RNFirebase/crash/RNFirebaseCrash.m deleted file mode 100644 index fa7de2fa..00000000 --- a/ios/RNFirebase/crash/RNFirebaseCrash.m +++ /dev/null @@ -1,35 +0,0 @@ -#import "RNFirebaseCrash.h" - -#if __has_include() -#import - -@implementation RNFirebaseCrash -RCT_EXPORT_MODULE(); - -RCT_EXPORT_METHOD(log:(NSString *)message) { - FIRCrashLog(@"%@", message); -} - -RCT_EXPORT_METHOD(logcat:(nonnull NSNumber *) level tag:(NSString *) tag message:(NSString *) message) { - FIRCrashLog(@"%@", message); -} - -RCT_EXPORT_METHOD(report:(NSString *) message) { - FIRCrashLog(@"%@", message); -} - -RCT_EXPORT_METHOD(setCrashCollectionEnabled:(BOOL *) enabled) { - // Not available yet -} - -RCT_EXPORT_METHOD(isCrashCollectionEnabled:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) { - // Not available yet - resolve(@YES); -} - -@end - -#else -@implementation RNFirebaseCrash -@end -#endif diff --git a/lib/index.d.ts b/lib/index.d.ts index a2033c9d..33ca790e 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -26,7 +26,6 @@ declare module 'react-native-firebase' { RNFirebase.auth.AuthStatics >; config: FirebaseModuleAndStatics; - crash: FirebaseModuleAndStatics; crashlytics: FirebaseModuleAndStatics; database: FirebaseModuleAndStatics< RNFirebase.database.Database, @@ -82,7 +81,6 @@ declare module 'react-native-firebase' { analytics(): RNFirebase.Analytics; auth(): RNFirebase.auth.Auth; config(): RNFirebase.config.Config; - crash(): RNFirebase.crash.Crash; crashlytics(): RNFirebase.crashlytics.Crashlytics; database(): RNFirebase.database.Database; firestore(): RNFirebase.firestore.Firestore; @@ -1548,27 +1546,6 @@ declare module 'react-native-firebase' { } } - namespace crash { - interface Crash { - /** Logs a message that will appear in a subsequent crash report. */ - log(message: string): void; - - /** - * Android: Logs a message that will appear in a subsequent crash report as well as in logcat. - * iOS: Logs the message in the subsequest crash report only (same as log). - */ - logcat(level: number, tag: string, message: string): void; - - /** - * Files a crash report, along with any previous logs to Firebase. - * An Error object must be passed into the report method. - */ - report(error: RnError, maxStackSize: Number): void; - - [key: string]: any; - } - } - namespace crashlytics { interface Crashlytics { /** diff --git a/lib/modules/core/app.js b/lib/modules/core/app.js index c0c69af9..04db252e 100644 --- a/lib/modules/core/app.js +++ b/lib/modules/core/app.js @@ -12,7 +12,6 @@ import AdMob, { NAMESPACE as AdmobNamespace } from '../admob'; import Auth, { NAMESPACE as AuthNamespace } from '../auth'; import Analytics, { NAMESPACE as AnalyticsNamespace } from '../analytics'; import Config, { NAMESPACE as ConfigNamespace } from '../config'; -import Crash, { NAMESPACE as CrashNamespace } from '../crash'; import Crashlytics, { NAMESPACE as CrashlyticsNamespace } from '../crashlytics'; import Database, { NAMESPACE as DatabaseNamespace } from '../database'; import Firestore, { NAMESPACE as FirestoreNamespace } from '../firestore'; @@ -42,7 +41,6 @@ export default class App { analytics: () => Analytics; auth: () => Auth; config: () => Config; - crash: () => Crash; crashlytics: () => Crashlytics; database: () => Database; firestore: () => Firestore; @@ -83,7 +81,6 @@ export default class App { this.analytics = APPS.appModule(this, AnalyticsNamespace, Analytics); this.auth = APPS.appModule(this, AuthNamespace, Auth); this.config = APPS.appModule(this, ConfigNamespace, Config); - this.crash = APPS.appModule(this, CrashNamespace, Crash); this.crashlytics = APPS.appModule(this, CrashlyticsNamespace, Crashlytics); this.database = APPS.appModule(this, DatabaseNamespace, Database); this.firestore = APPS.appModule(this, FirestoreNamespace, Firestore); diff --git a/lib/modules/core/firebase.js b/lib/modules/core/firebase.js index b07ee147..2cc5bb5c 100644 --- a/lib/modules/core/firebase.js +++ b/lib/modules/core/firebase.js @@ -22,10 +22,6 @@ import { statics as ConfigStatics, MODULE_NAME as ConfigModuleName, } from '../config'; -import { - statics as CrashStatics, - MODULE_NAME as CrashModuleName, -} from '../crash'; import { statics as CrashlyticsStatics, MODULE_NAME as CrashlyticsModuleName, @@ -80,7 +76,6 @@ import type { AnalyticsModule, AuthModule, ConfigModule, - CrashModule, CrashlyticsModule, DatabaseModule, FirebaseOptions, @@ -103,7 +98,6 @@ class Firebase { analytics: AnalyticsModule; auth: AuthModule; config: ConfigModule; - crash: CrashModule; crashlytics: CrashlyticsModule; database: DatabaseModule; firestore: FirestoreModule; @@ -136,7 +130,6 @@ class Firebase { ConfigStatics, ConfigModuleName ); - this.crash = APPS.moduleAndStatics('crash', CrashStatics, CrashModuleName); this.crashlytics = APPS.moduleAndStatics( 'crashlytics', CrashlyticsStatics, diff --git a/lib/modules/crash/index.js b/lib/modules/crash/index.js deleted file mode 100644 index 2d8eeeff..00000000 --- a/lib/modules/crash/index.js +++ /dev/null @@ -1,90 +0,0 @@ -/** - * @flow - * Crash Reporting representation wrapper - */ -import ModuleBase from '../../utils/ModuleBase'; -import { getNativeModule } from '../../utils/native'; - -import type App from '../core/app'; -import type { FirebaseError } from '../../types'; - -export const MODULE_NAME = 'RNFirebaseCrash'; -export const NAMESPACE = 'crash'; - -export default class Crash extends ModuleBase { - constructor(app: App) { - super(app, { - moduleName: MODULE_NAME, - multiApp: false, - hasShards: false, - namespace: NAMESPACE, - }); - console.warn( - 'Crash Reporting is deprecated, consider switching to Crashlytics which is now the primary crash reporter for Firebase.' - ); - } - - /** - * Enables/Disables crash reporting - * @param enabled - */ - setCrashCollectionEnabled(enabled: boolean): void { - getNativeModule(this).setCrashCollectionEnabled(enabled); - } - - /** - * Returns whether or not crash reporting is currently enabled - * @returns {Promise.} - */ - isCrashCollectionEnabled(): Promise { - return getNativeModule(this).isCrashCollectionEnabled(); - } - - /** - * Logs a message that will appear in a subsequent crash report. - * @param {string} message - */ - log(message: string): void { - getNativeModule(this).log(message); - } - - /** - * Logs a message that will appear in a subsequent crash report as well as in logcat. - * NOTE: Android only functionality. iOS will just log the message. - * @param {string} message - * @param {number} level - * @param {string} tag - */ - logcat(level: number, tag: string, message: string): void { - getNativeModule(this).logcat(level, tag, message); - } - - /** - * Generates a crash report for the given message. This method should be used for unexpected - * exceptions where recovery is not possible. - * NOTE: on iOS, this will cause the app to crash as it's the only way to ensure the exception - * gets sent to Firebase. Otherwise it just gets lost as a log message. - * @param {Error} error - * @param maxStackSize - */ - report(error: FirebaseError, maxStackSize: number = 10): void { - if (!error || !error.message) return; - - let errorMessage = `Message: ${error.message}\r\n`; - - if (error.code) { - errorMessage = `${errorMessage}Code: ${error.code}\r\n`; - } - - const stackRows = error.stack.split('\n'); - errorMessage = `${errorMessage}\r\nStack: \r\n`; - for (let i = 0, len = stackRows.length; i < len; i++) { - if (i === maxStackSize) break; - errorMessage = `${errorMessage} - ${stackRows[i]}\r\n`; - } - - getNativeModule(this).report(errorMessage); - } -} - -export const statics = {}; diff --git a/lib/types/index.js b/lib/types/index.js index 881d3737..758f4a15 100644 --- a/lib/types/index.js +++ b/lib/types/index.js @@ -7,8 +7,6 @@ import type Auth from '../modules/auth'; import { typeof statics as AuthStatics } from '../modules/auth'; import type Config from '../modules/config'; import { typeof statics as ConfigStatics } from '../modules/config'; -import type Crash from '../modules/crash'; -import { typeof statics as CrashStatics } from '../modules/crash'; import type Crashlytics from '../modules/crashlytics'; import { typeof statics as CrashlyticsStatics } from '../modules/crashlytics'; import type Database from '../modules/database'; @@ -61,7 +59,6 @@ export type FirebaseModuleName = | 'RNFirebaseAnalytics' | 'RNFirebaseAuth' | 'RNFirebaseRemoteConfig' - | 'RNFirebaseCrash' | 'RNFirebaseCrashlytics' | 'RNFirebaseDatabase' | 'RNFirebaseFirestore' @@ -80,7 +77,6 @@ export type FirebaseNamespace = | 'analytics' | 'auth' | 'config' - | 'crash' | 'crashlytics' | 'database' | 'firestore' @@ -138,13 +134,6 @@ export type AuthModule = { nativeModuleExists: boolean, } & AuthStatics; -/* Crash types */ - -export type CrashModule = { - (): Crash, - nativeModuleExists: boolean, -} & CrashStatics; - /* Crashlytics types */ export type CrashlyticsModule = { (): Crashlytics, diff --git a/lib/utils/internals.js b/lib/utils/internals.js index fc656c04..419bd5f1 100644 --- a/lib/utils/internals.js +++ b/lib/utils/internals.js @@ -8,7 +8,6 @@ const NAMESPACE_PODS = { analytics: 'Firebase/Analytics', auth: 'Firebase/Auth', config: 'Firebase/RemoteConfig', - crash: 'Firebase/Crash', database: 'Firebase/Database', links: 'Firebase/DynamicLinks', messaging: 'Firebase/Messaging',