import { ExpoConfig } from '@expo/config-types' ; import { ConfigPlugin , Mod } from '../Plugin.types' ; import { Manifest , Paths , Properties , Resources } from '../android' ; import { withMod } from './withMod' ; type OptionalPromise < T > = T | Promise < T > ; type MutateDataAction < T > = ( expo : ExpoConfig , data : T ) => OptionalPromise < T > ; param action export function createAndroidManifestPlugin ( action , name ) { const withUnknown = config => withAndroidManifest ( config , async ( config ) => { config . modResults = await action ( config , config . modResults ) ; return config ; } ) ; if ( name ) { Object . defineProperty ( withUnknown , 'name' , { value : name } ) ; } return withUnknown ; } export function createStringsXmlPlugin ( action , name ) { const withUnknown = config => withStringsXml ( config , async ( config ) => { config . modResults = await action ( config , config . modResults ) ; return config ; } ) ; if ( name ) { Object . defineProperty ( withUnknown , 'name' , { value : name } ) ; } return withUnknown ; } param config param action export const withAndroidManifest = ( config , action ) => { return withMod ( config , { platform : 'android' , mod : 'manifest' , action } ) ; } ; param config param action export const withStringsXml = ( config , action ) => { return withMod ( config , { platform : 'android' , mod : 'strings' , action } ) ; } ; param config param action export const withAndroidColors = ( config , action ) => { return withMod ( config , { platform : 'android' , mod : 'colors' , action } ) ; } ; param config param action export const withAndroidColorsNight = ( config , action ) => { return withMod ( config , { platform : 'android' , mod : 'colorsNight' , action } ) ; } ; param config param action export const withAndroidStyles = ( config , action ) => { return withMod ( config , { platform : 'android' , mod : 'styles' , action } ) ; } ; param config param action export const withMainActivity = ( config , action ) => { return withMod ( config , { platform : 'android' , mod : 'mainActivity' , action } ) ; } ; param config param action export const withMainApplication = ( config , action ) => { return withMod ( config , { platform : 'android' , mod : 'mainApplication' , action } ) ; } ; param config param action export const withProjectBuildGradle = ( config , action ) => { return withMod ( config , { platform : 'android' , mod : 'projectBuildGradle' , action } ) ; } ; param config param action export const withAppBuildGradle = ( config , action ) => { return withMod ( config , { platform : 'android' , mod : 'appBuildGradle' , action } ) ; } ; param config param action export const withSettingsGradle = ( config , action ) => { return withMod ( config , { platform : 'android' , mod : 'settingsGradle' , action } ) ; } ; param config param action export const withGradleProperties = ( config , action ) => { return withMod ( config , { platform : 'android' , mod : 'gradleProperties' , action } ) ; } ;