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

31 lines (26 loc) 1.02 kB
import { ConfigPlugin, WarningAggregator, withAppBuildGradle } from '@expo/config-plugins'; import { googleServicesPlugin } from './constants'; /** * Update `app/build.gradle` by applying google-services plugin */ export const withApplyGoogleServicesPlugin: ConfigPlugin = config => { return withAppBuildGradle(config, config => { if (config.modResults.language === 'groovy') { config.modResults.contents = applyPlugin(config.modResults.contents); } else { WarningAggregator.addWarningAndroid( 'react-native-firebase-app', `Cannot automatically configure app build.gradle if it's not groovy`, ); } return config; }); }; export function applyPlugin(appBuildGradle: string) { // Make sure the project does not have the plugin already const pattern = new RegExp(`apply\\s+plugin:\\s+['"]${googleServicesPlugin}['"]`); if (!appBuildGradle.match(pattern)) { return appBuildGradle + `\napply plugin: '${googleServicesPlugin}'`; } return appBuildGradle; }