diff --git a/android/src/main/java/io/invertase/firebase/crash/RNFirebaseCrash.java b/android/src/main/java/io/invertase/firebase/crash/RNFirebaseCrash.java index 4165bc2a..bcd8bbc6 100644 --- a/android/src/main/java/io/invertase/firebase/crash/RNFirebaseCrash.java +++ b/android/src/main/java/io/invertase/firebase/crash/RNFirebaseCrash.java @@ -2,6 +2,7 @@ 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; @@ -37,4 +38,15 @@ public class RNFirebaseCrash extends ReactContextBaseJavaModule { 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/docs/modules/analytics.md b/docs/modules/analytics.md index d05fe517..68c65a50 100644 --- a/docs/modules/analytics.md +++ b/docs/modules/analytics.md @@ -9,6 +9,9 @@ own app. The Firebase SDK includes a number of pre-set events which are automati 'app_update', 'error', 'first_open', + 'first_visit', + 'first_open_time', + 'first_visit_time', 'in_app_purchase', 'notification_dismiss', 'notification_foreground', @@ -16,7 +19,14 @@ own app. The Firebase SDK includes a number of pre-set events which are automati 'notification_receive', 'os_update', 'session_start', + 'screen_view', 'user_engagement', + 'ad_impression', + 'ad_click', + 'ad_query', + 'ad_exposure', + 'adunit_exposure', + 'ad_activeiew', ``` #### `logEvent(event: string, params?: Object): void` diff --git a/docs/modules/crash.md b/docs/modules/crash.md index 2e986a62..ad7f474e 100644 --- a/docs/modules/crash.md +++ b/docs/modules/crash.md @@ -2,6 +2,25 @@ RNFirebase provides crash reporting for your app out of the box. Please note crashes do not appear in real-time on the console, they tend to take a number of hours to appear. +## Enabling/Disabling Crash Reporting + +By default crash reporting is enabled. If you want to disable reporting, call `setCrashCollectionEnabled(enabled: Boolean)`: + +```js +firebase.crash().setCrashCollectionEnabled(false); +``` + +To check if crash reporting is currently enabled, call `isCrashCollectionEnabled(): Promise`: + +```js +firebase.crash().isCrashCollectionEnabled() + .then((enabled) => { + if (enabled) { + console.log('Crash Reporting is currently enabled'); + } + }); +``` + ## Manual Crash Reporting If you want to manually report a crash, such as a pre-caught exception this is possible by using the `report` method. diff --git a/tests/src/tests/crash/log.js b/tests/src/tests/crash/log.js index 7f6d39df..e7390c7f 100644 --- a/tests/src/tests/crash/log.js +++ b/tests/src/tests/crash/log.js @@ -1,6 +1,6 @@ -export default function addTests({ describe, fdescribe, it, firebase }) { +export default function addTests({ describe, it, firebase }) { - fdescribe('API', () => { + describe('API', () => { it('it should set collection enabled/disabled', () => { return new Promise((resolve) => { firebase.native.crash().setCrashCollectionEnabled(false);