Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
infoPlistContents,
keys
): Promise {
const plistPath = path.dirname(buildConfigPlistPath);
const plistName = path.basename(buildConfigPlistPath);
if (!(await fs.exists(buildConfigPlistPath))) {
await IosPlist.createBlankAsync(plistPath, plistName);
}
console.log(
'Generating build config %s ...',
chalk.cyan(path.relative(EXPO_DIR, buildConfigPlistPath))
);
const result = await IosPlist.modifyAsync(plistPath, plistName, config => {
if (config.USE_GENERATED_DEFAULTS === false) {
// this flag means don't generate anything, let the user override.
return config;
}
for (const [name, value] of Object.entries(macros)) {
config[name] = value || '';
}
config.EXPO_RUNTIME_VERSION = infoPlistContents.CFBundleVersion
? infoPlistContents.CFBundleVersion
: infoPlistContents.CFBundleShortVersionString;
if (!config.API_SERVER_ENDPOINT) {
config.API_SERVER_ENDPOINT = 'https://exp.host/--/api/v2/';
}
async function generateIOSBuildConstantsFromMacrosAsync(
buildConfigPlistPath,
macros,
buildConfiguration,
infoPlistContents,
keys
) {
const plistPath = path.dirname(buildConfigPlistPath);
const plistName = path.basename(buildConfigPlistPath);
if (!fs.existsSync(buildConfigPlistPath)) {
await IosPlist.createBlankAsync(plistPath, plistName);
}
const result = await IosPlist.modifyAsync(plistPath, plistName, config => {
if (config.USE_GENERATED_DEFAULTS === false) {
// this flag means don't generate anything, let the user override.
return config;
} else {
_.map(macros, (value, name) => {
if (value == null) {
// null == undefined
value = '';
}
config[name] = value;
});
config.EXPO_RUNTIME_VERSION = infoPlistContents.CFBundleVersion
? infoPlistContents.CFBundleVersion
: infoPlistContents.CFBundleShortVersionString;
if (!config.API_SERVER_ENDPOINT) {
config.API_SERVER_ENDPOINT = 'https://exp.host/--/api/v2/';
async function modifyInfoPlistAsync(
infoPlistPath: string,
templateSubstitutions: any
): Promise {
const filename = path.basename(infoPlistPath);
const dir = path.dirname(infoPlistPath);
console.log('Modifying Info.plist at %s ...', chalk.cyan(path.relative(EXPO_DIR, infoPlistPath)));
const result = await IosPlist.modifyAsync(dir, filename, config => {
if (templateSubstitutions.FABRIC_API_KEY) {
config.Fabric = {
APIKey: templateSubstitutions.FABRIC_API_KEY,
Kits: [
{
KitInfo: {},
KitName: 'Crashlytics',
},
],
};
}
return config;
});
return result;
}
const { exp } = await readConfigJsonAsync(projectDir, { skipSDKVersionRequirement: true });
const appName = exp.name!;
const context = await StandaloneContext.createUserContext(projectDir, exp, '');
const supportingDirectory = getInfoPlistDirectory(context);
let infoPlist: AnyPermissions | undefined;
console.log('');
let currentDescriptions: AnyPermissions = {};
let defaultExpoDescriptions: AnyPermissions = {};
if (supportingDirectory) {
console.log(chalk.magenta(`${CHEVRON} Using native ios ${chalk.bold`Info.plist`}`));
infoPlist = (await IosPlist.modifyAsync(
supportingDirectory,
'Info',
infoPlist => infoPlist
)) as AnyPermissions;
for (const key of Object.keys(DefaultiOSPermissionNames)) {
if (key in infoPlist && infoPlist[key]) {
currentDescriptions[key] = infoPlist[key];
} else {
currentDescriptions[key] = '';
}
}
} else {
if ((exp.ios || {}).infoPlist) {
console.log(
chalk.magenta(
async function modifyIOSInfoPlistAsync(path, filename, templateSubstitutions) {
let result = await IosPlist.modifyAsync(path, filename, config => {
if (templateSubstitutions.FABRIC_API_KEY) {
config.Fabric = {
APIKey: templateSubstitutions.FABRIC_API_KEY,
Kits: [
{
KitInfo: {},
KitName: 'Crashlytics',
},
],
};
}
return config;
});
return result;
}