diff --git a/packages/sdk-apple/src/privacyManifestParser.ts b/packages/sdk-apple/src/privacyManifestParser.ts index 69bb856f9..62740575b 100644 --- a/packages/sdk-apple/src/privacyManifestParser.ts +++ b/packages/sdk-apple/src/privacyManifestParser.ts @@ -2,13 +2,14 @@ import path from 'path'; import { getConfigProp, fsWriteFileSync, getAppFolder, doResolve, logError } from '@rnv/core'; import { getAppFolderName } from './common'; -export const parsePrivacyManifest = async () => { - const privacyManifest = getConfigProp('privacyManifests'); +export const parsePrivacyManifest = () => { + return new Promise((resolve) => { + const privacyManifest = getConfigProp('privacyManifests'); - if (privacyManifest) { - const apiTypes = privacyManifest.NSPrivacyAccessedAPITypes; + if (privacyManifest) { + const apiTypes = privacyManifest.NSPrivacyAccessedAPITypes; - const output = ` + const output = ` @@ -35,25 +36,30 @@ export const parsePrivacyManifest = async () => { `; - const appFolder = getAppFolder(); - const appFolderName = getAppFolderName(); + const appFolder = getAppFolder(); + const appFolderName = getAppFolderName(); - const filePath = path.join(appFolder, `${appFolderName}/PrivacyInfo.xcprivacy`); + const filePath = path.join(appFolder, `${appFolderName}/PrivacyInfo.xcprivacy`); + fsWriteFileSync(filePath, output); - fsWriteFileSync(filePath, output); + const xcodePath = doResolve('xcode'); + if (!xcodePath) { + logError(`Cannot resolve xcode path`); + resolve(); + return; + } - const xcodePath = doResolve('xcode'); - if (!xcodePath) { - logError(`Cannot resolve xcode path`); - return; + const xcode = require(xcodePath); + const projectPath = path.join(appFolder, `${appFolderName}.xcodeproj/project.pbxproj`); + const xcodeProj = xcode.project(projectPath); + + xcodeProj.parse(() => { + xcodeProj.addResourceFile(filePath); + fsWriteFileSync(projectPath, xcodeProj.writeSync()); + resolve(); + }); + } else { + resolve(); } - const xcode = require(xcodePath); - const projectPath = path.join(appFolder, `${appFolderName}.xcodeproj/project.pbxproj`); - const xcodeProj = xcode.project(projectPath); - - xcodeProj.parse(() => { - xcodeProj.addResourceFile(filePath); - fsWriteFileSync(projectPath, xcodeProj.writeSync()); - }); - } + }); };