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