UNPKG

@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

30 lines (29 loc) 1.26 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.withApplyGoogleServicesPlugin = void 0; exports.applyPlugin = applyPlugin; const config_plugins_1 = require("@expo/config-plugins"); const constants_1 = require("./constants"); /** * Update `app/build.gradle` by applying google-services plugin */ const withApplyGoogleServicesPlugin = config => { return (0, config_plugins_1.withAppBuildGradle)(config, config => { if (config.modResults.language === 'groovy') { config.modResults.contents = applyPlugin(config.modResults.contents); } else { config_plugins_1.WarningAggregator.addWarningAndroid('react-native-firebase-app', `Cannot automatically configure app build.gradle if it's not groovy`); } return config; }); }; exports.withApplyGoogleServicesPlugin = withApplyGoogleServicesPlugin; function applyPlugin(appBuildGradle) { // Make sure the project does not have the plugin already const pattern = new RegExp(`apply\\s+plugin:\\s+['"]${constants_1.googleServicesPlugin}['"]`); if (!appBuildGradle.match(pattern)) { return appBuildGradle + `\napply plugin: '${constants_1.googleServicesPlugin}'`; } return appBuildGradle; }