1"use strict"; 2 3Object.defineProperty(exports, "__esModule", { 4 value: true 5}); 6exports.createAndroidManifestPlugin = createAndroidManifestPlugin; 7exports.createStringsXmlPlugin = createStringsXmlPlugin; 8exports.withStringsXml = exports.withSettingsGradle = exports.withProjectBuildGradle = exports.withMainApplication = exports.withMainActivity = exports.withGradleProperties = exports.withAppBuildGradle = exports.withAndroidStyles = exports.withAndroidManifest = exports.withAndroidColorsNight = exports.withAndroidColors = void 0; 9function _withMod() { 10 const data = require("./withMod"); 11 _withMod = function () { 12 return data; 13 }; 14 return data; 15} 16/** 17 * Helper method for creating mods from existing config functions. 18 * 19 * @param action 20 */ 21function createAndroidManifestPlugin(action, name) { 22 const withUnknown = config => withAndroidManifest(config, async config => { 23 config.modResults = await action(config, config.modResults); 24 return config; 25 }); 26 if (name) { 27 Object.defineProperty(withUnknown, 'name', { 28 value: name 29 }); 30 } 31 return withUnknown; 32} 33function createStringsXmlPlugin(action, name) { 34 const withUnknown = config => withStringsXml(config, async config => { 35 config.modResults = await action(config, config.modResults); 36 return config; 37 }); 38 if (name) { 39 Object.defineProperty(withUnknown, 'name', { 40 value: name 41 }); 42 } 43 return withUnknown; 44} 45 46/** 47 * Provides the AndroidManifest.xml for modification. 48 * 49 * @param config 50 * @param action 51 */ 52const withAndroidManifest = (config, action) => { 53 return (0, _withMod().withMod)(config, { 54 platform: 'android', 55 mod: 'manifest', 56 action 57 }); 58}; 59 60/** 61 * Provides the strings.xml for modification. 62 * 63 * @param config 64 * @param action 65 */ 66exports.withAndroidManifest = withAndroidManifest; 67const withStringsXml = (config, action) => { 68 return (0, _withMod().withMod)(config, { 69 platform: 'android', 70 mod: 'strings', 71 action 72 }); 73}; 74 75/** 76 * Provides the `android/app/src/main/res/values/colors.xml` as JSON (parsed with [`xml2js`](https://www.npmjs.com/package/xml2js)). 77 * 78 * @param config 79 * @param action 80 */ 81exports.withStringsXml = withStringsXml; 82const withAndroidColors = (config, action) => { 83 return (0, _withMod().withMod)(config, { 84 platform: 'android', 85 mod: 'colors', 86 action 87 }); 88}; 89 90/** 91 * Provides the `android/app/src/main/res/values-night/colors.xml` as JSON (parsed with [`xml2js`](https://www.npmjs.com/package/xml2js)). 92 * 93 * @param config 94 * @param action 95 */ 96exports.withAndroidColors = withAndroidColors; 97const withAndroidColorsNight = (config, action) => { 98 return (0, _withMod().withMod)(config, { 99 platform: 'android', 100 mod: 'colorsNight', 101 action 102 }); 103}; 104 105/** 106 * Provides the `android/app/src/main/res/values/styles.xml` as JSON (parsed with [`xml2js`](https://www.npmjs.com/package/xml2js)). 107 * 108 * @param config 109 * @param action 110 */ 111exports.withAndroidColorsNight = withAndroidColorsNight; 112const withAndroidStyles = (config, action) => { 113 return (0, _withMod().withMod)(config, { 114 platform: 'android', 115 mod: 'styles', 116 action 117 }); 118}; 119 120/** 121 * Provides the project MainActivity for modification. 122 * 123 * @param config 124 * @param action 125 */ 126exports.withAndroidStyles = withAndroidStyles; 127const withMainActivity = (config, action) => { 128 return (0, _withMod().withMod)(config, { 129 platform: 'android', 130 mod: 'mainActivity', 131 action 132 }); 133}; 134 135/** 136 * Provides the project MainApplication for modification. 137 * 138 * @param config 139 * @param action 140 */ 141exports.withMainActivity = withMainActivity; 142const withMainApplication = (config, action) => { 143 return (0, _withMod().withMod)(config, { 144 platform: 'android', 145 mod: 'mainApplication', 146 action 147 }); 148}; 149 150/** 151 * Provides the project /build.gradle for modification. 152 * 153 * @param config 154 * @param action 155 */ 156exports.withMainApplication = withMainApplication; 157const withProjectBuildGradle = (config, action) => { 158 return (0, _withMod().withMod)(config, { 159 platform: 'android', 160 mod: 'projectBuildGradle', 161 action 162 }); 163}; 164 165/** 166 * Provides the app/build.gradle for modification. 167 * 168 * @param config 169 * @param action 170 */ 171exports.withProjectBuildGradle = withProjectBuildGradle; 172const withAppBuildGradle = (config, action) => { 173 return (0, _withMod().withMod)(config, { 174 platform: 'android', 175 mod: 'appBuildGradle', 176 action 177 }); 178}; 179 180/** 181 * Provides the /settings.gradle for modification. 182 * 183 * @param config 184 * @param action 185 */ 186exports.withAppBuildGradle = withAppBuildGradle; 187const withSettingsGradle = (config, action) => { 188 return (0, _withMod().withMod)(config, { 189 platform: 'android', 190 mod: 'settingsGradle', 191 action 192 }); 193}; 194 195/** 196 * Provides the /gradle.properties for modification. 197 * 198 * @param config 199 * @param action 200 */ 201exports.withSettingsGradle = withSettingsGradle; 202const withGradleProperties = (config, action) => { 203 return (0, _withMod().withMod)(config, { 204 platform: 'android', 205 mod: 'gradleProperties', 206 action 207 }); 208}; 209exports.withGradleProperties = withGradleProperties; 210//# sourceMappingURL=android-plugins.js.map