Files
react-native-firebase/packages/crashlytics/lib/index.js.flow
Mike Diarmid c89ba48e92 [v6] Implement Crashlytics upgrade + required internals changes (#1958)
[crashlytics]

Fixes: #1643, #1848, #1964, #1920, #1884, #1783, #1966, #1940, #1447

Features/Bugs Todo:

  Capture JS Exceptions with stack traces automatically
  Capture Unhandled Promise Rejections with stack traces automatically
  [Android] .crash() not captured in debug due to RN RedBox; see #1921
  Support advanced user identifier features
  [Android] Enable Crashlyics NDK reporting by default (gist)
  Support toggling native crash logging off/on (e.g. disable in DEV)
  Support toggling JS crash logging off/on (e.g. disable in DEV)

  [ios] Static framework support for all modules
  [ios] Implement CocoaPods Firebase RN modules auto-loader script
  Implement firebase.json config loader; Android & iOS
  [tests] Fix false positive tests that catch errors (tests did not check that errors actually threw)
  [android] Cleanup manifest permissions for all modules
  [android] Implement Content provider base class
  [android] Investigate/fix issue where setDataCollectionDefaultEnabled is false by default in Firebase - it disables Crashlytics reporting
2019-03-13 17:07:21 +00:00

146 lines
4.4 KiB
Plaintext

/* eslint-disable import/no-duplicates */
/*
* Copyright (c) 2016-present Invertase Limited & Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this library except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import type { ReactNativeFirebaseModule } from '@react-native-firebase/app-types/index.js.flow';
export interface Statics {}
export interface Module extends ReactNativeFirebaseModule {
/**
* Whether Crashlytics reporting is enabled.
*/
isCrashlyticsCollectionEnabled: true;
/**
* Cause your app to crash for testing purposes.
*/
crash(): void;
/**
* Log a message that will appear in any subsequent Crash or Non-fatal error reports.
*
* @param message
*/
log(message: string): void;
/**
* Record a JavaScript Error.
*
* The JavaScript stack trace is converted into a mock native exception before submission.
*
* @param error Expects an instance of Error; e.g. classes that extend Error will also be supported.
*/
recordError(error: Error): void;
/**
* Specify a user identifier which will be visible in the Firebase Crashlytics console.
*
* It is recommended for privacy purposes that this value be a value that's meaningless to a third-party observer; such as an arbitrary string that ties an end-user to a record in your system e.g. a database record id.
*
* @param userId An arbitrary string that ties an end-user to a record in your system e.g. a database record id.
*/
setUserId(userId: string): Promise<null>;
/**
* Optionally specify a user name which will be visible in the Firebase Crashlytics console.
*
* If you choose to collect contact information it is strongly recommend that you disclose this in your apps privacy policy.
*
* @param userName A string representing an end-user's name or app username
*/
setUserName(userName: string): Promise<null>;
/**
* Optionally specify a user email which will be visible in the Firebase Crashlytics console.
*
* If you choose to collect contact information it is strongly recommend that you disclose this in your apps privacy policy.
*
* @param userEmail
*/
setUserEmail(userEmail: string): Promise<null>;
/**
* Sets a string value to be associated with the given attribute name which will be visible in the Firebase Crashlytics console.
*
* @param name
* @param value
*/
setAttribute(name: string, value: string): Promise<null>;
/**
* Like `setAttribute` but for multiple attributes.
*
* @param attributes
*/
setAttributes(attributes: { [key: string]: string }): Promise<null>;
/**
* Enable/disable Crashlytics reporting.
*
* Use this for opt-in first user data collection flows combined with `firebase.json` settings to disable auto collection.
*
* @param enabled
*/
setCrashlyticsCollectionEnabled(enabled: boolean): Promise<null>;
}
declare module '@react-native-firebase/crashlytics' {
import type {
ReactNativeFirebaseNamespace,
ReactNativeFirebaseModuleAndStatics,
} from '@react-native-firebase/app-types/index.js.flow';
/**
* @example
* ```js
* import { firebase } from '@react-native-firebase/crashlytics';
* firebase.crashlytics().X(...);
* ```
*/
declare export var firebase: {} & ReactNativeFirebaseNamespace;
/**
* @example
* ```js
* import crashlytics from '@react-native-firebase/crashlytics';
* crashlytics().X(...);
* ```
*/
declare export default ReactNativeFirebaseModuleAndStatics<Module, Statics>;
}
/**
* Attach namespace to `firebase.` and `FirebaseApp.`.
*/
declare module '@react-native-firebase/app-types' {
import type { ReactNativeFirebaseModuleAndStatics } from '@react-native-firebase/app-types/index.js.flow';
declare interface ReactNativeFirebaseNamespace {
/**
* Crashlytics
*/
crashlytics: ReactNativeFirebaseModuleAndStatics<Module, Statics>;
}
declare interface FirebaseApp {
/**
* Crashlytics
*/
crashlytics(): Module;
}
}