UNPKG

react-native-firebase-compiled

Version:

A well tested, feature rich Firebase implementation for React Native, supporting iOS & Android. Individual module support for Admob, Analytics, Auth, Crash Reporting, Cloud Firestore, Database, Dynamic Links, Functions, Messaging (FCM), Remote Config, Sto

82 lines (66 loc) 1.91 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.statics = exports.default = exports.MODULE_NAME = exports.NAMESPACE = void 0; var _ModuleBase = _interopRequireDefault(require("../../utils/ModuleBase")); var _native = require("../../utils/native"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * * Instance ID representation wrapper */ const NAMESPACE = 'iid'; exports.NAMESPACE = NAMESPACE; const MODULE_NAME = 'RNFirebaseInstanceId'; exports.MODULE_NAME = MODULE_NAME; class InstanceId extends _ModuleBase.default { constructor(app) { super(app, { hasCustomUrlSupport: false, moduleName: MODULE_NAME, hasMultiAppSupport: false, namespace: NAMESPACE }); } /** * Get the current Instance ID. * * @returns {*} */ get() { return (0, _native.getNativeModule)(this).get(); } /** * Delete the current Instance ID. * * @returns {*} */ delete() { return (0, _native.getNativeModule)(this).delete(); } /** * Get a token that authorizes an Entity to perform an action on behalf * of the application identified by Instance ID. * * @param authorizedEntity * @param scope * @returns {Promise<string>} */ getToken(authorizedEntity, scope) { return (0, _native.getNativeModule)(this).getToken(authorizedEntity || this.app.options.messagingSenderId, scope || '*'); } /** * Revokes access to a scope (action) for an entity previously authorized by getToken(). * * @param authorizedEntity * @param scope * @returns {Promise<void>} */ deleteToken(authorizedEntity, scope) { return (0, _native.getNativeModule)(this).deleteToken(authorizedEntity || this.app.options.messagingSenderId, scope || '*'); } } exports.default = InstanceId; const statics = {}; exports.statics = statics;