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AAS,GAAG,MAAM,CAAC,KAAK,CAAC;IAC/B,MAAM,iBAAiB,SAAG,MAAM,CAAC,QAAQ,0CAAE,KAAK,CAAC;IAEjD,MAAM,YAAY,GAAG,cAAI,CAAC,OAAO,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC;IAEjE,8CAA8C;IAC9C,IAAI,MAAM,kBAAE,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE;QACrC,MAAM,kBAAE,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;KAC/B;IAED,MAAM,sBAAsB,CAAC,cAAc,EAAE,YAAY,EAAE,SAAS,EAAE,iBAAiB,CAAC,CAAC;IACzF,MAAM,cAAc,CAAC,cAAc,EAAE,SAAS,EAAE,iBAAiB,CAAC,CAAC;AACrE,CAAC;AArBD,uCAqBC","sourcesContent":["import fs from 'fs-extra';\nimport path from 'path';\n\nimport { writeContentsJsonFile } from './Contents.json';\n\nconst PNG_FILENAME = 'splashscreen.png';\nconst DARK_PNG_FILENAME = 'dark_splashscreen.png';\n\nconst IMAGESET_PATH = 'Images.xcassets/SplashScreen.imageset';\nconst CONTENTS_PATH = `${IMAGESET_PATH}/Contents.json`;\nconst PNG_PATH = `${IMAGESET_PATH}/${PNG_FILENAME}`;\nconst DARK_PNG_PATH = `${IMAGESET_PATH}/${DARK_PNG_FILENAME}`;\n\nasync function createContentsJsonFile(\n iosProjectPath: string,\n imageSetPath: string,\n imagePath?: string,\n darkModeImagePath?: string\n) {\n if (!imagePath) {\n return;\n }\n\n await fs.mkdirp(imageSetPath);\n await writeContentsJsonFile(\n path.resolve(iosProjectPath, CONTENTS_PATH),\n PNG_FILENAME,\n darkModeImagePath && DARK_PNG_FILENAME\n );\n}\n\nasync function copyImageFiles(\n iosProjectPath: string,\n imagePath?: string,\n darkModeImagePath?: string\n) {\n if (imagePath) {\n await fs.copyFile(imagePath, path.resolve(iosProjectPath, PNG_PATH));\n }\n if (darkModeImagePath) {\n await fs.copyFile(darkModeImagePath, path.resolve(iosProjectPath, DARK_PNG_PATH));\n }\n}\n\n/**\n * Creates imageset containing image for Splash/Launch Screen.\n */\nexport default async function configureImageAssets(\n iosProjectPath: string,\n config: {\n image?: string;\n darkMode?: {\n image?: string;\n };\n } = {}\n) {\n const imagePath = config.image;\n const darkModeImagePath = config.darkMode?.image;\n\n const imageSetPath = path.resolve(iosProjectPath, IMAGESET_PATH);\n\n // ensure old SplashScreen imageSet is removed\n if (await fs.pathExists(imageSetPath)) {\n await fs.remove(imageSetPath);\n }\n\n await createContentsJsonFile(iosProjectPath, imageSetPath, imagePath, darkModeImagePath);\n await copyImageFiles(iosProjectPath, imagePath, darkModeImagePath);\n}\n"]}
|