From 66b9d1a011943a45abf05632a03e4f308477c615 Mon Sep 17 00:00:00 2001 From: Julian Sanio Date: Mon, 29 Apr 2019 17:58:17 +0200 Subject: [PATCH] feat(firebase-crash): add plugin --- .../plugins/firebase-crash/index.ts | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 src/@ionic-native/plugins/firebase-crash/index.ts diff --git a/src/@ionic-native/plugins/firebase-crash/index.ts b/src/@ionic-native/plugins/firebase-crash/index.ts new file mode 100644 index 000000000..b19525c8a --- /dev/null +++ b/src/@ionic-native/plugins/firebase-crash/index.ts @@ -0,0 +1,64 @@ +import { Injectable } from '@angular/core'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; + +/** + * @name FirebaseCrash + * @description + * This plugin brings crash reporting from Google Firebase to your Cordova project! Android and iOS supported. + * + * @usage + * ```typescript + * import { FirebaseCrash } from '@ionic-native/firebase-crash'; + * + * constructor(private firebaseCrash: FirebaseCrash) { } + * + * ... + * + * this.firebaseCrash.setUserId('123456789'); + * this.firebaseCrash.log('message'); + * this.firebaseCrash.logError('non fatal exception'); + * + * ``` + */ +@Plugin({ + pluginName: 'FirebaseCrash', + plugin: 'cordova-plugin-firebase-crash', + pluginRef: 'cordova.plugins.firebase.crashlytics', + repo: 'https://github.com/chemerisuk/cordova-plugin-firebase-crash', + platforms: ['Android', 'iOS'] +}) +@Injectable() +export class FirebaseCrash extends IonicNativePlugin { + /** + * Add logging that will be sent with your crash data in case of app crash. + * https://firebase.google.com/docs/crashlytics/customize-crash-reports?authuser=0#add_custom_logs + * @param {string} message + * @return {Promise} + */ + @Cordova({ sync: true }) + log(message: string): Promise { + return; + } + + /** + * Log non-fatal exceptions in addition to automatically reported app crashes. + * https://firebase.google.com/docs/crashlytics/customize-crash-reports?authuser=0#log_non-fatal_exceptions + * @param {string} message + * @return {Promise} + */ + @Cordova({ sync: true }) + logError(message: string): Promise { + return; + } + + /** + * Sets the user identifier property for crashlytics reporting. + * https://firebase.google.com/docs/crashlytics/customize-crash-reports?authuser=0#set_user_ids + * @param {string} userId value to set the userId + * @returns {Promise} + */ + @Cordova({ sync: true }) + setUserId(userId: string): Promise { + return; + } +}