all files / firebase/modules/fabric/crashlytics/ index.js

91.67% Statements 11/12
100% Branches 0/0
88.89% Functions 8/9
91.67% Lines 11/12
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83                                                                                                                                               
/**
 * @flow
 * Crash Reporting representation wrapper
 */
import ModuleBase from '../../../utils/ModuleBase';
import { getNativeModule } from '../../../utils/native';
 
import type App from '../../core/app';
 
export const MODULE_NAME = 'RNFirebaseCrashlytics';
export const NAMESPACE = 'crashlytics';
 
export default class Crashlytics extends ModuleBase {
  constructor(app: App) {
    super(app, {
      moduleName: MODULE_NAME,
      multiApp: false,
      namespace: NAMESPACE,
    });
  }
 
  /**
   * Forces a crash. Useful for testing your application is set up correctly.
   */
  crash(): void {
    getNativeModule(this).crash();
  }
 
  /**
   * Logs a message that will appear in any subsequent crash reports.
   * @param {string} message
   */
  log(message: string): void {
    getNativeModule(this).log(message);
  }
 
  /**
   * Logs a non fatal exception.
   * @param {string} code
   * @param {string} message
   */
  recordError(code: number, message: string): void {
    getNativeModule(this).recordError(code, message);
  }
 
  /**
   * Set a boolean value to show alongside any subsequent crash reports.
   */
  setBoolValue(key: string, value: boolean): void {
    getNativeModule(this).setBoolValue(key, value);
  }
 
  /**
   * Set a float value to show alongside any subsequent crash reports.
   */
  setFloatValue(key: string, value: number): void {
    getNativeModule(this).setFloatValue(key, value);
  }
 
  /**
   * Set an integer value to show alongside any subsequent crash reports.
   */
  setIntValue(key: string, value: number): void {
    getNativeModule(this).setIntValue(key, value);
  }
 
  /**
   * Set a string value to show alongside any subsequent crash reports.
   */
  setStringValue(key: string, value: string): void {
    getNativeModule(this).setStringValue(key, value);
  }
 
  /**
   * Set the user ID to show alongside any subsequent crash reports.
   */
  setUserIdentifier(userId: string): void {
    getNativeModule(this).setUserIdentifier(userId);
  }
}
 
export const statics = {};