(config: Config)
| 102 | * Update the native project files with the desired app id and app name |
| 103 | */ |
| 104 | export async function editProjectSettingsIOS(config: Config): Promise<void> { |
| 105 | const appId = config.app.appId; |
| 106 | const appName = config.app.appName.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>'); |
| 107 | |
| 108 | const pbxPath = `${config.ios.nativeXcodeProjDirAbs}/project.pbxproj`; |
| 109 | const plistPath = resolve(config.ios.nativeTargetDirAbs, 'Info.plist'); |
| 110 | |
| 111 | let plistContent = await readFile(plistPath, { encoding: 'utf-8' }); |
| 112 | |
| 113 | plistContent = plistContent.replace( |
| 114 | /<key>CFBundleDisplayName<\/key>[\s\S]?\s+<string>([^<]*)<\/string>/, |
| 115 | `<key>CFBundleDisplayName</key>\n <string>${appName}</string>`, |
| 116 | ); |
| 117 | |
| 118 | let pbxContent = await readFile(pbxPath, { encoding: 'utf-8' }); |
| 119 | pbxContent = pbxContent.replace(/PRODUCT_BUNDLE_IDENTIFIER = ([^;]+)/g, `PRODUCT_BUNDLE_IDENTIFIER = ${appId}`); |
| 120 | |
| 121 | await writeFile(plistPath, plistContent, { encoding: 'utf-8' }); |
| 122 | await writeFile(pbxPath, pbxContent, { encoding: 'utf-8' }); |
| 123 | } |
| 124 | |
| 125 | export function getMajoriOSVersion(config: Config): string { |
| 126 | const pbx = readFileSync(join(config.ios.nativeXcodeProjDirAbs, 'project.pbxproj'), 'utf-8'); |
no test coverage detected