@react-native-firebase/app
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
190 lines (175 loc) • 6.82 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.SDK_VERSION = void 0;
exports.deleteApp = deleteApp;
exports.getApp = getApp;
exports.getApps = getApps;
exports.initializeApp = initializeApp;
exports.jsonGetAll = jsonGetAll;
exports.metaGetAll = metaGetAll;
exports.onLog = onLog;
exports.preferencesClearAll = preferencesClearAll;
exports.preferencesGetAll = preferencesGetAll;
exports.preferencesSetBool = preferencesSetBool;
exports.preferencesSetString = preferencesSetString;
exports.registerVersion = registerVersion;
exports.setLogLevel = setLogLevel;
exports.setReactNativeAsyncStorage = setReactNativeAsyncStorage;
var _index = require("./common/index.js");
var _app = require("./internal/registry/app.js");
var _logger = require("./internal/logger.js");
var _version2 = require("./version.js");
var _nativeModule = require("./internal/nativeModule");
var _constants = require("./internal/constants.js");
/*
* 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.
*
*/
/**
* Renders this app unusable and frees the resources of all associated services.
* @param app - The app to delete.
* @returns Promise<void>
*/
function deleteApp(app) {
return _app.deleteApp.call(null, app.name, app._nativeInitialized,
// @ts-expect-error - Extra arg used by deprecation proxy to detect modular calls
_index.MODULAR_DEPRECATION_ARG);
}
/**
* Registers a library's name and version for platform logging purposes.
* @param _libraryKeyOrName - library name or key.
* @param _version - library version.
* @param _variant - library variant. Optional.
* @returns Promise<void>
*/
function registerVersion(_libraryKeyOrName, _version, _variant) {
throw new Error('registerVersion is only supported on Web');
}
/**
* Sets log handler for VertexAI only currently.
* @param logCallback - The callback function to handle logs.
* @param options - Optional settings for log handling.
* @returns void
*/
function onLog(logCallback, options) {
(0, _logger.setUserLogHandler)(logCallback, options);
}
/**
* Gets the list of all initialized apps.
* @returns An array of all initialized Firebase apps.
*/
function getApps() {
return _app.getApps.call(null,
// @ts-expect-error - Extra arg used by deprecation proxy to detect modular calls
_index.MODULAR_DEPRECATION_ARG);
}
/**
* Initializes a Firebase app with the provided options and name.
* @param options - Options to configure the services used in the app.
* @param configOrName - The optional name of the app, or config for the app to initialize (a name of '[DEFAULT]' will be used if omitted).
* @returns The initialized Firebase app.
*/
function initializeApp(options, configOrName) {
return _app.initializeApp.call(null, options, configOrName,
// @ts-expect-error - Extra arg used by deprecation proxy to detect modular calls
_index.MODULAR_DEPRECATION_ARG);
}
/**
* Retrieves an instance of a Firebase app.
* @param name - The optional name of the app to return ('[DEFAULT]' if omitted).
* @returns The requested Firebase app instance.
*/
function getApp(name) {
return _app.getApp.call(null, name,
// @ts-expect-error - Extra arg used by deprecation proxy to detect modular calls
_index.MODULAR_DEPRECATION_ARG);
}
/**
* Sets the log level across all Firebase SDKs.
* @param logLevel - The log level to set ('debug', 'verbose', 'info', 'warn', 'error', 'silent').
* @returns void
*/
function setLogLevel(logLevel) {
return _app.setLogLevel.call(null, logLevel,
// @ts-expect-error - Extra arg used by deprecation proxy to detect modular calls
_index.MODULAR_DEPRECATION_ARG);
}
/**
* The `AsyncStorage` implementation to use for persisting data on 'Other' platforms.
* If not specified, in memory persistence is used.
*
* This is required if you want to persist things like Auth sessions, Analytics device IDs, etc.
*/
function setReactNativeAsyncStorage(asyncStorage) {
return _app.setReactNativeAsyncStorage.call(null, asyncStorage,
// @ts-expect-error - Extra arg used by deprecation proxy to detect modular calls
_index.MODULAR_DEPRECATION_ARG);
}
/**
* Gets react-native-firebase specific "meta" data from native Info.plist / AndroidManifest.xml
* @returns map of key / value pairs containing native meta data
*/
function metaGetAll() {
const RNFBAppModule = (0, _nativeModule.getReactNativeModule)(_constants.APP_NATIVE_MODULE);
return RNFBAppModule.metaGetAll();
}
/**
* Gets react-native-firebase specific "firebase.json" data
* @returns map of key / value pairs containing native firebase.json constants
*/
function jsonGetAll() {
const RNFBAppModule = (0, _nativeModule.getReactNativeModule)(_constants.APP_NATIVE_MODULE);
return RNFBAppModule.jsonGetAll();
}
/**
* Clears react-native-firebase specific native preferences
* @returns Promise<void>
*/
function preferencesClearAll() {
const RNFBAppModule = (0, _nativeModule.getReactNativeModule)(_constants.APP_NATIVE_MODULE);
return RNFBAppModule.preferencesClearAll();
}
/**
* Gets react-native-firebase specific native preferences
* @returns map of key / value pairs containing native preferences data
*/
function preferencesGetAll() {
const RNFBAppModule = (0, _nativeModule.getReactNativeModule)(_constants.APP_NATIVE_MODULE);
return RNFBAppModule.preferencesGetAll();
}
/**
* Sets react-native-firebase specific native boolean preference
* @param key the name of the native preference to set
* @param value the value of the native preference to set
* @returns Promise<void>
*/
function preferencesSetBool(key, value) {
const RNFBAppModule = (0, _nativeModule.getReactNativeModule)(_constants.APP_NATIVE_MODULE);
return RNFBAppModule.preferencesSetBool(key, value);
}
/**
* Sets react-native-firebase specific native string preference
* @param key the name of the native preference to set
* @param value the value of the native preference to set
* @returns Promise<void>
*/
function preferencesSetString(key, value) {
const RNFBAppModule = (0, _nativeModule.getReactNativeModule)(_constants.APP_NATIVE_MODULE);
return RNFBAppModule.preferencesSetString(key, value);
}
const SDK_VERSION = exports.SDK_VERSION = _version2.version;
//# sourceMappingURL=modular.js.map