UNPKG

@smartface/plugin-firebase

Version:

Smartface Firebase Plugin for Smartface Native Framework

153 lines 6.04 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); // @ts-ignore var NativeClass = requireClass('com.google.firebase.crashlytics.FirebaseCrashlytics'); // @ts-ignore var NativeException = global.requireClass('java.lang.Exception'); var androidconfig_1 = __importDefault(require("@smartface/native/util/Android/androidconfig")); /** * @class Crashlytics * @since 1.0 * * Spend less time finding and more time fixing crashes. * Named the #1 performance SDK on both iOS and Android, Crashlytics provides deep and actionable insights, even the exact line of code your app crashed on. * */ var Crashlytics = /** @class */ (function () { function Crashlytics() { } /** * You can use Crashlytics.setUserIdentifier to provide an ID number, token, or hashed value that uniquely identifies the end-user of your application without disclosing or transmitting any of their personal information. * * @example * import { Crashlytics } from '@smartface/plugin-firebase'; * Crashlytics.setUserIdentifier("UserIdentifier"); * * @method setUserIdentifier * @param {String} UserIdentifier * @android * @ios * @static * @since 1.0 */ Crashlytics.setUserIdentifier = function (identifier) { if (!androidconfig_1.default.isEmulator) Crashlytics.NativeClass.getInstance().setUserId(identifier); }; /** * Custom keys help you get the specific state of your app leading up to a crash. You can associate arbitrary key/value pairs with your crash reports, then use the custom keys to search and filter crash reports in the Firebase console. * Setting keys are as easy as calling: Crashlytics.setString(key, value). * * @example * import { Crashlytics } from '@smartface/plugin-firebase'; * Crashlytics.setString("key","value"); * * @method setString * @param {String} key * @param {String} value * @android * @ios * @static * @since 1.0 */ Crashlytics.setString = function (key, value) { if (!androidconfig_1.default.isEmulator) Crashlytics.NativeClass.getInstance().setCustomKey(key, value); }; /** * Custom keys help you get the specific state of your app leading up to a crash. You can associate arbitrary key/value pairs with your crash reports, then use the custom keys to search and filter crash reports in the Firebase console. * Setting keys are as easy as calling: Crashlytics.setBool(key, value). * * @example * import { Crashlytics } from '@smartface/plugin-firebase'; * Crashlytics.setBool("key",true); * * @method setBool * @param {String} key * @param {boolean} value * @android * @ios * @static * @since 1.0 */ Crashlytics.setBool = function (key, value) { if (!androidconfig_1.default.isEmulator) Crashlytics.NativeClass.getInstance().setCustomKey(key, value); }; /** * Custom keys help you get the specific state of your app leading up to a crash. You can associate arbitrary key/value pairs with your crash reports, then use the custom keys to search and filter crash reports in the Firebase console. * Setting keys are as easy as calling: Crashlytics.setFloat(key, value). * * @example * import { Crashlytics } from '@smartface/plugin-firebase'; * Crashlytics.setFloat("key",true); * * @method setFloat * @param {String} key * @param {number} value * @android * @ios * @static * @since 1.0 */ Crashlytics.setFloat = function (key, value) { if (!androidconfig_1.default.isEmulator) Crashlytics.NativeClass.getInstance().setCustomKey(key, value); }; /** * Custom keys help you get the specific state of your app leading up to a crash. You can associate arbitrary key/value pairs with your crash reports, then use the custom keys to search and filter crash reports in the Firebase console. * Setting keys are as easy as calling: Crashlytics.setInt(key, value). * * @example * import { Crashlytics } from '@smartface/plugin-firebase'; * Crashlytics.setInt("key",true); * * @method setInt * @param {String} key * @param {number} value * @android * @ios * @static * @since 1.0 */ Crashlytics.setInt = function (key, value) { if (!androidconfig_1.default.isEmulator) Crashlytics.NativeClass.getInstance().setCustomKey(key, value); }; /** * logError method helps you report the error with an optional identifier. * * @example * import { Crashlytics } from '@smartface/plugin-firebase'; * const err = new Error('Unexpected error'); * const stringError = JSON.stringify(err, null, '\t'); * Crashlytics.logError({error: stringError, identifier: 'UnhandledException' }); * * @method logError * @param {LogErrorParams} params * @android * @ios * @static * @since 7.0 */ Crashlytics.logError = function (params) { var error = params.error, _a = params.identifier, identifier = _a === void 0 ? 'Exception' : _a; Crashlytics.NativeClass.getInstance().log(identifier); Crashlytics.NativeClass.getInstance().recordException(new NativeException(error)); }; Crashlytics.NativeClass = NativeClass; Crashlytics.ios = { setUserName: function (name) { }, setUserEmail: function (email) { }, getVersion: function () { }, crash: function () { }, with: function (kits) { } }; return Crashlytics; }()); exports.default = Crashlytics; module.exports = Crashlytics; //# sourceMappingURL=crashlytics-Android.js.map