|
1 | 1 | import { Config } from './config'; |
2 | | -import { Plugin, PluginType, getAssets, getJSModules, getPlatformElement, getPluginPlatform, getPluginType, getPlugins, printPlugins } from './plugin'; |
| 2 | +import { Plugin, PluginType, getAllElements, getAssets, getJSModules, getPlatformElement, getPluginPlatform, getPluginType, getPlugins, printPlugins } from './plugin'; |
3 | 3 | import { copySync, ensureDirSync, readFileAsync, removeSync, writeFileAsync } from './util/fs'; |
4 | 4 | import { basename, extname, join, resolve } from 'path'; |
5 | 5 | import { buildXmlElement, installDeps, log, logError, logFatal, logInfo, logWarn, parseXML, readXML, resolveNode, writeXML } from './common'; |
@@ -381,9 +381,11 @@ export async function writeCordovaAndroidManifest(cordovaPlugins: Plugin[], conf |
381 | 381 | let rootXMLEntries: Array<any> = []; |
382 | 382 | let applicationXMLEntries: Array<any> = []; |
383 | 383 | let applicationXMLAttributes: Array<any> = []; |
| 384 | + let prefsArray: Array<any> = []; |
384 | 385 | cordovaPlugins.map(async p => { |
385 | 386 | const editConfig = getPlatformElement(p, platform, 'edit-config'); |
386 | 387 | const configFile = getPlatformElement(p, platform, 'config-file'); |
| 388 | + prefsArray = prefsArray.concat(getAllElements(p, platform, 'preference')); |
387 | 389 | editConfig.concat(configFile).map(async (configElement: any) => { |
388 | 390 | if (configElement.$ && (configElement.$.target && configElement.$.target.includes('AndroidManifest.xml') || configElement.$.file && configElement.$.file.includes('AndroidManifest.xml'))) { |
389 | 391 | const keys = Object.keys(configElement).filter(k => k !== '$'); |
@@ -425,6 +427,9 @@ ${applicationXMLEntries.join('\n')} |
425 | 427 | ${rootXMLEntries.join('\n')} |
426 | 428 | </manifest>`; |
427 | 429 | content = content.replace(new RegExp(('$PACKAGE_NAME').replace('$', '\\$&'), 'g'), '${applicationId}'); |
| 430 | + prefsArray.map((preference: any) => { |
| 431 | + content = content.replace(new RegExp(('$' + preference.$.name).replace('$', '\\$&'), 'g'), preference.$.default); |
| 432 | + }); |
428 | 433 | if (existsSync(manifestPath)) { |
429 | 434 | await writeFileAsync(manifestPath, content); |
430 | 435 | } |
|
0 commit comments