@expo/prebuild-config 8.0.9 → 8.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/plugins/icons/withAndroidIcons.js +1 -1
- package/build/plugins/icons/withAndroidIcons.js.map +1 -1
- package/build/plugins/unversioned/expo-splash-screen/InterfaceBuilder.d.ts +3 -2
- package/build/plugins/unversioned/expo-splash-screen/InterfaceBuilder.js +11 -8
- package/build/plugins/unversioned/expo-splash-screen/InterfaceBuilder.js.map +1 -1
- package/build/plugins/unversioned/expo-splash-screen/getAndroidSplashConfig.d.ts +10 -10
- package/build/plugins/unversioned/expo-splash-screen/getAndroidSplashConfig.js +37 -33
- package/build/plugins/unversioned/expo-splash-screen/getAndroidSplashConfig.js.map +1 -1
- package/build/plugins/unversioned/expo-splash-screen/getIosSplashConfig.d.ts +10 -9
- package/build/plugins/unversioned/expo-splash-screen/getIosSplashConfig.js +33 -17
- package/build/plugins/unversioned/expo-splash-screen/getIosSplashConfig.js.map +1 -1
- package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashImages.d.ts +2 -2
- package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashImages.js +5 -5
- package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashImages.js.map +1 -1
- package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashStyles.js +2 -2
- package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashStyles.js.map +1 -1
- package/build/plugins/unversioned/expo-splash-screen/withIosSplashAssets.js +11 -8
- package/build/plugins/unversioned/expo-splash-screen/withIosSplashAssets.js.map +1 -1
- package/build/plugins/unversioned/expo-splash-screen/withIosSplashScreen.js +5 -12
- package/build/plugins/unversioned/expo-splash-screen/withIosSplashScreen.js.map +1 -1
- package/build/plugins/unversioned/expo-splash-screen/withIosSplashScreenStoryboard.js +4 -0
- package/build/plugins/unversioned/expo-splash-screen/withIosSplashScreenStoryboard.js.map +1 -1
- package/build/plugins/unversioned/expo-splash-screen/withIosSplashScreenStoryboardImage.js +2 -1
- package/build/plugins/unversioned/expo-splash-screen/withIosSplashScreenStoryboardImage.js.map +1 -1
- package/package.json +2 -2
|
@@ -364,7 +364,7 @@ async function generateIconAsync(projectRoot, {
|
|
|
364
364
|
resizeMode: 'cover',
|
|
365
365
|
borderRadius: borderRadiusRatio ? bgIconSizePx * borderRadiusRatio : undefined
|
|
366
366
|
});
|
|
367
|
-
const x = (bgIconSizePx - iconSizePx) / 2;
|
|
367
|
+
const x = Math.round((bgIconSizePx - iconSizePx) / 2);
|
|
368
368
|
const y = x;
|
|
369
369
|
return (0, _imageUtils().compositeImagesAsync)({
|
|
370
370
|
background,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withAndroidIcons.js","names":["_configPlugins","data","require","_imageUtils","_fsExtra","_interopRequireDefault","_path","_withAndroidManifestIcons","e","__esModule","default","Colors","AndroidConfig","dpiValues","exports","mdpi","folderName","scale","hdpi","xhdpi","xxhdpi","xxxhdpi","ICON_BASELINE_PIXEL_SIZE","FOREGROUND_BASELINE_PIXEL_SIZE","ANDROID_RES_PATH","MIPMAP_ANYDPI_V26","ICON_BACKGROUND","IC_LAUNCHER_WEBP","IC_LAUNCHER_ROUND_WEBP","IC_LAUNCHER_BACKGROUND_WEBP","IC_LAUNCHER_FOREGROUND_WEBP","IC_LAUNCHER_MONOCHROME_WEBP","IC_LAUNCHER_XML","IC_LAUNCHER_ROUND_XML","withAndroidIcons","config","foregroundImage","backgroundColor","backgroundImage","monochromeImage","getAdaptiveIcon","icon","getIcon","withAndroidManifestIcons","withAndroidAdaptiveIconColors","withDangerousMod","setIconAsync","modRequest","projectRoot","isAdaptive","android","adaptiveIcon","setRoundIconManifest","manifest","application","Manifest","getMainApplicationOrThrow","$","withAndroidColors","modResults","setBackgroundColor","configureLegacyIconAsync","generateRoundIconAsync","deleteIconNamedAsync","configureAdaptiveIconAsync","generateMultiLayerImageAsync","outputImageFileName","imageCacheFolder","backgroundImageCacheFolder","borderRadiusRatio","generateMonochromeImageAsync","backgroundImageFileName","icLauncherXmlString","createAdaptiveIconXmlString","createAdaptiveIconXmlFiles","colors","assignColorValue","value","name","background","iconElements","push","join","add","anyDpiV26Directory","path","resolve","fs","ensureDir","launcherPath","launcherRoundPath","Promise","all","writeFile","map","existsSync","remove","iterateDpiValues","dpiFolder","iconLayer","generateIconAsync","cacheType","src","imageStlye","getImageStyle","backgroundLayer","compositeImagesAsync","foreground","monochromeIcon","callback","Object","values","isForegound","baseline","bgIconSizePx","Math","round","iconSizePx","getImageScale","source","generateImageAsync","resizeMode","width","height","generateImageBackgroundAsync","borderRadius","undefined","x","y","outputFileName","imageStyle"],"sources":["../../../src/plugins/icons/withAndroidIcons.ts"],"sourcesContent":["import {\n AndroidConfig,\n ConfigPlugin,\n withAndroidColors,\n withDangerousMod,\n} from '@expo/config-plugins';\nimport { ResourceXML } from '@expo/config-plugins/build/android/Resources';\nimport { ExpoConfig } from '@expo/config-types';\nimport {\n generateImageAsync,\n compositeImagesAsync,\n generateImageBackgroundAsync,\n} from '@expo/image-utils';\nimport fs from 'fs-extra';\nimport path from 'path';\n\nimport { withAndroidManifestIcons } from './withAndroidManifestIcons';\n\nconst { Colors } = AndroidConfig;\n\ntype DPIString = 'mdpi' | 'hdpi' | 'xhdpi' | 'xxhdpi' | 'xxxhdpi';\ntype dpiMap = Record<DPIString, { folderName: string; scale: number }>;\ntype ImageStyle = 'foreground' | 'background' | 'rounded' | 'monochrome' | 'legacy';\n\nexport const dpiValues: dpiMap = {\n mdpi: { folderName: 'mipmap-mdpi', scale: 1 },\n hdpi: { folderName: 'mipmap-hdpi', scale: 1.5 },\n xhdpi: { folderName: 'mipmap-xhdpi', scale: 2 },\n xxhdpi: { folderName: 'mipmap-xxhdpi', scale: 3 },\n xxxhdpi: { folderName: 'mipmap-xxxhdpi', scale: 4 },\n};\nconst ICON_BASELINE_PIXEL_SIZE = 48;\nconst FOREGROUND_BASELINE_PIXEL_SIZE = 108;\n\nexport const ANDROID_RES_PATH = 'android/app/src/main/res/';\nconst MIPMAP_ANYDPI_V26 = 'mipmap-anydpi-v26';\nconst ICON_BACKGROUND = 'iconBackground';\nconst IC_LAUNCHER_WEBP = 'ic_launcher.webp';\nconst IC_LAUNCHER_ROUND_WEBP = 'ic_launcher_round.webp';\nconst IC_LAUNCHER_BACKGROUND_WEBP = 'ic_launcher_background.webp';\nconst IC_LAUNCHER_FOREGROUND_WEBP = 'ic_launcher_foreground.webp';\nconst IC_LAUNCHER_MONOCHROME_WEBP = 'ic_launcher_monochrome.webp';\nconst IC_LAUNCHER_XML = 'ic_launcher.xml';\nconst IC_LAUNCHER_ROUND_XML = 'ic_launcher_round.xml';\n\nexport const withAndroidIcons: ConfigPlugin = (config) => {\n const { foregroundImage, backgroundColor, backgroundImage, monochromeImage } =\n getAdaptiveIcon(config);\n const icon = foregroundImage ?? getIcon(config);\n\n if (!icon) {\n return config;\n }\n\n config = withAndroidManifestIcons(config);\n // Apply colors.xml changes\n config = withAndroidAdaptiveIconColors(config, backgroundColor);\n return withDangerousMod(config, [\n 'android',\n async (config) => {\n await setIconAsync(config.modRequest.projectRoot, {\n icon,\n backgroundColor,\n backgroundImage,\n monochromeImage,\n isAdaptive: !!config.android?.adaptiveIcon,\n });\n return config;\n },\n ]);\n};\n\nexport function setRoundIconManifest(\n config: Pick<ExpoConfig, 'android'>,\n manifest: AndroidConfig.Manifest.AndroidManifest\n): AndroidConfig.Manifest.AndroidManifest {\n const isAdaptive = !!config.android?.adaptiveIcon;\n const application = AndroidConfig.Manifest.getMainApplicationOrThrow(manifest);\n\n if (isAdaptive) {\n application.$['android:roundIcon'] = '@mipmap/ic_launcher_round';\n } else {\n delete application.$['android:roundIcon'];\n }\n return manifest;\n}\n\nconst withAndroidAdaptiveIconColors: ConfigPlugin<string | null> = (config, backgroundColor) => {\n return withAndroidColors(config, (config) => {\n config.modResults = setBackgroundColor(backgroundColor ?? '#ffffff', config.modResults);\n return config;\n });\n};\n\nexport function getIcon(config: ExpoConfig) {\n return config.android?.icon || config.icon || null;\n}\n\nexport function getAdaptiveIcon(config: ExpoConfig) {\n return {\n foregroundImage: config.android?.adaptiveIcon?.foregroundImage ?? null,\n backgroundColor: config.android?.adaptiveIcon?.backgroundColor ?? null,\n backgroundImage: config.android?.adaptiveIcon?.backgroundImage ?? null,\n monochromeImage: config.android?.adaptiveIcon?.monochromeImage ?? null,\n };\n}\n\n/**\n * Resizes the user-provided icon to create a set of legacy icon files in\n * their respective \"mipmap\" directories for <= Android 7, and creates a set of adaptive\n * icon files for > Android 7 from the adaptive icon files (if provided).\n */\nexport async function setIconAsync(\n projectRoot: string,\n {\n icon,\n backgroundColor,\n backgroundImage,\n monochromeImage,\n isAdaptive,\n }: {\n icon: string | null;\n backgroundColor: string | null;\n backgroundImage: string | null;\n monochromeImage: string | null;\n isAdaptive: boolean;\n }\n) {\n if (!icon) {\n return null;\n }\n\n await configureLegacyIconAsync(projectRoot, icon, backgroundImage, backgroundColor);\n if (isAdaptive) {\n await generateRoundIconAsync(projectRoot, icon, backgroundImage, backgroundColor);\n } else {\n await deleteIconNamedAsync(projectRoot, IC_LAUNCHER_ROUND_WEBP);\n }\n await configureAdaptiveIconAsync(\n projectRoot,\n icon,\n backgroundImage,\n backgroundColor,\n monochromeImage,\n isAdaptive\n );\n\n return true;\n}\n\n/**\n * Configures legacy icon files to be used on Android 7 and earlier. If adaptive icon configuration\n * was provided, we create a pseudo-adaptive icon by layering the provided files (or background\n * color if no backgroundImage is provided. If no backgroundImage and no backgroundColor are provided,\n * the background is set to transparent.)\n */\nasync function configureLegacyIconAsync(\n projectRoot: string,\n icon: string,\n backgroundImage: string | null,\n backgroundColor: string | null\n) {\n return generateMultiLayerImageAsync(projectRoot, {\n icon,\n backgroundImage,\n backgroundColor,\n outputImageFileName: IC_LAUNCHER_WEBP,\n imageCacheFolder: 'android-standard-square',\n backgroundImageCacheFolder: 'android-standard-square-background',\n });\n}\n\nasync function generateRoundIconAsync(\n projectRoot: string,\n icon: string,\n backgroundImage: string | null,\n backgroundColor: string | null\n) {\n return generateMultiLayerImageAsync(projectRoot, {\n icon,\n borderRadiusRatio: 0.5,\n outputImageFileName: IC_LAUNCHER_ROUND_WEBP,\n backgroundImage,\n backgroundColor,\n imageCacheFolder: 'android-standard-circle',\n backgroundImageCacheFolder: 'android-standard-round-background',\n });\n}\n\n/**\n * Configures adaptive icon files to be used on Android 8 and up. A foreground image must be provided,\n * and will have a transparent background unless:\n * - A backgroundImage is provided, or\n * - A backgroundColor was specified\n */\nexport async function configureAdaptiveIconAsync(\n projectRoot: string,\n foregroundImage: string,\n backgroundImage: string | null,\n backgroundColor: string | null,\n monochromeImage: string | null,\n isAdaptive: boolean\n) {\n if (monochromeImage) {\n await generateMonochromeImageAsync(projectRoot, {\n icon: monochromeImage,\n imageCacheFolder: 'android-adaptive-monochrome',\n outputImageFileName: IC_LAUNCHER_MONOCHROME_WEBP,\n });\n }\n await generateMultiLayerImageAsync(projectRoot, {\n backgroundColor,\n backgroundImage,\n backgroundImageCacheFolder: 'android-adaptive-background',\n outputImageFileName: IC_LAUNCHER_FOREGROUND_WEBP,\n icon: foregroundImage,\n imageCacheFolder: 'android-adaptive-foreground',\n backgroundImageFileName: IC_LAUNCHER_BACKGROUND_WEBP,\n });\n\n // create ic_launcher.xml and ic_launcher_round.xml\n const icLauncherXmlString = createAdaptiveIconXmlString(backgroundImage, monochromeImage);\n await createAdaptiveIconXmlFiles(\n projectRoot,\n icLauncherXmlString,\n // If the user only defined icon and not android.adaptiveIcon, then skip enabling the layering system\n // this will scale the image down and present it uncropped.\n isAdaptive\n );\n}\n\nfunction setBackgroundColor(backgroundColor: string | null, colors: ResourceXML) {\n return Colors.assignColorValue(colors, {\n value: backgroundColor,\n name: ICON_BACKGROUND,\n });\n}\n\nexport const createAdaptiveIconXmlString = (\n backgroundImage: string | null,\n monochromeImage: string | null\n) => {\n const background = backgroundImage ? `@drawable/ic_launcher_background` : `@color/iconBackground`;\n\n const iconElements: string[] = [\n `<background android:drawable=\"${background}\"/>`,\n '<foreground android:drawable=\"@mipmap/ic_launcher_foreground\"/>',\n ];\n\n if (monochromeImage) {\n iconElements.push('<monochrome android:drawable=\"@mipmap/ic_launcher_monochrome\"/>');\n }\n\n return `<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<adaptive-icon xmlns:android=\"http://schemas.android.com/apk/res/android\">\n ${iconElements.join('\\n ')}\n</adaptive-icon>`;\n};\n\nasync function createAdaptiveIconXmlFiles(\n projectRoot: string,\n icLauncherXmlString: string,\n add: boolean\n) {\n const anyDpiV26Directory = path.resolve(projectRoot, ANDROID_RES_PATH, MIPMAP_ANYDPI_V26);\n await fs.ensureDir(anyDpiV26Directory);\n const launcherPath = path.resolve(anyDpiV26Directory, IC_LAUNCHER_XML);\n const launcherRoundPath = path.resolve(anyDpiV26Directory, IC_LAUNCHER_ROUND_XML);\n if (add) {\n await Promise.all([\n fs.writeFile(launcherPath, icLauncherXmlString),\n fs.writeFile(launcherRoundPath, icLauncherXmlString),\n ]);\n } else {\n // Remove the xml if the icon switches from adaptive to standard.\n await Promise.all(\n [launcherPath, launcherRoundPath].map(async (path) => {\n if (fs.existsSync(path)) {\n return fs.remove(path);\n }\n })\n );\n }\n}\n\nasync function generateMultiLayerImageAsync(\n projectRoot: string,\n {\n icon,\n backgroundColor,\n backgroundImage,\n imageCacheFolder,\n backgroundImageCacheFolder,\n borderRadiusRatio,\n outputImageFileName,\n backgroundImageFileName,\n }: {\n icon: string;\n backgroundImage: string | null;\n backgroundColor: string | null;\n imageCacheFolder: string;\n backgroundImageCacheFolder: string;\n backgroundImageFileName?: string;\n borderRadiusRatio?: number;\n outputImageFileName: string;\n }\n) {\n await iterateDpiValues(projectRoot, async ({ dpiFolder, scale }) => {\n let iconLayer = await generateIconAsync(projectRoot, {\n cacheType: imageCacheFolder,\n src: icon,\n scale,\n backgroundColor: backgroundColor ?? 'transparent',\n borderRadiusRatio,\n imageStlye: getImageStyle(outputImageFileName),\n });\n\n if (backgroundImage) {\n const backgroundLayer = await generateIconAsync(projectRoot, {\n cacheType: backgroundImageCacheFolder,\n src: backgroundImage,\n scale,\n backgroundColor: backgroundColor ?? 'transparent',\n borderRadiusRatio,\n });\n\n if (backgroundImageFileName) {\n await fs.writeFile(path.resolve(dpiFolder, backgroundImageFileName), backgroundLayer);\n } else {\n iconLayer = await compositeImagesAsync({\n foreground: iconLayer,\n background: backgroundLayer,\n });\n }\n } else if (backgroundImageFileName) {\n // Remove any instances of ic_launcher_background.png that are there from previous icons\n await deleteIconNamedAsync(projectRoot, backgroundImageFileName);\n }\n\n await fs.ensureDir(dpiFolder);\n await fs.writeFile(path.resolve(dpiFolder, outputImageFileName), iconLayer);\n });\n}\n\nasync function generateMonochromeImageAsync(\n projectRoot: string,\n {\n icon,\n imageCacheFolder,\n outputImageFileName,\n }: { icon: string; imageCacheFolder: string; outputImageFileName: string }\n) {\n await iterateDpiValues(projectRoot, async ({ dpiFolder, scale }) => {\n const monochromeIcon = await generateIconAsync(projectRoot, {\n cacheType: imageCacheFolder,\n src: icon,\n scale,\n backgroundColor: 'transparent',\n });\n await fs.ensureDir(dpiFolder);\n await fs.writeFile(path.resolve(dpiFolder, outputImageFileName), monochromeIcon);\n });\n}\n\nfunction iterateDpiValues(\n projectRoot: string,\n callback: (value: { dpiFolder: string; folderName: string; scale: number }) => Promise<void>\n) {\n return Promise.all(\n Object.values(dpiValues).map((value) =>\n callback({\n dpiFolder: path.resolve(projectRoot, ANDROID_RES_PATH, value.folderName),\n ...value,\n })\n )\n );\n}\n\nasync function deleteIconNamedAsync(projectRoot: string, name: string) {\n return iterateDpiValues(projectRoot, ({ dpiFolder }) => {\n return fs.remove(path.resolve(dpiFolder, name));\n });\n}\n\nasync function generateIconAsync(\n projectRoot: string,\n {\n cacheType,\n src,\n scale,\n backgroundColor,\n borderRadiusRatio,\n imageStlye,\n }: {\n cacheType: string;\n src: string;\n scale: number;\n backgroundColor: string;\n borderRadiusRatio?: number;\n imageStlye?: ImageStyle;\n }\n) {\n const isForegound = imageStlye === 'foreground';\n const baseline = isForegound ? FOREGROUND_BASELINE_PIXEL_SIZE : ICON_BASELINE_PIXEL_SIZE;\n const bgIconSizePx = Math.round(baseline * scale);\n const iconSizePx = Math.round(bgIconSizePx * getImageScale(imageStlye ?? 'background'));\n\n const { source: foreground } = await generateImageAsync(\n { projectRoot, cacheType },\n {\n src,\n resizeMode: 'cover',\n width: iconSizePx,\n height: iconSizePx,\n }\n );\n\n const background = await generateImageBackgroundAsync({\n width: bgIconSizePx,\n height: bgIconSizePx,\n backgroundColor: isForegound ? 'transparent' : backgroundColor,\n resizeMode: 'cover',\n borderRadius: borderRadiusRatio ? bgIconSizePx * borderRadiusRatio : undefined,\n });\n\n const x = (bgIconSizePx - iconSizePx) / 2;\n const y = x;\n\n return compositeImagesAsync({ background, foreground, x, y });\n}\n\nfunction getImageStyle(outputFileName: string): ImageStyle {\n switch (outputFileName) {\n case IC_LAUNCHER_WEBP:\n return 'legacy';\n case IC_LAUNCHER_BACKGROUND_WEBP:\n return 'background';\n case IC_LAUNCHER_FOREGROUND_WEBP:\n return 'foreground';\n case IC_LAUNCHER_ROUND_WEBP:\n return 'rounded';\n case IC_LAUNCHER_MONOCHROME_WEBP:\n return 'monochrome';\n }\n\n return 'background';\n}\n\nfunction getImageScale(imageStyle: ImageStyle) {\n switch (imageStyle) {\n case 'legacy':\n case 'rounded':\n return 0.9;\n case 'foreground':\n case 'background':\n return 0.7;\n case 'monochrome':\n return 1;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAQA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAKA,SAAAG,SAAA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EACV,CACF,CAAC;EAED,MAAMtC,UAAU,GAAG,MAAM,IAAA6C,0CAA4B,EAAC;IACpDF,KAAK,EAAER,YAAY;IACnBS,MAAM,EAAET,YAAY;IACpB7E,eAAe,EAAE2E,WAAW,GAAG,aAAa,GAAG3E,eAAe;IAC9DoF,UAAU,EAAE,OAAO;IACnBI,YAAY,EAAExD,iBAAiB,GAAG6C,YAAY,GAAG7C,iBAAiB,GAAGyD;EACvE,CAAC,CAAC;EAEF,MAAMC,CAAC,GAAG,CAACb,YAAY,GAAGG,UAAU,IAAI,CAAC;EACzC,MAAMW,CAAC,GAAGD,CAAC;EAEX,OAAO,IAAArB,kCAAoB,EAAC;IAAE3B,UAAU;IAAE4B,UAAU;IAAEoB,CAAC;IAAEC;EAAE,CAAC,CAAC;AAC/D;AAEA,SAASxB,aAAaA,CAACyB,cAAsB,EAAc;EACzD,QAAQA,cAAc;IACpB,KAAKtG,gBAAgB;MACnB,OAAO,QAAQ;IACjB,KAAKE,2BAA2B;MAC9B,OAAO,YAAY;IACrB,KAAKC,2BAA2B;MAC9B,OAAO,YAAY;IACrB,KAAKF,sBAAsB;MACzB,OAAO,SAAS;IAClB,KAAKG,2BAA2B;MAC9B,OAAO,YAAY;EACvB;EAEA,OAAO,YAAY;AACrB;AAEA,SAASuF,aAAaA,CAACY,UAAsB,EAAE;EAC7C,QAAQA,UAAU;IAChB,KAAK,QAAQ;IACb,KAAK,SAAS;MACZ,OAAO,GAAG;IACZ,KAAK,YAAY;IACjB,KAAK,YAAY;MACf,OAAO,GAAG;IACZ,KAAK,YAAY;MACf,OAAO,CAAC;EACZ;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"withAndroidIcons.js","names":["_configPlugins","data","require","_imageUtils","_fsExtra","_interopRequireDefault","_path","_withAndroidManifestIcons","e","__esModule","default","Colors","AndroidConfig","dpiValues","exports","mdpi","folderName","scale","hdpi","xhdpi","xxhdpi","xxxhdpi","ICON_BASELINE_PIXEL_SIZE","FOREGROUND_BASELINE_PIXEL_SIZE","ANDROID_RES_PATH","MIPMAP_ANYDPI_V26","ICON_BACKGROUND","IC_LAUNCHER_WEBP","IC_LAUNCHER_ROUND_WEBP","IC_LAUNCHER_BACKGROUND_WEBP","IC_LAUNCHER_FOREGROUND_WEBP","IC_LAUNCHER_MONOCHROME_WEBP","IC_LAUNCHER_XML","IC_LAUNCHER_ROUND_XML","withAndroidIcons","config","foregroundImage","backgroundColor","backgroundImage","monochromeImage","getAdaptiveIcon","icon","getIcon","withAndroidManifestIcons","withAndroidAdaptiveIconColors","withDangerousMod","setIconAsync","modRequest","projectRoot","isAdaptive","android","adaptiveIcon","setRoundIconManifest","manifest","application","Manifest","getMainApplicationOrThrow","$","withAndroidColors","modResults","setBackgroundColor","configureLegacyIconAsync","generateRoundIconAsync","deleteIconNamedAsync","configureAdaptiveIconAsync","generateMultiLayerImageAsync","outputImageFileName","imageCacheFolder","backgroundImageCacheFolder","borderRadiusRatio","generateMonochromeImageAsync","backgroundImageFileName","icLauncherXmlString","createAdaptiveIconXmlString","createAdaptiveIconXmlFiles","colors","assignColorValue","value","name","background","iconElements","push","join","add","anyDpiV26Directory","path","resolve","fs","ensureDir","launcherPath","launcherRoundPath","Promise","all","writeFile","map","existsSync","remove","iterateDpiValues","dpiFolder","iconLayer","generateIconAsync","cacheType","src","imageStlye","getImageStyle","backgroundLayer","compositeImagesAsync","foreground","monochromeIcon","callback","Object","values","isForegound","baseline","bgIconSizePx","Math","round","iconSizePx","getImageScale","source","generateImageAsync","resizeMode","width","height","generateImageBackgroundAsync","borderRadius","undefined","x","y","outputFileName","imageStyle"],"sources":["../../../src/plugins/icons/withAndroidIcons.ts"],"sourcesContent":["import {\n AndroidConfig,\n ConfigPlugin,\n withAndroidColors,\n withDangerousMod,\n} from '@expo/config-plugins';\nimport { ResourceXML } from '@expo/config-plugins/build/android/Resources';\nimport { ExpoConfig } from '@expo/config-types';\nimport {\n generateImageAsync,\n compositeImagesAsync,\n generateImageBackgroundAsync,\n} from '@expo/image-utils';\nimport fs from 'fs-extra';\nimport path from 'path';\n\nimport { withAndroidManifestIcons } from './withAndroidManifestIcons';\n\nconst { Colors } = AndroidConfig;\n\ntype DPIString = 'mdpi' | 'hdpi' | 'xhdpi' | 'xxhdpi' | 'xxxhdpi';\ntype dpiMap = Record<DPIString, { folderName: string; scale: number }>;\ntype ImageStyle = 'foreground' | 'background' | 'rounded' | 'monochrome' | 'legacy';\n\nexport const dpiValues: dpiMap = {\n mdpi: { folderName: 'mipmap-mdpi', scale: 1 },\n hdpi: { folderName: 'mipmap-hdpi', scale: 1.5 },\n xhdpi: { folderName: 'mipmap-xhdpi', scale: 2 },\n xxhdpi: { folderName: 'mipmap-xxhdpi', scale: 3 },\n xxxhdpi: { folderName: 'mipmap-xxxhdpi', scale: 4 },\n};\nconst ICON_BASELINE_PIXEL_SIZE = 48;\nconst FOREGROUND_BASELINE_PIXEL_SIZE = 108;\n\nexport const ANDROID_RES_PATH = 'android/app/src/main/res/';\nconst MIPMAP_ANYDPI_V26 = 'mipmap-anydpi-v26';\nconst ICON_BACKGROUND = 'iconBackground';\nconst IC_LAUNCHER_WEBP = 'ic_launcher.webp';\nconst IC_LAUNCHER_ROUND_WEBP = 'ic_launcher_round.webp';\nconst IC_LAUNCHER_BACKGROUND_WEBP = 'ic_launcher_background.webp';\nconst IC_LAUNCHER_FOREGROUND_WEBP = 'ic_launcher_foreground.webp';\nconst IC_LAUNCHER_MONOCHROME_WEBP = 'ic_launcher_monochrome.webp';\nconst IC_LAUNCHER_XML = 'ic_launcher.xml';\nconst IC_LAUNCHER_ROUND_XML = 'ic_launcher_round.xml';\n\nexport const withAndroidIcons: ConfigPlugin = (config) => {\n const { foregroundImage, backgroundColor, backgroundImage, monochromeImage } =\n getAdaptiveIcon(config);\n const icon = foregroundImage ?? getIcon(config);\n\n if (!icon) {\n return config;\n }\n\n config = withAndroidManifestIcons(config);\n // Apply colors.xml changes\n config = withAndroidAdaptiveIconColors(config, backgroundColor);\n return withDangerousMod(config, [\n 'android',\n async (config) => {\n await setIconAsync(config.modRequest.projectRoot, {\n icon,\n backgroundColor,\n backgroundImage,\n monochromeImage,\n isAdaptive: !!config.android?.adaptiveIcon,\n });\n return config;\n },\n ]);\n};\n\nexport function setRoundIconManifest(\n config: Pick<ExpoConfig, 'android'>,\n manifest: AndroidConfig.Manifest.AndroidManifest\n): AndroidConfig.Manifest.AndroidManifest {\n const isAdaptive = !!config.android?.adaptiveIcon;\n const application = AndroidConfig.Manifest.getMainApplicationOrThrow(manifest);\n\n if (isAdaptive) {\n application.$['android:roundIcon'] = '@mipmap/ic_launcher_round';\n } else {\n delete application.$['android:roundIcon'];\n }\n return manifest;\n}\n\nconst withAndroidAdaptiveIconColors: ConfigPlugin<string | null> = (config, backgroundColor) => {\n return withAndroidColors(config, (config) => {\n config.modResults = setBackgroundColor(backgroundColor ?? '#ffffff', config.modResults);\n return config;\n });\n};\n\nexport function getIcon(config: ExpoConfig) {\n return config.android?.icon || config.icon || null;\n}\n\nexport function getAdaptiveIcon(config: ExpoConfig) {\n return {\n foregroundImage: config.android?.adaptiveIcon?.foregroundImage ?? null,\n backgroundColor: config.android?.adaptiveIcon?.backgroundColor ?? null,\n backgroundImage: config.android?.adaptiveIcon?.backgroundImage ?? null,\n monochromeImage: config.android?.adaptiveIcon?.monochromeImage ?? null,\n };\n}\n\n/**\n * Resizes the user-provided icon to create a set of legacy icon files in\n * their respective \"mipmap\" directories for <= Android 7, and creates a set of adaptive\n * icon files for > Android 7 from the adaptive icon files (if provided).\n */\nexport async function setIconAsync(\n projectRoot: string,\n {\n icon,\n backgroundColor,\n backgroundImage,\n monochromeImage,\n isAdaptive,\n }: {\n icon: string | null;\n backgroundColor: string | null;\n backgroundImage: string | null;\n monochromeImage: string | null;\n isAdaptive: boolean;\n }\n) {\n if (!icon) {\n return null;\n }\n\n await configureLegacyIconAsync(projectRoot, icon, backgroundImage, backgroundColor);\n if (isAdaptive) {\n await generateRoundIconAsync(projectRoot, icon, backgroundImage, backgroundColor);\n } else {\n await deleteIconNamedAsync(projectRoot, IC_LAUNCHER_ROUND_WEBP);\n }\n await configureAdaptiveIconAsync(\n projectRoot,\n icon,\n backgroundImage,\n backgroundColor,\n monochromeImage,\n isAdaptive\n );\n\n return true;\n}\n\n/**\n * Configures legacy icon files to be used on Android 7 and earlier. If adaptive icon configuration\n * was provided, we create a pseudo-adaptive icon by layering the provided files (or background\n * color if no backgroundImage is provided. If no backgroundImage and no backgroundColor are provided,\n * the background is set to transparent.)\n */\nasync function configureLegacyIconAsync(\n projectRoot: string,\n icon: string,\n backgroundImage: string | null,\n backgroundColor: string | null\n) {\n return generateMultiLayerImageAsync(projectRoot, {\n icon,\n backgroundImage,\n backgroundColor,\n outputImageFileName: IC_LAUNCHER_WEBP,\n imageCacheFolder: 'android-standard-square',\n backgroundImageCacheFolder: 'android-standard-square-background',\n });\n}\n\nasync function generateRoundIconAsync(\n projectRoot: string,\n icon: string,\n backgroundImage: string | null,\n backgroundColor: string | null\n) {\n return generateMultiLayerImageAsync(projectRoot, {\n icon,\n borderRadiusRatio: 0.5,\n outputImageFileName: IC_LAUNCHER_ROUND_WEBP,\n backgroundImage,\n backgroundColor,\n imageCacheFolder: 'android-standard-circle',\n backgroundImageCacheFolder: 'android-standard-round-background',\n });\n}\n\n/**\n * Configures adaptive icon files to be used on Android 8 and up. A foreground image must be provided,\n * and will have a transparent background unless:\n * - A backgroundImage is provided, or\n * - A backgroundColor was specified\n */\nexport async function configureAdaptiveIconAsync(\n projectRoot: string,\n foregroundImage: string,\n backgroundImage: string | null,\n backgroundColor: string | null,\n monochromeImage: string | null,\n isAdaptive: boolean\n) {\n if (monochromeImage) {\n await generateMonochromeImageAsync(projectRoot, {\n icon: monochromeImage,\n imageCacheFolder: 'android-adaptive-monochrome',\n outputImageFileName: IC_LAUNCHER_MONOCHROME_WEBP,\n });\n }\n await generateMultiLayerImageAsync(projectRoot, {\n backgroundColor,\n backgroundImage,\n backgroundImageCacheFolder: 'android-adaptive-background',\n outputImageFileName: IC_LAUNCHER_FOREGROUND_WEBP,\n icon: foregroundImage,\n imageCacheFolder: 'android-adaptive-foreground',\n backgroundImageFileName: IC_LAUNCHER_BACKGROUND_WEBP,\n });\n\n // create ic_launcher.xml and ic_launcher_round.xml\n const icLauncherXmlString = createAdaptiveIconXmlString(backgroundImage, monochromeImage);\n await createAdaptiveIconXmlFiles(\n projectRoot,\n icLauncherXmlString,\n // If the user only defined icon and not android.adaptiveIcon, then skip enabling the layering system\n // this will scale the image down and present it uncropped.\n isAdaptive\n );\n}\n\nfunction setBackgroundColor(backgroundColor: string | null, colors: ResourceXML) {\n return Colors.assignColorValue(colors, {\n value: backgroundColor,\n name: ICON_BACKGROUND,\n });\n}\n\nexport const createAdaptiveIconXmlString = (\n backgroundImage: string | null,\n monochromeImage: string | null\n) => {\n const background = backgroundImage ? `@drawable/ic_launcher_background` : `@color/iconBackground`;\n\n const iconElements: string[] = [\n `<background android:drawable=\"${background}\"/>`,\n '<foreground android:drawable=\"@mipmap/ic_launcher_foreground\"/>',\n ];\n\n if (monochromeImage) {\n iconElements.push('<monochrome android:drawable=\"@mipmap/ic_launcher_monochrome\"/>');\n }\n\n return `<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<adaptive-icon xmlns:android=\"http://schemas.android.com/apk/res/android\">\n ${iconElements.join('\\n ')}\n</adaptive-icon>`;\n};\n\nasync function createAdaptiveIconXmlFiles(\n projectRoot: string,\n icLauncherXmlString: string,\n add: boolean\n) {\n const anyDpiV26Directory = path.resolve(projectRoot, ANDROID_RES_PATH, MIPMAP_ANYDPI_V26);\n await fs.ensureDir(anyDpiV26Directory);\n const launcherPath = path.resolve(anyDpiV26Directory, IC_LAUNCHER_XML);\n const launcherRoundPath = path.resolve(anyDpiV26Directory, IC_LAUNCHER_ROUND_XML);\n if (add) {\n await Promise.all([\n fs.writeFile(launcherPath, icLauncherXmlString),\n fs.writeFile(launcherRoundPath, icLauncherXmlString),\n ]);\n } else {\n // Remove the xml if the icon switches from adaptive to standard.\n await Promise.all(\n [launcherPath, launcherRoundPath].map(async (path) => {\n if (fs.existsSync(path)) {\n return fs.remove(path);\n }\n })\n );\n }\n}\n\nasync function generateMultiLayerImageAsync(\n projectRoot: string,\n {\n icon,\n backgroundColor,\n backgroundImage,\n imageCacheFolder,\n backgroundImageCacheFolder,\n borderRadiusRatio,\n outputImageFileName,\n backgroundImageFileName,\n }: {\n icon: string;\n backgroundImage: string | null;\n backgroundColor: string | null;\n imageCacheFolder: string;\n backgroundImageCacheFolder: string;\n backgroundImageFileName?: string;\n borderRadiusRatio?: number;\n outputImageFileName: string;\n }\n) {\n await iterateDpiValues(projectRoot, async ({ dpiFolder, scale }) => {\n let iconLayer = await generateIconAsync(projectRoot, {\n cacheType: imageCacheFolder,\n src: icon,\n scale,\n backgroundColor: backgroundColor ?? 'transparent',\n borderRadiusRatio,\n imageStlye: getImageStyle(outputImageFileName),\n });\n\n if (backgroundImage) {\n const backgroundLayer = await generateIconAsync(projectRoot, {\n cacheType: backgroundImageCacheFolder,\n src: backgroundImage,\n scale,\n backgroundColor: backgroundColor ?? 'transparent',\n borderRadiusRatio,\n });\n\n if (backgroundImageFileName) {\n await fs.writeFile(path.resolve(dpiFolder, backgroundImageFileName), backgroundLayer);\n } else {\n iconLayer = await compositeImagesAsync({\n foreground: iconLayer,\n background: backgroundLayer,\n });\n }\n } else if (backgroundImageFileName) {\n // Remove any instances of ic_launcher_background.png that are there from previous icons\n await deleteIconNamedAsync(projectRoot, backgroundImageFileName);\n }\n\n await fs.ensureDir(dpiFolder);\n await fs.writeFile(path.resolve(dpiFolder, outputImageFileName), iconLayer);\n });\n}\n\nasync function generateMonochromeImageAsync(\n projectRoot: string,\n {\n icon,\n imageCacheFolder,\n outputImageFileName,\n }: { icon: string; imageCacheFolder: string; outputImageFileName: string }\n) {\n await iterateDpiValues(projectRoot, async ({ dpiFolder, scale }) => {\n const monochromeIcon = await generateIconAsync(projectRoot, {\n cacheType: imageCacheFolder,\n src: icon,\n scale,\n backgroundColor: 'transparent',\n });\n await fs.ensureDir(dpiFolder);\n await fs.writeFile(path.resolve(dpiFolder, outputImageFileName), monochromeIcon);\n });\n}\n\nfunction iterateDpiValues(\n projectRoot: string,\n callback: (value: { dpiFolder: string; folderName: string; scale: number }) => Promise<void>\n) {\n return Promise.all(\n Object.values(dpiValues).map((value) =>\n callback({\n dpiFolder: path.resolve(projectRoot, ANDROID_RES_PATH, value.folderName),\n ...value,\n })\n )\n );\n}\n\nasync function deleteIconNamedAsync(projectRoot: string, name: string) {\n return iterateDpiValues(projectRoot, ({ dpiFolder }) => {\n return fs.remove(path.resolve(dpiFolder, name));\n });\n}\n\nasync function generateIconAsync(\n projectRoot: string,\n {\n cacheType,\n src,\n scale,\n backgroundColor,\n borderRadiusRatio,\n imageStlye,\n }: {\n cacheType: string;\n src: string;\n scale: number;\n backgroundColor: string;\n borderRadiusRatio?: number;\n imageStlye?: ImageStyle;\n }\n) {\n const isForegound = imageStlye === 'foreground';\n const baseline = isForegound ? FOREGROUND_BASELINE_PIXEL_SIZE : ICON_BASELINE_PIXEL_SIZE;\n const bgIconSizePx = Math.round(baseline * scale);\n const iconSizePx = Math.round(bgIconSizePx * getImageScale(imageStlye ?? 'background'));\n\n const { source: foreground } = await generateImageAsync(\n { projectRoot, cacheType },\n {\n src,\n resizeMode: 'cover',\n width: iconSizePx,\n height: iconSizePx,\n }\n );\n\n const background = await generateImageBackgroundAsync({\n width: bgIconSizePx,\n height: bgIconSizePx,\n backgroundColor: isForegound ? 'transparent' : backgroundColor,\n resizeMode: 'cover',\n borderRadius: borderRadiusRatio ? bgIconSizePx * borderRadiusRatio : undefined,\n });\n\n const x = Math.round((bgIconSizePx - iconSizePx) / 2);\n const y = x;\n\n return compositeImagesAsync({ background, foreground, x, y });\n}\n\nfunction getImageStyle(outputFileName: string): ImageStyle {\n switch (outputFileName) {\n case IC_LAUNCHER_WEBP:\n return 'legacy';\n case IC_LAUNCHER_BACKGROUND_WEBP:\n return 'background';\n case IC_LAUNCHER_FOREGROUND_WEBP:\n return 'foreground';\n case IC_LAUNCHER_ROUND_WEBP:\n return 'rounded';\n case IC_LAUNCHER_MONOCHROME_WEBP:\n return 'monochrome';\n }\n\n return 'background';\n}\n\nfunction getImageScale(imageStyle: ImageStyle) {\n switch (imageStyle) {\n case 'legacy':\n case 'rounded':\n return 0.9;\n case 'foreground':\n case 'background':\n return 0.7;\n case 'monochrome':\n return 1;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAQA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAKA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,MAAA;EAAA,MAAAL,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAI,KAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,0BAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,yBAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAsE,SAAAI,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEtE,MAAM;EAAEG;AAAO,CAAC,GAAGC,8BAAa;AAMzB,MAAMC,SAAiB,GAAAC,OAAA,CAAAD,SAAA,GAAG;EAC/BE,IAAI,EAAE;IAAEC,UAAU,EAAE,aA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;MAC9B,OAAO,YAAY;IACrB,KAAKC,2BAA2B;MAC9B,OAAO,YAAY;IACrB,KAAKF,sBAAsB;MACzB,OAAO,SAAS;IAClB,KAAKG,2BAA2B;MAC9B,OAAO,YAAY;EACvB;EAEA,OAAO,YAAY;AACrB;AAEA,SAASuF,aAAaA,CAACY,UAAsB,EAAE;EAC7C,QAAQA,UAAU;IAChB,KAAK,QAAQ;IACb,KAAK,SAAS;MACZ,OAAO,GAAG;IACZ,KAAK,YAAY;IACjB,KAAK,YAAY;MACf,OAAO,GAAG;IACZ,KAAK,YAAY;MACf,OAAO,CAAC;EACZ;AACF","ignoreList":[]}
|
|
@@ -221,11 +221,12 @@ export declare function createConstraintId(...attributes: string[]): string;
|
|
|
221
221
|
export declare function removeImageFromSplashScreen(xml: IBSplashScreenDocument, { imageName }: {
|
|
222
222
|
imageName: string;
|
|
223
223
|
}): IBSplashScreenDocument;
|
|
224
|
-
export declare function applyImageToSplashScreenXML(xml: IBSplashScreenDocument, { imageName, contentMode, backgroundColor,
|
|
224
|
+
export declare function applyImageToSplashScreenXML(xml: IBSplashScreenDocument, { imageName, contentMode, backgroundColor, enableFullScreenImage, imageWidth, }: {
|
|
225
225
|
imageName: string;
|
|
226
226
|
contentMode: ImageContentMode;
|
|
227
227
|
backgroundColor: string;
|
|
228
|
-
|
|
228
|
+
enableFullScreenImage: boolean;
|
|
229
|
+
imageWidth?: number;
|
|
229
230
|
}): IBSplashScreenDocument;
|
|
230
231
|
/**
|
|
231
232
|
* IB does not allow two items to have the same ID.
|
|
@@ -71,20 +71,24 @@ function removeImageFromSplashScreen(xml, {
|
|
|
71
71
|
}
|
|
72
72
|
return xml;
|
|
73
73
|
}
|
|
74
|
-
function getAbsoluteConstraints(childId, parentId) {
|
|
74
|
+
function getAbsoluteConstraints(childId, parentId, legacy = false) {
|
|
75
|
+
if (legacy) {
|
|
76
|
+
return [createConstraint([childId, 'top'], [parentId, 'top']), createConstraint([childId, 'leading'], [parentId, 'leading']), createConstraint([childId, 'trailing'], [parentId, 'trailing']), createConstraint([childId, 'bottom'], [parentId, 'bottom'])];
|
|
77
|
+
}
|
|
75
78
|
return [createConstraint([childId, 'centerX'], [parentId, 'centerX']), createConstraint([childId, 'centerY'], [parentId, 'centerY'])];
|
|
76
79
|
}
|
|
77
80
|
function applyImageToSplashScreenXML(xml, {
|
|
78
81
|
imageName,
|
|
79
82
|
contentMode,
|
|
80
83
|
backgroundColor,
|
|
81
|
-
|
|
84
|
+
enableFullScreenImage,
|
|
85
|
+
imageWidth = 100
|
|
82
86
|
}) {
|
|
83
87
|
const mainView = xml.document.scenes[0].scene[0].objects[0].viewController[0].view[0];
|
|
84
|
-
const width =
|
|
85
|
-
const height =
|
|
86
|
-
const x = (mainView.rect[0].$.width - width) / 2;
|
|
87
|
-
const y = (mainView.rect[0].$.height - height) / 2;
|
|
88
|
+
const width = enableFullScreenImage ? 414 : imageWidth;
|
|
89
|
+
const height = enableFullScreenImage ? 736 : imageWidth;
|
|
90
|
+
const x = enableFullScreenImage ? 0 : (mainView.rect[0].$.width - width) / 2;
|
|
91
|
+
const y = enableFullScreenImage ? 0 : (mainView.rect[0].$.height - height) / 2;
|
|
88
92
|
const imageView = {
|
|
89
93
|
$: {
|
|
90
94
|
id: IMAGE_ID,
|
|
@@ -111,8 +115,7 @@ function applyImageToSplashScreenXML(xml, {
|
|
|
111
115
|
mainView.constraints[0].constraint = [];
|
|
112
116
|
|
|
113
117
|
// Add Constraints
|
|
114
|
-
getAbsoluteConstraints(IMAGE_ID, CONTAINER_ID).forEach(constraint => {
|
|
115
|
-
// <constraint firstItem="EXPO-SplashScreen" firstAttribute="top" secondItem="EXPO-ContainerView" secondAttribute="top" id="2VS-Uz-0LU"/>
|
|
118
|
+
getAbsoluteConstraints(IMAGE_ID, CONTAINER_ID, enableFullScreenImage).forEach(constraint => {
|
|
116
119
|
const constrainsArray = mainView.constraints[0].constraint;
|
|
117
120
|
ensureUniquePush(constrainsArray, constraint);
|
|
118
121
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InterfaceBuilder.js","names":["_crypto","data","_interopRequireDefault","require","_xml2js","e","__esModule","default","debug","createConstraint","firstItem","firstAttribute","secondItem","secondAttribute","constant","$","id","createConstraintId","attributes","crypto","createHash","update","join","digest","IMAGE_ID","CONTAINER_ID","removeImageFromSplashScreen","xml","imageName","mainView","document","scenes","scene","objects","viewController","view","removeExisting","subviews","imageView","getAbsoluteConstraints","forEach","constraint","constrainsArray","constraints","imageSection","resources","image","existingImageIndex","findIndex","name","splice","childId","parentId","applyImageToSplashScreenXML","contentMode","backgroundColor","logoWidth","width","height","x","rect","y","userLabel","clipsSubviews","userInteractionEnabled","translatesAutoresizingMaskIntoConstraints","key","ensureUniquePush","push","color","colorSection","namedColor","namedColorSection","parseColor","alpha","blue","rgb","green","red","customColorSpace","colorSpace","array","item","existingItem","toString","builder","Builder","preserveChildrenOrder","xmldec","version","encoding","renderOpts","pretty","indent","buildObject","toObjectAsync","contents","Parser","parseStringPromise","value","toUpperCase","replace","length","console","error","process","exit","hex","parseInt","toPrecision","exports"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/InterfaceBuilder.ts"],"sourcesContent":["import crypto from 'crypto';\nimport { Builder, Parser } from 'xml2js';\n\nconst debug = require('debug')(\n 'expo:prebuild-config:expo-splash-screen:ios:InterfaceBuilder'\n) as typeof console.log;\n\nexport type IBBoolean = 'YES' | 'NO' | boolean;\n\nexport type IBItem<\n H extends Record<string, any>,\n B extends Record<string, any[]> = { [key: string]: any },\n> = {\n $: H;\n} & B;\n\nexport type Rect = {\n key: string;\n x: number;\n y: number;\n width: number;\n height: number;\n};\n\nexport type IBRect = IBItem<Rect>;\n\nexport type IBAutoresizingMask = IBItem<{\n /** @example `autoresizingMask` */\n key: string;\n flexibleMaxX: IBBoolean;\n flexibleMaxY: IBBoolean;\n}>;\n\n/** @example `<color key=\"textColor\" systemColor=\"linkColor\"/>` */\nexport type IBColor = IBItem<\n {\n /** @example `textColor` */\n key: string;\n } & (\n | /** Custom color */\n {\n /** @example `0.86584504117670746` */\n red: number;\n /** @example `0.26445041990630447` */\n green: number;\n /** @example `0.3248577810203549` */\n blue: number;\n /** @example `1` */\n alpha: number;\n colorSpace: 'custom' | string;\n customColorSpace: 'displayP3' | 'sRGB' | string;\n }\n /** Built-in color */\n | {\n systemColor: 'linkColor' | string;\n }\n )\n>;\n\nexport type IBFontDescription = IBItem<{\n /** @example `fontDescription` */\n key: string;\n /** Font size */\n pointSize: number;\n\n /** Custom font */\n name?: 'HelveticaNeue' | string;\n family?: 'Helvetica Neue' | string;\n\n /** Built-in font */\n type?: 'system' | 'boldSystem' | 'UICTFontTextStyleCallout' | 'UICTFontTextStyleBody' | string;\n}>;\n\nexport type ImageContentMode = 'scaleAspectFit' | 'scaleAspectFill';\n\nexport type ConstraintAttribute = 'top' | 'bottom' | 'trailing' | 'leading' | 'centerX' | 'centerY';\n\nexport type IBImageView = IBItem<\n {\n id: string;\n userLabel: string;\n image: string;\n clipsSubviews?: IBBoolean;\n userInteractionEnabled: IBBoolean;\n contentMode: IBContentMode;\n horizontalHuggingPriority?: number;\n verticalHuggingPriority?: number;\n insetsLayoutMarginsFromSafeArea?: IBBoolean;\n translatesAutoresizingMaskIntoConstraints?: IBBoolean;\n },\n {\n rect: IBRect[];\n }\n>;\n\nexport type IBLabel = IBItem<\n {\n id: string;\n /** The main value. */\n text: string;\n\n opaque: IBBoolean;\n fixedFrame: IBBoolean;\n textAlignment?: IBTextAlignment;\n lineBreakMode:\n | 'clip'\n | 'characterWrap'\n | 'wordWrap'\n | 'headTruncation'\n | 'middleTruncation'\n | 'tailTruncation';\n baselineAdjustment?: 'none' | 'alignBaselines';\n adjustsFontSizeToFit: IBBoolean;\n userInteractionEnabled: IBBoolean;\n contentMode: IBContentMode;\n horizontalHuggingPriority: number;\n verticalHuggingPriority: number;\n translatesAutoresizingMaskIntoConstraints?: IBBoolean;\n },\n {\n /** @example `<rect key=\"frame\" x=\"175\" y=\"670\" width=\"35\" height=\"17\"/>` */\n rect: IBRect[];\n /** @example `<autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>` */\n autoresizingMask?: IBAutoresizingMask[];\n /** @example `<fontDescription key=\"fontDescription\" type=\"system\" pointSize=\"19\"/>` */\n fontDescription?: IBFontDescription[];\n /** @example `<color key=\"textColor\" red=\"0.0\" green=\"0.0\" blue=\"0.0\" alpha=\"1\" colorSpace=\"custom\" customColorSpace=\"sRGB\"/>` */\n color?: IBColor[];\n nil?: IBItem<{\n /** @example `textColor` `highlightedColor` */\n key: string;\n }>[];\n }\n>;\n\nexport type IBTextAlignment = 'left' | 'center' | 'right' | 'justified' | 'natural';\n\nexport type IBContentMode = string | 'left' | 'scaleAspectFill';\n\nexport type IBConstraint = IBItem<{\n firstItem: string;\n firstAttribute: ConstraintAttribute;\n secondItem: string;\n secondAttribute: ConstraintAttribute;\n constant?: number;\n id: string;\n}>;\n\nexport type IBViewController = IBItem<\n {\n id: string;\n placeholderIdentifier?: string;\n userLabel: string;\n sceneMemberID: string;\n },\n {\n view: IBItem<\n {\n id: string;\n key: string;\n userInteractionEnabled: IBBoolean;\n contentMode: string | 'scaleToFill';\n insetsLayoutMarginsFromSafeArea: IBBoolean;\n userLabel: string;\n },\n {\n rect: IBRect[];\n autoresizingMask: IBItem<{\n key: string;\n flexibleMaxX: IBBoolean;\n flexibleMaxY: IBBoolean;\n }>[];\n\n subviews: IBItem<\n object,\n {\n imageView: IBImageView[];\n label: IBLabel[];\n }\n >[];\n color: IBItem<{\n key: string | 'backgroundColor';\n name?: string;\n systemColor?: string | 'systemBackgroundColor';\n red?: string;\n green?: string;\n blue?: string;\n alpha?: string;\n colorSpace?: string;\n customColorSpace?: string;\n }>[];\n constraints: IBItem<\n object,\n {\n constraint: IBConstraint[];\n }\n >[];\n viewLayoutGuide: IBItem<{\n id: string;\n key: string | 'safeArea';\n }>[];\n }\n >[];\n }\n>;\n\nexport type IBPoint = IBItem<{\n key: string | 'canvasLocation';\n x: number;\n y: number;\n}>;\n\nexport type IBScene = IBItem<\n { sceneID: string },\n {\n objects: {\n viewController: IBViewController[];\n placeholder: IBItem<{\n id: string;\n placeholderIdentifier?: string;\n userLabel: string;\n sceneMemberID: string;\n }>[];\n }[];\n point: IBPoint[];\n }\n>;\n\nexport type IBResourceImage = IBItem<{\n name: string;\n width: number;\n height: number;\n}>;\n\nexport type IBResourceNamedColor = IBItem<{\n name?: string;\n systemColor?: string | 'systemBackgroundColor';\n red?: string;\n green?: string;\n blue?: string;\n alpha?: string;\n colorSpace?: string;\n customColorSpace?: string;\n}>;\n\nexport type IBDevice = IBItem<{\n id: string;\n orientation: string | 'portrait';\n appearance: string | 'light';\n}>;\n\nexport type IBSplashScreenDocument = {\n document: IBItem<\n {\n type: 'com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB' | string;\n version: '3.0' | string;\n toolsVersion: number;\n targetRuntime: 'iOS.CocoaTouch' | string;\n propertyAccessControl: 'none' | string;\n useAutolayout: IBBoolean;\n launchScreen: IBBoolean;\n useTraitCollections: IBBoolean;\n useSafeAreas: IBBoolean;\n colorMatched: IBBoolean;\n initialViewController: string;\n },\n {\n device: IBDevice[];\n dependencies: unknown[];\n scenes: {\n scene: IBScene[];\n }[];\n resources: {\n image: IBResourceImage[];\n namedColor?: IBItem<{ name: string }, { color: IBResourceNamedColor[] }>[];\n }[];\n }\n >;\n};\n\nexport function createConstraint(\n [firstItem, firstAttribute]: [string, ConstraintAttribute],\n [secondItem, secondAttribute]: [string, ConstraintAttribute],\n constant?: number\n): IBConstraint {\n return {\n $: {\n firstItem,\n firstAttribute,\n secondItem,\n secondAttribute,\n constant,\n // Prevent updating between runs\n id: createConstraintId(firstItem, firstAttribute, secondItem, secondAttribute),\n },\n };\n}\n\nexport function createConstraintId(...attributes: string[]) {\n return crypto.createHash('sha1').update(attributes.join('-')).digest('hex');\n}\n\nconst IMAGE_ID = 'EXPO-SplashScreen';\nconst CONTAINER_ID = 'EXPO-ContainerView';\n\nexport function removeImageFromSplashScreen(\n xml: IBSplashScreenDocument,\n { imageName }: { imageName: string }\n) {\n const mainView = xml.document.scenes[0].scene[0].objects[0].viewController[0].view[0];\n\n debug(`Remove all splash screen image elements`);\n\n removeExisting(mainView.subviews[0].imageView, IMAGE_ID);\n\n // Add Constraints\n getAbsoluteConstraints(IMAGE_ID, CONTAINER_ID).forEach((constraint) => {\n // <constraint firstItem=\"EXPO-SplashScreen\" firstAttribute=\"top\" secondItem=\"EXPO-ContainerView\" secondAttribute=\"top\" id=\"2VS-Uz-0LU\"/>\n const constrainsArray = mainView.constraints[0].constraint;\n removeExisting(constrainsArray, constraint);\n });\n\n // Add resource\n const imageSection = xml.document.resources[0].image;\n\n const existingImageIndex = imageSection.findIndex((image) => image.$.name === imageName);\n if (existingImageIndex > -1) {\n imageSection.splice(existingImageIndex, 1);\n }\n return xml;\n}\n\nfunction getAbsoluteConstraints(childId: string, parentId: string) {\n return [\n createConstraint([childId, 'centerX'], [parentId, 'centerX']),\n createConstraint([childId, 'centerY'], [parentId, 'centerY']),\n ];\n}\n\nexport function applyImageToSplashScreenXML(\n xml: IBSplashScreenDocument,\n {\n imageName,\n contentMode,\n backgroundColor,\n logoWidth = 100,\n }: {\n imageName: string;\n contentMode: ImageContentMode;\n backgroundColor: string;\n logoWidth?: number;\n }\n): IBSplashScreenDocument {\n const mainView = xml.document.scenes[0].scene[0].objects[0].viewController[0].view[0];\n const width = logoWidth;\n const height = logoWidth;\n const x = (mainView.rect[0].$.width - width) / 2;\n const y = (mainView.rect[0].$.height - height) / 2;\n\n const imageView: IBImageView = {\n $: {\n id: IMAGE_ID,\n userLabel: imageName,\n image: imageName,\n contentMode,\n clipsSubviews: true,\n userInteractionEnabled: false,\n translatesAutoresizingMaskIntoConstraints: false,\n },\n rect: [\n {\n $: {\n key: 'frame',\n x,\n y,\n width,\n height,\n },\n },\n ],\n };\n\n // Add ImageView\n ensureUniquePush(mainView.subviews[0].imageView, imageView);\n\n mainView.constraints[0].constraint = [];\n\n // Add Constraints\n getAbsoluteConstraints(IMAGE_ID, CONTAINER_ID).forEach((constraint) => {\n // <constraint firstItem=\"EXPO-SplashScreen\" firstAttribute=\"top\" secondItem=\"EXPO-ContainerView\" secondAttribute=\"top\" id=\"2VS-Uz-0LU\"/>\n const constrainsArray = mainView.constraints[0].constraint;\n ensureUniquePush(constrainsArray, constraint);\n });\n\n // Add resource\n const imageSection = xml.document.resources[0].image;\n\n const existingImageIndex = imageSection.findIndex((image) => image.$.name === imageName);\n if (existingImageIndex > -1) {\n debug(`Removing existing IB image asset at index ${existingImageIndex}`);\n imageSection.splice(existingImageIndex, 1);\n }\n imageSection.push({\n $: {\n name: imageName,\n width,\n height,\n },\n });\n\n // Add background color\n mainView.color = mainView.color ?? [];\n const colorSection = mainView.color;\n\n colorSection.push({\n $: {\n key: 'backgroundColor',\n name: 'SplashScreenBackground',\n },\n });\n\n // Add background named color reference\n xml.document.resources[0].namedColor = xml.document.resources[0].namedColor ?? [];\n const namedColorSection = xml.document.resources[0].namedColor;\n const color = parseColor(backgroundColor);\n\n namedColorSection.push({\n $: {\n name: 'SplashScreenBackground',\n },\n color: [\n {\n $: {\n alpha: '1.000',\n blue: color.rgb.blue,\n green: color.rgb.green,\n red: color.rgb.red,\n customColorSpace: 'sRGB',\n colorSpace: 'custom',\n },\n },\n ],\n });\n\n return xml;\n}\n\n/**\n * IB does not allow two items to have the same ID.\n * This method will add an item by first removing any existing item with the same `$.id`.\n */\nexport function ensureUniquePush<TItem extends { $: { id: string } }>(array: TItem[], item: TItem) {\n if (!array) return array;\n removeExisting(array, item);\n array.push(item);\n return array;\n}\n\nexport function removeExisting<TItem extends { $: { id: string } }>(\n array: TItem[],\n item: TItem | string\n) {\n const id = typeof item === 'string' ? item : item.$?.id;\n const existingItem = array?.findIndex((existingItem) => existingItem.$.id === id);\n if (existingItem > -1) {\n debug(`Removing existing IB item with id ${id}, from: %O`, array);\n array.splice(existingItem, 1);\n }\n return array;\n}\n\n// Attempt to copy Xcode formatting.\nexport function toString(xml: any): string {\n const builder = new Builder({\n // @ts-expect-error: untyped\n preserveChildrenOrder: true,\n xmldec: {\n version: '1.0',\n encoding: 'UTF-8',\n },\n renderOpts: {\n pretty: true,\n indent: ' ',\n },\n });\n return builder.buildObject(xml);\n}\n\n/** Parse string contents into an object. */\nexport function toObjectAsync(contents: string) {\n return new Parser().parseStringPromise(contents);\n}\n\n// Function taken from react-native-bootsplash\nexport const parseColor = (value: string): Color => {\n const color = value.toUpperCase().replace(/[^0-9A-F]/g, '');\n\n if (color.length !== 3 && color.length !== 6) {\n console.error(`\"${value}\" value is not a valid hexadecimal color.`);\n process.exit(1);\n }\n\n const hex =\n color.length === 3\n ? '#' + color[0] + color[0] + color[1] + color[1] + color[2] + color[2]\n : '#' + color;\n\n const rgb: Color['rgb'] = {\n red: (parseInt('' + hex[1] + hex[2], 16) / 255).toPrecision(15),\n green: (parseInt('' + hex[3] + hex[4], 16) / 255).toPrecision(15),\n blue: (parseInt('' + hex[5] + hex[6], 16) / 255).toPrecision(15),\n };\n\n return { hex, rgb };\n};\n\ntype Color = {\n hex: string;\n rgb: {\n red: string;\n green: string;\n blue: string;\n };\n};\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAyC,SAAAC,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEzC,MAAMG,KAAK,GAAGL,OAAO,CAAC,OAAO,CAAC,CAC5B,8DACF,CA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C5CC,OAAO,CAACC,KAAK,CAAC,IAAIL,KAAK,2CAA2C,CAAC;IACnEM,OAAO,CAACC,IAAI,CAAC,CAAC,CAAC;EACjB;EAEA,MAAMC,GAAG,GACPtC,KAAK,CAACiC,MAAM,KAAK,CAAC,GACd,GAAG,GAAGjC,KAAK,CAAC,CAAC,CAAC,GAAGA,KAAK,CAAC,CAAC,CAAC,GAAGA,KAAK,CAAC,CAAC,CAAC,GAAGA,KAAK,CAAC,CAAC,CAAC,GAAGA,KAAK,CAAC,CAAC,CAAC,GAAGA,KAAK,CAAC,CAAC,CAAC,GACrE,GAAG,GAAGA,KAAK;EAEjB,MAAMO,GAAiB,GAAG;IACxBE,GAAG,EAAE,CAAC8B,QAAQ,CAAC,EAAE,GAAGD,GAAG,CAAC,CAAC,CAAC,GAAGA,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,EAAEE,WAAW,CAAC,EAAE,CAAC;IAC/DhC,KAAK,EAAE,CAAC+B,QAAQ,CAAC,EAAE,GAAGD,GAAG,CAAC,CAAC,CAAC,GAAGA,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,EAAEE,WAAW,CAAC,EAAE,CAAC;IACjElC,IAAI,EAAE,CAACiC,QAAQ,CAAC,EAAE,GAAGD,GAAG,CAAC,CAAC,CAAC,GAAGA,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,EAAEE,WAAW,CAAC,EAAE;EACjE,CAAC;EAED,OAAO;IAAEF,GAAG;IAAE/B;EAAI,CAAC;AACrB,CAAC;AAACkC,OAAA,CAAArC,UAAA,GAAAA,UAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"InterfaceBuilder.js","names":["_crypto","data","_interopRequireDefault","require","_xml2js","e","__esModule","default","debug","createConstraint","firstItem","firstAttribute","secondItem","secondAttribute","constant","$","id","createConstraintId","attributes","crypto","createHash","update","join","digest","IMAGE_ID","CONTAINER_ID","removeImageFromSplashScreen","xml","imageName","mainView","document","scenes","scene","objects","viewController","view","removeExisting","subviews","imageView","getAbsoluteConstraints","forEach","constraint","constrainsArray","constraints","imageSection","resources","image","existingImageIndex","findIndex","name","splice","childId","parentId","legacy","applyImageToSplashScreenXML","contentMode","backgroundColor","enableFullScreenImage","imageWidth","width","height","x","rect","y","userLabel","clipsSubviews","userInteractionEnabled","translatesAutoresizingMaskIntoConstraints","key","ensureUniquePush","push","color","colorSection","namedColor","namedColorSection","parseColor","alpha","blue","rgb","green","red","customColorSpace","colorSpace","array","item","existingItem","toString","builder","Builder","preserveChildrenOrder","xmldec","version","encoding","renderOpts","pretty","indent","buildObject","toObjectAsync","contents","Parser","parseStringPromise","value","toUpperCase","replace","length","console","error","process","exit","hex","parseInt","toPrecision","exports"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/InterfaceBuilder.ts"],"sourcesContent":["import crypto from 'crypto';\nimport { Builder, Parser } from 'xml2js';\n\nconst debug = require('debug')(\n 'expo:prebuild-config:expo-splash-screen:ios:InterfaceBuilder'\n) as typeof console.log;\n\nexport type IBBoolean = 'YES' | 'NO' | boolean;\n\nexport type IBItem<\n H extends Record<string, any>,\n B extends Record<string, any[]> = { [key: string]: any },\n> = {\n $: H;\n} & B;\n\nexport type Rect = {\n key: string;\n x: number;\n y: number;\n width: number;\n height: number;\n};\n\nexport type IBRect = IBItem<Rect>;\n\nexport type IBAutoresizingMask = IBItem<{\n /** @example `autoresizingMask` */\n key: string;\n flexibleMaxX: IBBoolean;\n flexibleMaxY: IBBoolean;\n}>;\n\n/** @example `<color key=\"textColor\" systemColor=\"linkColor\"/>` */\nexport type IBColor = IBItem<\n {\n /** @example `textColor` */\n key: string;\n } & (\n | /** Custom color */\n {\n /** @example `0.86584504117670746` */\n red: number;\n /** @example `0.26445041990630447` */\n green: number;\n /** @example `0.3248577810203549` */\n blue: number;\n /** @example `1` */\n alpha: number;\n colorSpace: 'custom' | string;\n customColorSpace: 'displayP3' | 'sRGB' | string;\n }\n /** Built-in color */\n | {\n systemColor: 'linkColor' | string;\n }\n )\n>;\n\nexport type IBFontDescription = IBItem<{\n /** @example `fontDescription` */\n key: string;\n /** Font size */\n pointSize: number;\n\n /** Custom font */\n name?: 'HelveticaNeue' | string;\n family?: 'Helvetica Neue' | string;\n\n /** Built-in font */\n type?: 'system' | 'boldSystem' | 'UICTFontTextStyleCallout' | 'UICTFontTextStyleBody' | string;\n}>;\n\nexport type ImageContentMode = 'scaleAspectFit' | 'scaleAspectFill';\n\nexport type ConstraintAttribute = 'top' | 'bottom' | 'trailing' | 'leading' | 'centerX' | 'centerY';\n\nexport type IBImageView = IBItem<\n {\n id: string;\n userLabel: string;\n image: string;\n clipsSubviews?: IBBoolean;\n userInteractionEnabled: IBBoolean;\n contentMode: IBContentMode;\n horizontalHuggingPriority?: number;\n verticalHuggingPriority?: number;\n insetsLayoutMarginsFromSafeArea?: IBBoolean;\n translatesAutoresizingMaskIntoConstraints?: IBBoolean;\n },\n {\n rect: IBRect[];\n }\n>;\n\nexport type IBLabel = IBItem<\n {\n id: string;\n /** The main value. */\n text: string;\n\n opaque: IBBoolean;\n fixedFrame: IBBoolean;\n textAlignment?: IBTextAlignment;\n lineBreakMode:\n | 'clip'\n | 'characterWrap'\n | 'wordWrap'\n | 'headTruncation'\n | 'middleTruncation'\n | 'tailTruncation';\n baselineAdjustment?: 'none' | 'alignBaselines';\n adjustsFontSizeToFit: IBBoolean;\n userInteractionEnabled: IBBoolean;\n contentMode: IBContentMode;\n horizontalHuggingPriority: number;\n verticalHuggingPriority: number;\n translatesAutoresizingMaskIntoConstraints?: IBBoolean;\n },\n {\n /** @example `<rect key=\"frame\" x=\"175\" y=\"670\" width=\"35\" height=\"17\"/>` */\n rect: IBRect[];\n /** @example `<autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>` */\n autoresizingMask?: IBAutoresizingMask[];\n /** @example `<fontDescription key=\"fontDescription\" type=\"system\" pointSize=\"19\"/>` */\n fontDescription?: IBFontDescription[];\n /** @example `<color key=\"textColor\" red=\"0.0\" green=\"0.0\" blue=\"0.0\" alpha=\"1\" colorSpace=\"custom\" customColorSpace=\"sRGB\"/>` */\n color?: IBColor[];\n nil?: IBItem<{\n /** @example `textColor` `highlightedColor` */\n key: string;\n }>[];\n }\n>;\n\nexport type IBTextAlignment = 'left' | 'center' | 'right' | 'justified' | 'natural';\n\nexport type IBContentMode = string | 'left' | 'scaleAspectFill';\n\nexport type IBConstraint = IBItem<{\n firstItem: string;\n firstAttribute: ConstraintAttribute;\n secondItem: string;\n secondAttribute: ConstraintAttribute;\n constant?: number;\n id: string;\n}>;\n\nexport type IBViewController = IBItem<\n {\n id: string;\n placeholderIdentifier?: string;\n userLabel: string;\n sceneMemberID: string;\n },\n {\n view: IBItem<\n {\n id: string;\n key: string;\n userInteractionEnabled: IBBoolean;\n contentMode: string | 'scaleToFill';\n insetsLayoutMarginsFromSafeArea: IBBoolean;\n userLabel: string;\n },\n {\n rect: IBRect[];\n autoresizingMask: IBItem<{\n key: string;\n flexibleMaxX: IBBoolean;\n flexibleMaxY: IBBoolean;\n }>[];\n\n subviews: IBItem<\n object,\n {\n imageView: IBImageView[];\n label: IBLabel[];\n }\n >[];\n color: IBItem<{\n key: string | 'backgroundColor';\n name?: string;\n systemColor?: string | 'systemBackgroundColor';\n red?: string;\n green?: string;\n blue?: string;\n alpha?: string;\n colorSpace?: string;\n customColorSpace?: string;\n }>[];\n constraints: IBItem<\n object,\n {\n constraint: IBConstraint[];\n }\n >[];\n viewLayoutGuide: IBItem<{\n id: string;\n key: string | 'safeArea';\n }>[];\n }\n >[];\n }\n>;\n\nexport type IBPoint = IBItem<{\n key: string | 'canvasLocation';\n x: number;\n y: number;\n}>;\n\nexport type IBScene = IBItem<\n { sceneID: string },\n {\n objects: {\n viewController: IBViewController[];\n placeholder: IBItem<{\n id: string;\n placeholderIdentifier?: string;\n userLabel: string;\n sceneMemberID: string;\n }>[];\n }[];\n point: IBPoint[];\n }\n>;\n\nexport type IBResourceImage = IBItem<{\n name: string;\n width: number;\n height: number;\n}>;\n\nexport type IBResourceNamedColor = IBItem<{\n name?: string;\n systemColor?: string | 'systemBackgroundColor';\n red?: string;\n green?: string;\n blue?: string;\n alpha?: string;\n colorSpace?: string;\n customColorSpace?: string;\n}>;\n\nexport type IBDevice = IBItem<{\n id: string;\n orientation: string | 'portrait';\n appearance: string | 'light';\n}>;\n\nexport type IBSplashScreenDocument = {\n document: IBItem<\n {\n type: 'com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB' | string;\n version: '3.0' | string;\n toolsVersion: number;\n targetRuntime: 'iOS.CocoaTouch' | string;\n propertyAccessControl: 'none' | string;\n useAutolayout: IBBoolean;\n launchScreen: IBBoolean;\n useTraitCollections: IBBoolean;\n useSafeAreas: IBBoolean;\n colorMatched: IBBoolean;\n initialViewController: string;\n },\n {\n device: IBDevice[];\n dependencies: unknown[];\n scenes: {\n scene: IBScene[];\n }[];\n resources: {\n image: IBResourceImage[];\n namedColor?: IBItem<{ name: string }, { color: IBResourceNamedColor[] }>[];\n }[];\n }\n >;\n};\n\nexport function createConstraint(\n [firstItem, firstAttribute]: [string, ConstraintAttribute],\n [secondItem, secondAttribute]: [string, ConstraintAttribute],\n constant?: number\n): IBConstraint {\n return {\n $: {\n firstItem,\n firstAttribute,\n secondItem,\n secondAttribute,\n constant,\n // Prevent updating between runs\n id: createConstraintId(firstItem, firstAttribute, secondItem, secondAttribute),\n },\n };\n}\n\nexport function createConstraintId(...attributes: string[]) {\n return crypto.createHash('sha1').update(attributes.join('-')).digest('hex');\n}\n\nconst IMAGE_ID = 'EXPO-SplashScreen';\nconst CONTAINER_ID = 'EXPO-ContainerView';\n\nexport function removeImageFromSplashScreen(\n xml: IBSplashScreenDocument,\n { imageName }: { imageName: string }\n) {\n const mainView = xml.document.scenes[0].scene[0].objects[0].viewController[0].view[0];\n\n debug(`Remove all splash screen image elements`);\n\n removeExisting(mainView.subviews[0].imageView, IMAGE_ID);\n\n // Add Constraints\n getAbsoluteConstraints(IMAGE_ID, CONTAINER_ID).forEach((constraint) => {\n // <constraint firstItem=\"EXPO-SplashScreen\" firstAttribute=\"top\" secondItem=\"EXPO-ContainerView\" secondAttribute=\"top\" id=\"2VS-Uz-0LU\"/>\n const constrainsArray = mainView.constraints[0].constraint;\n removeExisting(constrainsArray, constraint);\n });\n\n // Add resource\n const imageSection = xml.document.resources[0].image;\n\n const existingImageIndex = imageSection.findIndex((image) => image.$.name === imageName);\n if (existingImageIndex > -1) {\n imageSection.splice(existingImageIndex, 1);\n }\n return xml;\n}\n\nfunction getAbsoluteConstraints(childId: string, parentId: string, legacy: boolean = false) {\n if (legacy) {\n return [\n createConstraint([childId, 'top'], [parentId, 'top']),\n createConstraint([childId, 'leading'], [parentId, 'leading']),\n createConstraint([childId, 'trailing'], [parentId, 'trailing']),\n createConstraint([childId, 'bottom'], [parentId, 'bottom']),\n ];\n }\n return [\n createConstraint([childId, 'centerX'], [parentId, 'centerX']),\n createConstraint([childId, 'centerY'], [parentId, 'centerY']),\n ];\n}\n\nexport function applyImageToSplashScreenXML(\n xml: IBSplashScreenDocument,\n {\n imageName,\n contentMode,\n backgroundColor,\n enableFullScreenImage,\n imageWidth = 100,\n }: {\n imageName: string;\n contentMode: ImageContentMode;\n backgroundColor: string;\n enableFullScreenImage: boolean;\n imageWidth?: number;\n }\n): IBSplashScreenDocument {\n const mainView = xml.document.scenes[0].scene[0].objects[0].viewController[0].view[0];\n const width = enableFullScreenImage ? 414 : imageWidth;\n const height = enableFullScreenImage ? 736 : imageWidth;\n const x = enableFullScreenImage ? 0 : (mainView.rect[0].$.width - width) / 2;\n const y = enableFullScreenImage ? 0 : (mainView.rect[0].$.height - height) / 2;\n\n const imageView: IBImageView = {\n $: {\n id: IMAGE_ID,\n userLabel: imageName,\n image: imageName,\n contentMode,\n clipsSubviews: true,\n userInteractionEnabled: false,\n translatesAutoresizingMaskIntoConstraints: false,\n },\n rect: [\n {\n $: {\n key: 'frame',\n x,\n y,\n width,\n height,\n },\n },\n ],\n };\n\n // Add ImageView\n ensureUniquePush(mainView.subviews[0].imageView, imageView);\n\n mainView.constraints[0].constraint = [];\n\n // Add Constraints\n getAbsoluteConstraints(IMAGE_ID, CONTAINER_ID, enableFullScreenImage).forEach(\n (constraint: IBConstraint) => {\n const constrainsArray = mainView.constraints[0].constraint;\n ensureUniquePush(constrainsArray, constraint);\n }\n );\n\n // Add resource\n const imageSection = xml.document.resources[0].image;\n\n const existingImageIndex = imageSection.findIndex((image) => image.$.name === imageName);\n if (existingImageIndex > -1) {\n debug(`Removing existing IB image asset at index ${existingImageIndex}`);\n imageSection.splice(existingImageIndex, 1);\n }\n imageSection.push({\n $: {\n name: imageName,\n width,\n height,\n },\n });\n\n // Add background color\n mainView.color = mainView.color ?? [];\n const colorSection = mainView.color;\n\n colorSection.push({\n $: {\n key: 'backgroundColor',\n name: 'SplashScreenBackground',\n },\n });\n\n // Add background named color reference\n xml.document.resources[0].namedColor = xml.document.resources[0].namedColor ?? [];\n const namedColorSection = xml.document.resources[0].namedColor;\n const color = parseColor(backgroundColor);\n\n namedColorSection.push({\n $: {\n name: 'SplashScreenBackground',\n },\n color: [\n {\n $: {\n alpha: '1.000',\n blue: color.rgb.blue,\n green: color.rgb.green,\n red: color.rgb.red,\n customColorSpace: 'sRGB',\n colorSpace: 'custom',\n },\n },\n ],\n });\n\n return xml;\n}\n\n/**\n * IB does not allow two items to have the same ID.\n * This method will add an item by first removing any existing item with the same `$.id`.\n */\nexport function ensureUniquePush<TItem extends { $: { id: string } }>(array: TItem[], item: TItem) {\n if (!array) return array;\n removeExisting(array, item);\n array.push(item);\n return array;\n}\n\nexport function removeExisting<TItem extends { $: { id: string } }>(\n array: TItem[],\n item: TItem | string\n) {\n const id = typeof item === 'string' ? item : item.$?.id;\n const existingItem = array?.findIndex((existingItem) => existingItem.$.id === id);\n if (existingItem > -1) {\n debug(`Removing existing IB item with id ${id}, from: %O`, array);\n array.splice(existingItem, 1);\n }\n return array;\n}\n\n// Attempt to copy Xcode formatting.\nexport function toString(xml: any): string {\n const builder = new Builder({\n // @ts-expect-error: untyped\n preserveChildrenOrder: true,\n xmldec: {\n version: '1.0',\n encoding: 'UTF-8',\n },\n renderOpts: {\n pretty: true,\n indent: ' ',\n },\n });\n return builder.buildObject(xml);\n}\n\n/** Parse string contents into an object. */\nexport function toObjectAsync(contents: string) {\n return new Parser().parseStringPromise(contents);\n}\n\n// Function taken from react-native-bootsplash\nexport const parseColor = (value: string): Color => {\n const color = value.toUpperCase().replace(/[^0-9A-F]/g, '');\n\n if (color.length !== 3 && color.length !== 6) {\n console.error(`\"${value}\" value is not a valid hexadecimal color.`);\n process.exit(1);\n }\n\n const hex =\n color.length === 3\n ? '#' + color[0] + color[0] + color[1] + color[1] + color[2] + color[2]\n : '#' + color;\n\n const rgb: Color['rgb'] = {\n red: (parseInt('' + hex[1] + hex[2], 16) / 255).toPrecision(15),\n green: (parseInt('' + hex[3] + hex[4], 16) / 255).toPrecision(15),\n blue: (parseInt('' + hex[5] + hex[6], 16) / 255).toPrecision(15),\n };\n\n return { hex, rgb };\n};\n\ntype Color = {\n hex: string;\n rgb: {\n red: string;\n green: string;\n blue: string;\n };\n};\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAyC,SAAAC,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEzC,MAAMG,KAAK,GAAGL,OAAO,CAAC,OAAO,CAAC,CAC5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KAAK,EAAE,CAAC+B,QAAQ,CAAC,EAAE,GAAGD,GAAG,CAAC,CAAC,CAAC,GAAGA,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,EAAEE,WAAW,CAAC,EAAE,CAAC;IACjElC,IAAI,EAAE,CAACiC,QAAQ,CAAC,EAAE,GAAGD,GAAG,CAAC,CAAC,CAAC,GAAGA,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,EAAEE,WAAW,CAAC,EAAE;EACjE,CAAC;EAED,OAAO;IAAEF,GAAG;IAAE/B;EAAI,CAAC;AACrB,CAAC;AAACkC,OAAA,CAAArC,UAAA,GAAAA,UAAA","ignoreList":[]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ExpoConfig } from '@expo/config-types';
|
|
2
2
|
export type SplashScreenConfig = {
|
|
3
|
-
xxxhdpi?: string
|
|
4
|
-
xxhdpi?: string
|
|
5
|
-
xhdpi?: string
|
|
6
|
-
hdpi?: string
|
|
7
|
-
mdpi?: string
|
|
8
|
-
image?: string
|
|
9
|
-
backgroundColor
|
|
3
|
+
xxxhdpi?: string;
|
|
4
|
+
xxhdpi?: string;
|
|
5
|
+
xhdpi?: string;
|
|
6
|
+
hdpi?: string;
|
|
7
|
+
mdpi?: string;
|
|
8
|
+
image?: string;
|
|
9
|
+
backgroundColor?: string;
|
|
10
10
|
resizeMode: 'contain' | 'cover' | 'native';
|
|
11
11
|
dark?: {
|
|
12
12
|
backgroundColor?: string;
|
|
@@ -20,7 +20,7 @@ export type SplashScreenConfig = {
|
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
22
|
export type AndroidSplashConfig = {
|
|
23
|
-
|
|
23
|
+
imageWidth?: number;
|
|
24
24
|
} & SplashScreenConfig;
|
|
25
|
-
export declare function getAndroidSplashConfig(config: Pick<ExpoConfig, 'splash' | 'android'>, props?: AndroidSplashConfig | null):
|
|
26
|
-
export declare function getAndroidDarkSplashConfig(config: Pick<ExpoConfig, 'splash' | 'android'>, props
|
|
25
|
+
export declare function getAndroidSplashConfig(config: Pick<ExpoConfig, 'splash' | 'android'>, props?: AndroidSplashConfig | null): AndroidSplashConfig | null;
|
|
26
|
+
export declare function getAndroidDarkSplashConfig(config: Pick<ExpoConfig, 'splash' | 'android'>, props?: AndroidSplashConfig | null): SplashScreenConfig | null;
|
|
@@ -12,37 +12,41 @@ function getAndroidSplashConfig(config, props) {
|
|
|
12
12
|
if (props) {
|
|
13
13
|
const splash = props;
|
|
14
14
|
return {
|
|
15
|
-
xxxhdpi: splash.xxxhdpi ?? splash.image
|
|
16
|
-
xxhdpi: splash.xxhdpi ?? splash.image
|
|
17
|
-
xhdpi: splash.xhdpi ?? splash.image
|
|
18
|
-
hdpi: splash.hdpi ?? splash.image
|
|
19
|
-
mdpi: splash.mdpi ?? splash.image
|
|
20
|
-
backgroundColor: splash.backgroundColor
|
|
21
|
-
resizeMode: splash.resizeMode ?? defaultResizeMode
|
|
15
|
+
xxxhdpi: splash.xxxhdpi ?? splash.image,
|
|
16
|
+
xxhdpi: splash.xxhdpi ?? splash.image,
|
|
17
|
+
xhdpi: splash.xhdpi ?? splash.image,
|
|
18
|
+
hdpi: splash.hdpi ?? splash.image,
|
|
19
|
+
mdpi: splash.mdpi ?? splash.image,
|
|
20
|
+
backgroundColor: splash.backgroundColor,
|
|
21
|
+
resizeMode: splash.resizeMode ?? defaultResizeMode,
|
|
22
|
+
imageWidth: splash.imageWidth
|
|
22
23
|
};
|
|
23
24
|
}
|
|
24
25
|
if (config.android?.splash) {
|
|
25
26
|
const splash = config.android?.splash;
|
|
26
27
|
return {
|
|
27
|
-
xxxhdpi: splash.xxxhdpi ?? splash.image
|
|
28
|
-
xxhdpi: splash.xxhdpi ?? splash.image
|
|
29
|
-
xhdpi: splash.xhdpi ?? splash.image
|
|
30
|
-
hdpi: splash.hdpi ?? splash.image
|
|
31
|
-
mdpi: splash.mdpi ?? splash.image
|
|
32
|
-
backgroundColor: splash.backgroundColor
|
|
33
|
-
|
|
28
|
+
xxxhdpi: splash.xxxhdpi ?? splash.image,
|
|
29
|
+
xxhdpi: splash.xxhdpi ?? splash.image,
|
|
30
|
+
xhdpi: splash.xhdpi ?? splash.image,
|
|
31
|
+
hdpi: splash.hdpi ?? splash.image,
|
|
32
|
+
mdpi: splash.mdpi ?? splash.image,
|
|
33
|
+
backgroundColor: splash.backgroundColor,
|
|
34
|
+
image: splash.image,
|
|
35
|
+
resizeMode: splash.resizeMode ?? defaultResizeMode,
|
|
36
|
+
imageWidth: 200
|
|
34
37
|
};
|
|
35
38
|
}
|
|
36
39
|
if (config.splash) {
|
|
37
40
|
const splash = config.splash;
|
|
38
41
|
return {
|
|
39
|
-
xxxhdpi: splash.image
|
|
40
|
-
xxhdpi: splash.image
|
|
41
|
-
xhdpi: splash.image
|
|
42
|
-
hdpi: splash.image
|
|
43
|
-
mdpi: splash.image
|
|
44
|
-
backgroundColor: splash.backgroundColor
|
|
45
|
-
resizeMode: splash.resizeMode ?? defaultResizeMode
|
|
42
|
+
xxxhdpi: splash.image,
|
|
43
|
+
xxhdpi: splash.image,
|
|
44
|
+
xhdpi: splash.image,
|
|
45
|
+
hdpi: splash.image,
|
|
46
|
+
mdpi: splash.image,
|
|
47
|
+
backgroundColor: splash.backgroundColor,
|
|
48
|
+
resizeMode: splash.resizeMode ?? defaultResizeMode,
|
|
49
|
+
imageWidth: 200
|
|
46
50
|
};
|
|
47
51
|
}
|
|
48
52
|
return null;
|
|
@@ -52,12 +56,12 @@ function getAndroidDarkSplashConfig(config, props) {
|
|
|
52
56
|
const splash = props.dark;
|
|
53
57
|
const lightTheme = getAndroidSplashConfig(config, props);
|
|
54
58
|
return {
|
|
55
|
-
xxxhdpi: splash.xxxhdpi ?? splash.image
|
|
56
|
-
xxhdpi: splash.xxhdpi ?? splash.image
|
|
57
|
-
xhdpi: splash.xhdpi ?? splash.image
|
|
58
|
-
hdpi: splash.hdpi ?? splash.image
|
|
59
|
-
mdpi: splash.mdpi ?? splash.image
|
|
60
|
-
backgroundColor: splash.backgroundColor
|
|
59
|
+
xxxhdpi: splash.xxxhdpi ?? splash.image,
|
|
60
|
+
xxhdpi: splash.xxhdpi ?? splash.image,
|
|
61
|
+
xhdpi: splash.xhdpi ?? splash.image,
|
|
62
|
+
hdpi: splash.hdpi ?? splash.image,
|
|
63
|
+
mdpi: splash.mdpi ?? splash.image,
|
|
64
|
+
backgroundColor: splash.backgroundColor,
|
|
61
65
|
resizeMode: lightTheme?.resizeMode ?? defaultResizeMode
|
|
62
66
|
};
|
|
63
67
|
}
|
|
@@ -68,12 +72,12 @@ function getAndroidDarkSplashConfig(config, props) {
|
|
|
68
72
|
const splash = config.android?.splash?.dark;
|
|
69
73
|
const lightTheme = getAndroidSplashConfig(config, props);
|
|
70
74
|
return {
|
|
71
|
-
xxxhdpi: splash.xxxhdpi ?? splash.image
|
|
72
|
-
xxhdpi: splash.xxhdpi ?? splash.image
|
|
73
|
-
xhdpi: splash.xhdpi ?? splash.image
|
|
74
|
-
hdpi: splash.hdpi ?? splash.image
|
|
75
|
-
mdpi: splash.mdpi ?? splash.image
|
|
76
|
-
backgroundColor: splash.backgroundColor
|
|
75
|
+
xxxhdpi: splash.xxxhdpi ?? splash.image,
|
|
76
|
+
xxhdpi: splash.xxhdpi ?? splash.image,
|
|
77
|
+
xhdpi: splash.xhdpi ?? splash.image,
|
|
78
|
+
hdpi: splash.hdpi ?? splash.image,
|
|
79
|
+
mdpi: splash.mdpi ?? splash.image,
|
|
80
|
+
backgroundColor: splash.backgroundColor,
|
|
77
81
|
// Can't support dark resizeMode because the resize mode is hardcoded into the MainActivity.java
|
|
78
82
|
resizeMode: lightTheme?.resizeMode ?? defaultResizeMode
|
|
79
83
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAndroidSplashConfig.js","names":["defaultResizeMode","getAndroidSplashConfig","config","props","splash","xxxhdpi","image","xxhdpi","xhdpi","hdpi","mdpi","backgroundColor","resizeMode","android","getAndroidDarkSplashConfig","dark","lightTheme"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/getAndroidSplashConfig.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nexport type SplashScreenConfig = {\n xxxhdpi?: string
|
|
1
|
+
{"version":3,"file":"getAndroidSplashConfig.js","names":["defaultResizeMode","getAndroidSplashConfig","config","props","splash","xxxhdpi","image","xxhdpi","xhdpi","hdpi","mdpi","backgroundColor","resizeMode","imageWidth","android","getAndroidDarkSplashConfig","dark","lightTheme"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/getAndroidSplashConfig.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nexport type SplashScreenConfig = {\n xxxhdpi?: string;\n xxhdpi?: string;\n xhdpi?: string;\n hdpi?: string;\n mdpi?: string;\n image?: string;\n backgroundColor?: string;\n resizeMode: 'contain' | 'cover' | 'native';\n dark?: {\n backgroundColor?: string;\n xxxhdpi?: string;\n xxhdpi?: string;\n xhdpi?: string;\n hdpi?: string;\n mdpi?: string;\n image?: string;\n resizeMode?: 'contain' | 'cover' | 'native';\n };\n};\n\nexport type AndroidSplashConfig = {\n imageWidth?: number;\n} & SplashScreenConfig;\n\nconst defaultResizeMode = 'contain';\n\nexport function getAndroidSplashConfig(\n config: Pick<ExpoConfig, 'splash' | 'android'>,\n props?: AndroidSplashConfig | null\n): AndroidSplashConfig | null {\n // Respect the splash screen object, don't mix and match across different splash screen objects\n // in case the user wants the top level splash to apply to every platform except android.\n if (props) {\n const splash = props;\n return {\n xxxhdpi: splash.xxxhdpi ?? splash.image,\n xxhdpi: splash.xxhdpi ?? splash.image,\n xhdpi: splash.xhdpi ?? splash.image,\n hdpi: splash.hdpi ?? splash.image,\n mdpi: splash.mdpi ?? splash.image,\n backgroundColor: splash.backgroundColor,\n resizeMode: splash.resizeMode ?? defaultResizeMode,\n imageWidth: splash.imageWidth,\n };\n }\n\n if (config.android?.splash) {\n const splash = config.android?.splash;\n return {\n xxxhdpi: splash.xxxhdpi ?? splash.image,\n xxhdpi: splash.xxhdpi ?? splash.image,\n xhdpi: splash.xhdpi ?? splash.image,\n hdpi: splash.hdpi ?? splash.image,\n mdpi: splash.mdpi ?? splash.image,\n backgroundColor: splash.backgroundColor,\n image: splash.image,\n resizeMode: splash.resizeMode ?? defaultResizeMode,\n imageWidth: 200,\n };\n }\n\n if (config.splash) {\n const splash = config.splash;\n return {\n xxxhdpi: splash.image,\n xxhdpi: splash.image,\n xhdpi: splash.image,\n hdpi: splash.image,\n mdpi: splash.image,\n backgroundColor: splash.backgroundColor,\n resizeMode: splash.resizeMode ?? defaultResizeMode,\n imageWidth: 200,\n };\n }\n\n return null;\n}\n\nexport function getAndroidDarkSplashConfig(\n config: Pick<ExpoConfig, 'splash' | 'android'>,\n props?: AndroidSplashConfig | null\n): SplashScreenConfig | null {\n if (props?.dark) {\n const splash = props.dark;\n const lightTheme = getAndroidSplashConfig(config, props);\n return {\n xxxhdpi: splash.xxxhdpi ?? splash.image,\n xxhdpi: splash.xxhdpi ?? splash.image,\n xhdpi: splash.xhdpi ?? splash.image,\n hdpi: splash.hdpi ?? splash.image,\n mdpi: splash.mdpi ?? splash.image,\n backgroundColor: splash.backgroundColor,\n resizeMode: lightTheme?.resizeMode ?? defaultResizeMode,\n };\n }\n\n // Respect the splash screen object, don't mix and match across different splash screen objects\n // in case the user wants the top level splash to apply to every platform except android.\n if (config.android?.splash?.dark) {\n const splash = config.android?.splash?.dark;\n const lightTheme = getAndroidSplashConfig(config, props);\n return {\n xxxhdpi: splash.xxxhdpi ?? splash.image,\n xxhdpi: splash.xxhdpi ?? splash.image,\n xhdpi: splash.xhdpi ?? splash.image,\n hdpi: splash.hdpi ?? splash.image,\n mdpi: splash.mdpi ?? splash.image,\n backgroundColor: splash.backgroundColor,\n // Can't support dark resizeMode because the resize mode is hardcoded into the MainActivity.java\n resizeMode: lightTheme?.resizeMode ?? defaultResizeMode,\n };\n }\n\n return null;\n}\n"],"mappings":";;;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AAI;IAC3C,MAAMC,UAAU,GAAGhB,sBAAsB,CAACC,MAAM,EAAEC,KAAK,CAAC;IACxD,OAAO;MACLE,OAAO,EAAED,MAAM,CAACC,OAAO,IAAID,MAAM,CAACE,KAAK;MACvCC,MAAM,EAAEH,MAAM,CAACG,MAAM,IAAIH,MAAM,CAACE,KAAK;MACrCE,KAAK,EAAEJ,MAAM,CAACI,KAAK,IAAIJ,MAAM,CAACE,KAAK;MACnCG,IAAI,EAAEL,MAAM,CAACK,IAAI,IAAIL,MAAM,CAACE,KAAK;MACjCI,IAAI,EAAEN,MAAM,CAACM,IAAI,IAAIN,MAAM,CAACE,KAAK;MACjCK,eAAe,EAAEP,MAAM,CAACO,eAAe;MACvC;MACAC,UAAU,EAAEK,UAAU,EAAEL,UAAU,IAAIZ;IACxC,CAAC;EACH;EAEA,OAAO,IAAI;AACb","ignoreList":[]}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { ExpoConfig } from '@expo/config-types';
|
|
2
2
|
type ExpoConfigIosSplash = NonNullable<NonNullable<ExpoConfig['ios']>['splash']>;
|
|
3
3
|
export interface IOSSplashConfig {
|
|
4
|
-
|
|
5
|
-
image?: string
|
|
4
|
+
imageWidth?: number;
|
|
5
|
+
image?: string;
|
|
6
6
|
backgroundColor: string;
|
|
7
|
+
enableFullScreenImage_legacy?: boolean;
|
|
7
8
|
resizeMode: NonNullable<ExpoConfigIosSplash['resizeMode']>;
|
|
8
|
-
tabletImage
|
|
9
|
-
tabletBackgroundColor
|
|
9
|
+
tabletImage?: string;
|
|
10
|
+
tabletBackgroundColor?: string;
|
|
10
11
|
dark?: {
|
|
11
|
-
image?: string
|
|
12
|
-
backgroundColor?: string
|
|
13
|
-
tabletImage?: string
|
|
14
|
-
tabletBackgroundColor?: string
|
|
12
|
+
image?: string;
|
|
13
|
+
backgroundColor?: string;
|
|
14
|
+
tabletImage?: string;
|
|
15
|
+
tabletBackgroundColor?: string;
|
|
15
16
|
};
|
|
16
17
|
}
|
|
17
|
-
export declare function getIosSplashConfig(config: ExpoConfig): IOSSplashConfig | null;
|
|
18
|
+
export declare function getIosSplashConfig(config: ExpoConfig, props: IOSSplashConfig | null): IOSSplashConfig | null;
|
|
18
19
|
export {};
|
|
@@ -7,48 +7,64 @@ exports.getIosSplashConfig = getIosSplashConfig;
|
|
|
7
7
|
const defaultResizeMode = 'contain';
|
|
8
8
|
const defaultBackgroundColor = '#ffffff';
|
|
9
9
|
// TODO: Maybe use an array on splash with theme value. Then remove the array in serialization for legacy and manifest.
|
|
10
|
-
function getIosSplashConfig(config) {
|
|
10
|
+
function getIosSplashConfig(config, props) {
|
|
11
11
|
// Respect the splash screen object, don't mix and match across different splash screen objects
|
|
12
12
|
// in case the user wants the top level splash to apply to every platform except iOS.
|
|
13
|
+
|
|
14
|
+
// We are using the config plugin
|
|
15
|
+
if (props) {
|
|
16
|
+
const splash = props;
|
|
17
|
+
return {
|
|
18
|
+
image: splash.image,
|
|
19
|
+
resizeMode: splash.resizeMode ?? defaultResizeMode,
|
|
20
|
+
backgroundColor: splash.backgroundColor ?? defaultBackgroundColor,
|
|
21
|
+
tabletImage: splash.tabletImage,
|
|
22
|
+
tabletBackgroundColor: splash.tabletBackgroundColor,
|
|
23
|
+
enableFullScreenImage_legacy: splash.enableFullScreenImage_legacy,
|
|
24
|
+
dark: {
|
|
25
|
+
image: splash.dark?.image,
|
|
26
|
+
backgroundColor: splash.dark?.backgroundColor,
|
|
27
|
+
tabletImage: splash.dark?.tabletImage,
|
|
28
|
+
tabletBackgroundColor: splash.dark?.tabletBackgroundColor
|
|
29
|
+
},
|
|
30
|
+
imageWidth: splash.imageWidth
|
|
31
|
+
};
|
|
32
|
+
}
|
|
13
33
|
if (config.ios?.splash) {
|
|
14
34
|
const splash = config.ios?.splash;
|
|
15
|
-
const image = splash.image
|
|
35
|
+
const image = splash.image;
|
|
16
36
|
return {
|
|
17
37
|
image,
|
|
18
38
|
resizeMode: splash.resizeMode ?? defaultResizeMode,
|
|
19
39
|
backgroundColor: splash.backgroundColor ?? defaultBackgroundColor,
|
|
20
|
-
tabletImage: splash.tabletImage
|
|
40
|
+
tabletImage: splash.tabletImage,
|
|
21
41
|
tabletBackgroundColor: splash.tabletBackgroundColor,
|
|
42
|
+
enableFullScreenImage_legacy: true,
|
|
22
43
|
dark: {
|
|
23
|
-
image: splash.dark?.image
|
|
44
|
+
image: splash.dark?.image,
|
|
24
45
|
backgroundColor: splash.dark?.backgroundColor,
|
|
25
|
-
tabletImage: splash.dark?.tabletImage
|
|
46
|
+
tabletImage: splash.dark?.tabletImage,
|
|
26
47
|
tabletBackgroundColor: splash.dark?.tabletBackgroundColor
|
|
27
|
-
}
|
|
48
|
+
},
|
|
49
|
+
imageWidth: 200
|
|
28
50
|
};
|
|
29
51
|
}
|
|
30
52
|
if (config.splash) {
|
|
31
53
|
const splash = config.splash;
|
|
32
|
-
const image = splash.image
|
|
54
|
+
const image = splash.image;
|
|
33
55
|
return {
|
|
34
56
|
image,
|
|
35
57
|
resizeMode: splash.resizeMode ?? defaultResizeMode,
|
|
36
58
|
backgroundColor: splash.backgroundColor ?? defaultBackgroundColor,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
dark: {
|
|
40
|
-
image: null,
|
|
41
|
-
backgroundColor: null,
|
|
42
|
-
tabletImage: null,
|
|
43
|
-
tabletBackgroundColor: null
|
|
44
|
-
}
|
|
59
|
+
enableFullScreenImage_legacy: true,
|
|
60
|
+
imageWidth: 200
|
|
45
61
|
};
|
|
46
62
|
}
|
|
47
63
|
return {
|
|
48
64
|
backgroundColor: '#ffffff',
|
|
49
65
|
resizeMode: 'contain',
|
|
50
|
-
|
|
51
|
-
|
|
66
|
+
enableFullScreenImage_legacy: true,
|
|
67
|
+
imageWidth: 200
|
|
52
68
|
};
|
|
53
69
|
}
|
|
54
70
|
//# sourceMappingURL=getIosSplashConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getIosSplashConfig.js","names":["defaultResizeMode","defaultBackgroundColor","getIosSplashConfig","config","
|
|
1
|
+
{"version":3,"file":"getIosSplashConfig.js","names":["defaultResizeMode","defaultBackgroundColor","getIosSplashConfig","config","props","splash","image","resizeMode","backgroundColor","tabletImage","tabletBackgroundColor","enableFullScreenImage_legacy","dark","imageWidth","ios"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/getIosSplashConfig.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\ntype ExpoConfigIosSplash = NonNullable<NonNullable<ExpoConfig['ios']>['splash']>;\n\nconst defaultResizeMode = 'contain';\nconst defaultBackgroundColor = '#ffffff';\n\nexport interface IOSSplashConfig {\n imageWidth?: number;\n image?: string;\n // tabletImage: string | null;\n backgroundColor: string;\n enableFullScreenImage_legacy?: boolean;\n resizeMode: NonNullable<ExpoConfigIosSplash['resizeMode']>;\n tabletImage?: string;\n // TODO: These are here just to test the functionality, the API should be more robust and account for tablet images.\n tabletBackgroundColor?: string;\n dark?: {\n image?: string;\n backgroundColor?: string;\n tabletImage?: string;\n tabletBackgroundColor?: string;\n };\n}\n\n// TODO: Maybe use an array on splash with theme value. Then remove the array in serialization for legacy and manifest.\nexport function getIosSplashConfig(\n config: ExpoConfig,\n props: IOSSplashConfig | null\n): IOSSplashConfig | null {\n // Respect the splash screen object, don't mix and match across different splash screen objects\n // in case the user wants the top level splash to apply to every platform except iOS.\n\n // We are using the config plugin\n if (props) {\n const splash = props;\n return {\n image: splash.image,\n resizeMode: splash.resizeMode ?? defaultResizeMode,\n backgroundColor: splash.backgroundColor ?? defaultBackgroundColor,\n tabletImage: splash.tabletImage,\n tabletBackgroundColor: splash.tabletBackgroundColor,\n enableFullScreenImage_legacy: splash.enableFullScreenImage_legacy,\n dark: {\n image: splash.dark?.image,\n backgroundColor: splash.dark?.backgroundColor,\n tabletImage: splash.dark?.tabletImage,\n tabletBackgroundColor: splash.dark?.tabletBackgroundColor,\n },\n imageWidth: splash.imageWidth,\n };\n }\n\n if (config.ios?.splash) {\n const splash = config.ios?.splash;\n const image = splash.image;\n return {\n image,\n resizeMode: splash.resizeMode ?? defaultResizeMode,\n backgroundColor: splash.backgroundColor ?? defaultBackgroundColor,\n tabletImage: splash.tabletImage,\n tabletBackgroundColor: splash.tabletBackgroundColor,\n enableFullScreenImage_legacy: true,\n dark: {\n image: splash.dark?.image,\n backgroundColor: splash.dark?.backgroundColor,\n tabletImage: splash.dark?.tabletImage,\n tabletBackgroundColor: splash.dark?.tabletBackgroundColor,\n },\n imageWidth: 200,\n };\n }\n\n if (config.splash) {\n const splash = config.splash;\n const image = splash.image;\n return {\n image,\n resizeMode: splash.resizeMode ?? defaultResizeMode,\n backgroundColor: splash.backgroundColor ?? defaultBackgroundColor,\n enableFullScreenImage_legacy: true,\n imageWidth: 200,\n };\n }\n\n return {\n backgroundColor: '#ffffff',\n resizeMode: 'contain',\n enableFullScreenImage_legacy: true,\n imageWidth: 200,\n };\n}\n"],"mappings":";;;;;;AAIA,MAAMA,iBAAiB,GAAG,SAAS;AACnC,MAAMC,sBAAsB,GAAG,SAAS;AAoBxC;AACO,SAASC,kBAAkBA,CAChCC,MAAkB,EAClBC,KAA6B,EACL;EACxB;EACA;;EAEA;EACA,IAAIA,KAAK,EAAE;IACT,MAAMC,MAAM,GAAGD,KAAK;IACpB,OAAO;MACLE,KAAK,EAAED,MAAM,CAACC,KAAK;MACnBC,UAAU,EAAEF,MAAM,CAACE,UAAU,IAAIP,iBAAiB;MAClDQ,eAAe,EAAEH,MAAM,CAACG,eAAe,IAAIP,sBAAsB;MACjEQ,WAAW,EAAEJ,MAAM,CAACI,WAAW;MAC/BC,qBAAqB,EAAEL,MAAM,CAACK,qBAAqB;MACnDC,4BAA4B,EAAEN,MAAM,CAACM,4BAA4B;MACjEC,IAAI,EAAE;QACJN,KAAK,EAAED,MAAM,CAACO,IAAI,EAAEN,KAAK;QACzBE,eAAe,EAAEH,MAAM,CAACO,IAAI,EAAEJ,eAAe;QAC7CC,WAAW,EAAEJ,MAAM,CAACO,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CAAC;AACH","ignoreList":[]}
|
|
@@ -9,5 +9,5 @@ export declare const withAndroidSplashImages: ConfigPlugin<AndroidSplashConfig>;
|
|
|
9
9
|
*
|
|
10
10
|
* @param androidMainPath Absolute path to the main directory containing code and resources in Android project. In general that would be `android/app/src/main`.
|
|
11
11
|
*/
|
|
12
|
-
export declare function setSplashImageDrawablesAsync(config: Pick<ExpoConfig, 'android' | 'splash'>, props: AndroidSplashConfig | null, projectRoot: string,
|
|
13
|
-
export declare function setSplashImageDrawablesForThemeAsync(config: SplashScreenConfig | null, theme: 'dark' | 'light', projectRoot: string,
|
|
12
|
+
export declare function setSplashImageDrawablesAsync(config: Pick<ExpoConfig, 'android' | 'splash'>, props: AndroidSplashConfig | null, projectRoot: string, imageWidth: number): Promise<void>;
|
|
13
|
+
export declare function setSplashImageDrawablesForThemeAsync(config: SplashScreenConfig | null, theme: 'dark' | 'light', projectRoot: string, imageWidth?: number): Promise<void>;
|
|
@@ -114,7 +114,7 @@ const DRAWABLES_CONFIGS = {
|
|
|
114
114
|
};
|
|
115
115
|
const withAndroidSplashImages = (config, props) => {
|
|
116
116
|
return (0, _configPlugins().withDangerousMod)(config, ['android', async config => {
|
|
117
|
-
await setSplashImageDrawablesAsync(config, props, config.modRequest.projectRoot, props?.
|
|
117
|
+
await setSplashImageDrawablesAsync(config, props, config.modRequest.projectRoot, props?.imageWidth ?? 100);
|
|
118
118
|
return config;
|
|
119
119
|
}]);
|
|
120
120
|
};
|
|
@@ -127,11 +127,11 @@ const withAndroidSplashImages = (config, props) => {
|
|
|
127
127
|
* @param androidMainPath Absolute path to the main directory containing code and resources in Android project. In general that would be `android/app/src/main`.
|
|
128
128
|
*/
|
|
129
129
|
exports.withAndroidSplashImages = withAndroidSplashImages;
|
|
130
|
-
async function setSplashImageDrawablesAsync(config, props, projectRoot,
|
|
130
|
+
async function setSplashImageDrawablesAsync(config, props, projectRoot, imageWidth) {
|
|
131
131
|
await clearAllExistingSplashImagesAsync(projectRoot);
|
|
132
132
|
const splash = (0, _getAndroidSplashConfig().getAndroidSplashConfig)(config, props);
|
|
133
133
|
const darkSplash = (0, _getAndroidSplashConfig().getAndroidDarkSplashConfig)(config, props);
|
|
134
|
-
await Promise.all([setSplashImageDrawablesForThemeAsync(splash, 'light', projectRoot,
|
|
134
|
+
await Promise.all([setSplashImageDrawablesForThemeAsync(splash, 'light', projectRoot, imageWidth), setSplashImageDrawablesForThemeAsync(darkSplash, 'dark', projectRoot, imageWidth)]);
|
|
135
135
|
}
|
|
136
136
|
async function clearAllExistingSplashImagesAsync(projectRoot) {
|
|
137
137
|
const androidMainPath = _path().default.join(projectRoot, 'android/app/src/main');
|
|
@@ -147,7 +147,7 @@ async function clearAllExistingSplashImagesAsync(projectRoot) {
|
|
|
147
147
|
}));
|
|
148
148
|
}));
|
|
149
149
|
}
|
|
150
|
-
async function setSplashImageDrawablesForThemeAsync(config, theme, projectRoot,
|
|
150
|
+
async function setSplashImageDrawablesForThemeAsync(config, theme, projectRoot, imageWidth = 100) {
|
|
151
151
|
if (!config) return;
|
|
152
152
|
const androidMainPath = _path().default.join(projectRoot, 'android/app/src/main');
|
|
153
153
|
const sizes = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi', 'xxxhdpi'];
|
|
@@ -156,7 +156,7 @@ async function setSplashImageDrawablesForThemeAsync(config, theme, projectRoot,
|
|
|
156
156
|
const image = config[imageKey];
|
|
157
157
|
if (image) {
|
|
158
158
|
const multiplier = DRAWABLES_CONFIGS[imageKey].dimensionsMultiplier;
|
|
159
|
-
const size =
|
|
159
|
+
const size = imageWidth * multiplier; // "imageWidth" must be replaced by the logo width chosen by the user in its config file
|
|
160
160
|
const canvasSize = 288 * multiplier;
|
|
161
161
|
const background = await (0, _imageUtils().generateImageBackgroundAsync)({
|
|
162
162
|
width: canvasSize,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withAndroidSplashImages.js","names":["_configPlugins","data","require","_imageUtils","_fsExtra","_interopRequireDefault","_path","_getAndroidSplashConfig","e","__esModule","default","IMAGE_CACHE_NAME","SPLASH_SCREEN_FILENAME","DRAWABLES_CONFIGS","modes","light","path","dark","dimensionsMultiplier","mdpi","hdpi","xhdpi","xxhdpi","xxxhdpi","withAndroidSplashImages","config","props","withDangerousMod","setSplashImageDrawablesAsync","modRequest","projectRoot","logoWidth","exports","clearAllExistingSplashImagesAsync","splash","getAndroidSplashConfig","darkSplash","getAndroidDarkSplashConfig","Promise","all","setSplashImageDrawablesForThemeAsync","androidMainPath","join","Object","values","map","filePath","fs","pathExists","resolve","remove","theme","sizes","imageKey","image","multiplier","size","canvasSize","background","generateImageBackgroundAsync","width","height","backgroundColor","resizeMode","source","foreground","generateImageAsync","cacheType","src","composedImage","compositeImagesAsync","x","y","outputPath","folder","dirname","ensureDir","writeFile"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withAndroidSplashImages.ts"],"sourcesContent":["import { ConfigPlugin, withDangerousMod } from '@expo/config-plugins';\nimport { ExpoConfig } from '@expo/config-types';\nimport {\n generateImageAsync,\n compositeImagesAsync,\n generateImageBackgroundAsync,\n} from '@expo/image-utils';\nimport fs from 'fs-extra';\nimport path from 'path';\n\nimport {\n AndroidSplashConfig,\n getAndroidDarkSplashConfig,\n getAndroidSplashConfig,\n SplashScreenConfig,\n} from './getAndroidSplashConfig';\n\ntype DRAWABLE_SIZE = 'default' | 'mdpi' | 'hdpi' | 'xhdpi' | 'xxhdpi' | 'xxxhdpi';\ntype THEME = 'light' | 'dark';\n\nconst IMAGE_CACHE_NAME = 'splash-android';\nconst SPLASH_SCREEN_FILENAME = 'splashscreen_logo.png';\nconst DRAWABLES_CONFIGS: {\n [key in DRAWABLE_SIZE]: {\n modes: {\n [key in THEME]: {\n path: string;\n };\n };\n dimensionsMultiplier: number;\n };\n} = {\n default: {\n modes: {\n light: {\n path: `./res/drawable/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 1,\n },\n mdpi: {\n modes: {\n light: {\n path: `./res/drawable-mdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night-mdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 1,\n },\n hdpi: {\n modes: {\n light: {\n path: `./res/drawable-hdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night-hdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 1.5,\n },\n xhdpi: {\n modes: {\n light: {\n path: `./res/drawable-xhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night-xhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 2,\n },\n xxhdpi: {\n modes: {\n light: {\n path: `./res/drawable-xxhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night-xxhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 3,\n },\n xxxhdpi: {\n modes: {\n light: {\n path: `./res/drawable-xxxhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night-xxxhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 4,\n },\n};\n\nexport const withAndroidSplashImages: ConfigPlugin<AndroidSplashConfig> = (config, props) => {\n return withDangerousMod(config, [\n 'android',\n async (config) => {\n await setSplashImageDrawablesAsync(\n config,\n props,\n config.modRequest.projectRoot,\n props?.logoWidth ?? 100\n );\n return config;\n },\n ]);\n};\n\n/**\n * Deletes all previous splash_screen_images and copies new one to desired drawable directory.\n * If path isn't provided then no new image is placed in drawable directories.\n * @see https://developer.android.com/training/multiscreen/screendensities\n *\n * @param androidMainPath Absolute path to the main directory containing code and resources in Android project. In general that would be `android/app/src/main`.\n */\nexport async function setSplashImageDrawablesAsync(\n config: Pick<ExpoConfig, 'android' | 'splash'>,\n props: AndroidSplashConfig | null,\n projectRoot: string,\n logoWidth: number\n) {\n await clearAllExistingSplashImagesAsync(projectRoot);\n\n const splash = getAndroidSplashConfig(config, props);\n const darkSplash = getAndroidDarkSplashConfig(config, props);\n\n await Promise.all([\n setSplashImageDrawablesForThemeAsync(splash, 'light', projectRoot, logoWidth),\n setSplashImageDrawablesForThemeAsync(darkSplash, 'dark', projectRoot, logoWidth),\n ]);\n}\n\nasync function clearAllExistingSplashImagesAsync(projectRoot: string) {\n const androidMainPath = path.join(projectRoot, 'android/app/src/main');\n\n await Promise.all(\n Object.values(DRAWABLES_CONFIGS).map(async ({ modes }) => {\n await Promise.all(\n Object.values(modes).map(async ({ path: filePath }) => {\n if (await fs.pathExists(path.resolve(androidMainPath, filePath))) {\n await fs.remove(path.resolve(androidMainPath, filePath));\n }\n })\n );\n })\n );\n}\n\nexport async function setSplashImageDrawablesForThemeAsync(\n config: SplashScreenConfig | null,\n theme: 'dark' | 'light',\n projectRoot: string,\n logoWidth: number\n) {\n if (!config) return;\n const androidMainPath = path.join(projectRoot, 'android/app/src/main');\n\n const sizes: DRAWABLE_SIZE[] = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi', 'xxxhdpi'];\n\n await Promise.all(\n sizes.map(async (imageKey) => {\n // @ts-ignore\n const image = config[imageKey];\n\n if (image) {\n const multiplier = DRAWABLES_CONFIGS[imageKey].dimensionsMultiplier;\n const size = logoWidth * multiplier; // \"logoWidth\" must be replaced by the logo width chosen by the user in its config file\n const canvasSize = 288 * multiplier;\n\n const background = await generateImageBackgroundAsync({\n width: canvasSize,\n height: canvasSize,\n backgroundColor: config.backgroundColor ?? 'transparent',\n resizeMode: 'cover',\n });\n\n const { source: foreground } = await generateImageAsync(\n {\n projectRoot,\n cacheType: IMAGE_CACHE_NAME,\n },\n {\n src: image,\n resizeMode: 'contain',\n width: size,\n height: size,\n }\n );\n\n const composedImage = await compositeImagesAsync({\n background,\n foreground,\n x: (canvasSize - size) / 2,\n y: (canvasSize - size) / 2,\n });\n\n // Get output path for drawable.\n const outputPath = path.join(\n androidMainPath,\n DRAWABLES_CONFIGS[imageKey].modes[theme].path\n );\n\n const folder = path.dirname(outputPath);\n // Ensure directory exists.\n await fs.ensureDir(folder);\n await fs.writeFile(outputPath, composedImage);\n }\n return null;\n })\n );\n}\n"],"mappings":";;;;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAKA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,MAAA;EAAA,MAAAL,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAI,KAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,wBAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,uBAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAKkC,SAAAI,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAKlC,MAAMG,gBAAgB,GAAG,gBAAgB;AACzC,MAAMC,sBAAsB,GAAG,uBAAuB;AACtD,MAAMC,iBASL,GAAG;EACFH,OAAO,EAAE;IACPI,KAAK,EAAE;MACLC,KAAK,EAAE;QACLC,IAAI,EAAE,kBAAkBJ,sBAAsB;MAChD,CAAC;MACDK,IAAI,EAAE;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QACrBH,KAAK,EAAEJ,IAAI;QACXK,MAAM,EAAEL;MACV,CACF,CAAC;MAED,MAAMa,aAAa,GAAG,MAAM,IAAAC,kCAAoB,EAAC;QAC/CZ,UAAU;QACVO,UAAU;QACVM,CAAC,EAAE,CAACd,UAAU,GAAGD,IAAI,IAAI,CAAC;QAC1BgB,CAAC,EAAE,CAACf,UAAU,GAAGD,IAAI,IAAI;MAC3B,CAAC,CAAC;;MAEF;MACA,MAAMiB,UAAU,GAAGzD,eAAI,CAAC0B,IAAI,CAC1BD,eAAe,EACf5B,iBAAiB,CAACwC,QAAQ,CAAC,CAACvC,KAAK,CAACqC,KAAK,CAAC,CAACnC,IAC3C,CAAC;MAED,MAAM0D,MAAM,GAAG1D,eAAI,CAAC2D,OAAO,CAACF,UAAU,CAAC;MACvC;MACA,MAAM1B,kBAAE,CAAC6B,SAAS,CAACF,MAAM,CAAC;MAC1B,MAAM3B,kBAAE,CAAC8B,SAAS,CAACJ,UAAU,EAAEJ,aAAa,CAAC;IAC/C;IACA,OAAO,IAAI;EACb,CAAC,CACH,CAAC;AACH","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"withAndroidSplashImages.js","names":["_configPlugins","data","require","_imageUtils","_fsExtra","_interopRequireDefault","_path","_getAndroidSplashConfig","e","__esModule","default","IMAGE_CACHE_NAME","SPLASH_SCREEN_FILENAME","DRAWABLES_CONFIGS","modes","light","path","dark","dimensionsMultiplier","mdpi","hdpi","xhdpi","xxhdpi","xxxhdpi","withAndroidSplashImages","config","props","withDangerousMod","setSplashImageDrawablesAsync","modRequest","projectRoot","imageWidth","exports","clearAllExistingSplashImagesAsync","splash","getAndroidSplashConfig","darkSplash","getAndroidDarkSplashConfig","Promise","all","setSplashImageDrawablesForThemeAsync","androidMainPath","join","Object","values","map","filePath","fs","pathExists","resolve","remove","theme","sizes","imageKey","image","multiplier","size","canvasSize","background","generateImageBackgroundAsync","width","height","backgroundColor","resizeMode","source","foreground","generateImageAsync","cacheType","src","composedImage","compositeImagesAsync","x","y","outputPath","folder","dirname","ensureDir","writeFile"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withAndroidSplashImages.ts"],"sourcesContent":["import { ConfigPlugin, withDangerousMod } from '@expo/config-plugins';\nimport { ExpoConfig } from '@expo/config-types';\nimport {\n generateImageAsync,\n compositeImagesAsync,\n generateImageBackgroundAsync,\n} from '@expo/image-utils';\nimport fs from 'fs-extra';\nimport path from 'path';\n\nimport {\n AndroidSplashConfig,\n getAndroidDarkSplashConfig,\n getAndroidSplashConfig,\n SplashScreenConfig,\n} from './getAndroidSplashConfig';\n\ntype DRAWABLE_SIZE = 'default' | 'mdpi' | 'hdpi' | 'xhdpi' | 'xxhdpi' | 'xxxhdpi';\ntype THEME = 'light' | 'dark';\n\nconst IMAGE_CACHE_NAME = 'splash-android';\nconst SPLASH_SCREEN_FILENAME = 'splashscreen_logo.png';\nconst DRAWABLES_CONFIGS: {\n [key in DRAWABLE_SIZE]: {\n modes: {\n [key in THEME]: {\n path: string;\n };\n };\n dimensionsMultiplier: number;\n };\n} = {\n default: {\n modes: {\n light: {\n path: `./res/drawable/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 1,\n },\n mdpi: {\n modes: {\n light: {\n path: `./res/drawable-mdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night-mdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 1,\n },\n hdpi: {\n modes: {\n light: {\n path: `./res/drawable-hdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night-hdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 1.5,\n },\n xhdpi: {\n modes: {\n light: {\n path: `./res/drawable-xhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night-xhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 2,\n },\n xxhdpi: {\n modes: {\n light: {\n path: `./res/drawable-xxhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night-xxhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 3,\n },\n xxxhdpi: {\n modes: {\n light: {\n path: `./res/drawable-xxxhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night-xxxhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 4,\n },\n};\n\nexport const withAndroidSplashImages: ConfigPlugin<AndroidSplashConfig> = (config, props) => {\n return withDangerousMod(config, [\n 'android',\n async (config) => {\n await setSplashImageDrawablesAsync(\n config,\n props,\n config.modRequest.projectRoot,\n props?.imageWidth ?? 100\n );\n return config;\n },\n ]);\n};\n\n/**\n * Deletes all previous splash_screen_images and copies new one to desired drawable directory.\n * If path isn't provided then no new image is placed in drawable directories.\n * @see https://developer.android.com/training/multiscreen/screendensities\n *\n * @param androidMainPath Absolute path to the main directory containing code and resources in Android project. In general that would be `android/app/src/main`.\n */\nexport async function setSplashImageDrawablesAsync(\n config: Pick<ExpoConfig, 'android' | 'splash'>,\n props: AndroidSplashConfig | null,\n projectRoot: string,\n imageWidth: number\n) {\n await clearAllExistingSplashImagesAsync(projectRoot);\n\n const splash = getAndroidSplashConfig(config, props);\n const darkSplash = getAndroidDarkSplashConfig(config, props);\n\n await Promise.all([\n setSplashImageDrawablesForThemeAsync(splash, 'light', projectRoot, imageWidth),\n setSplashImageDrawablesForThemeAsync(darkSplash, 'dark', projectRoot, imageWidth),\n ]);\n}\n\nasync function clearAllExistingSplashImagesAsync(projectRoot: string) {\n const androidMainPath = path.join(projectRoot, 'android/app/src/main');\n\n await Promise.all(\n Object.values(DRAWABLES_CONFIGS).map(async ({ modes }) => {\n await Promise.all(\n Object.values(modes).map(async ({ path: filePath }) => {\n if (await fs.pathExists(path.resolve(androidMainPath, filePath))) {\n await fs.remove(path.resolve(androidMainPath, filePath));\n }\n })\n );\n })\n );\n}\n\nexport async function setSplashImageDrawablesForThemeAsync(\n config: SplashScreenConfig | null,\n theme: 'dark' | 'light',\n projectRoot: string,\n imageWidth: number = 100\n) {\n if (!config) return;\n const androidMainPath = path.join(projectRoot, 'android/app/src/main');\n\n const sizes: DRAWABLE_SIZE[] = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi', 'xxxhdpi'];\n\n await Promise.all(\n sizes.map(async (imageKey) => {\n // @ts-ignore\n const image = config[imageKey];\n\n if (image) {\n const multiplier = DRAWABLES_CONFIGS[imageKey].dimensionsMultiplier;\n const size = imageWidth * multiplier; // \"imageWidth\" must be replaced by the logo width chosen by the user in its config file\n const canvasSize = 288 * multiplier;\n\n const background = await generateImageBackgroundAsync({\n width: canvasSize,\n height: canvasSize,\n backgroundColor: config.backgroundColor ?? 'transparent',\n resizeMode: 'cover',\n });\n\n const { source: foreground } = await generateImageAsync(\n {\n projectRoot,\n cacheType: IMAGE_CACHE_NAME,\n },\n {\n src: image,\n resizeMode: 'contain',\n width: size,\n height: size,\n }\n );\n\n const composedImage = await compositeImagesAsync({\n background,\n foreground,\n x: (canvasSize - size) / 2,\n y: (canvasSize - size) / 2,\n });\n\n // Get output path for drawable.\n const outputPath = path.join(\n androidMainPath,\n DRAWABLES_CONFIGS[imageKey].modes[theme].path\n );\n\n const folder = path.dirname(outputPath);\n // Ensure directory exists.\n await fs.ensureDir(folder);\n await fs.writeFile(outputPath, composedImage);\n }\n return null;\n })\n );\n}\n"],"mappings":";;;;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,I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D,MAAM,GAAG1D,eAAI,CAAC2D,OAAO,CAACF,UAAU,CAAC;MACvC;MACA,MAAM1B,kBAAE,CAAC6B,SAAS,CAACF,MAAM,CAAC;MAC1B,MAAM3B,kBAAE,CAAC8B,SAAS,CAACJ,UAAU,EAAEJ,aAAa,CAAC;IAC/C;IACA,OAAO,IAAI;EACb,CAAC,CACH,CAAC;AACH","ignoreList":[]}
|
|
@@ -123,8 +123,8 @@ function setSplashStylesForTheme(styles) {
|
|
|
123
123
|
// Add splash screen image
|
|
124
124
|
return _configPlugins().AndroidConfig.Styles.assignStylesValue(styles, {
|
|
125
125
|
add: true,
|
|
126
|
-
value: '@drawable/
|
|
127
|
-
name: 'android:
|
|
126
|
+
value: '@drawable/splashscreen_logo',
|
|
127
|
+
name: 'android:windowSplashScreenBackground',
|
|
128
128
|
parent: styleResourceGroup
|
|
129
129
|
});
|
|
130
130
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withAndroidSplashStyles.js","names":["_configPlugins","data","require","_android","_getAndroidSplashConfig","styleResourceGroup","name","parent","SPLASH_COLOR_NAME","withAndroidSplashStyles","config","props","withAndroidColors","backgroundColor","getSplashBackgroundColor","modResults","setSplashColorsForTheme","withAndroidColorsNight","getSplashDarkBackgroundColor","withAndroidStyles","removeOldSplashStyleGroup","addSplashScreenStyle","exports","styles","resources","style","item","$","_","filter","group","head","matches","getAndroidSplashConfig","getAndroidDarkSplashConfig","setSplashStylesForTheme","AndroidConfig","Styles","assignStylesValue","add","value","colors","Colors","assignColorValue"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withAndroidSplashStyles.ts"],"sourcesContent":["import {\n AndroidConfig,\n ConfigPlugin,\n withAndroidColors,\n withAndroidColorsNight,\n withAndroidStyles,\n} from '@expo/config-plugins';\nimport { Colors } from '@expo/config-plugins/build/android';\nimport { ExpoConfig } from '@expo/config-types';\n\nimport {\n AndroidSplashConfig,\n getAndroidDarkSplashConfig,\n getAndroidSplashConfig,\n} from './getAndroidSplashConfig';\n\nconst styleResourceGroup = {\n name: 'Theme.App.SplashScreen',\n parent: 'Theme.SplashScreen',\n};\n\nconst SPLASH_COLOR_NAME = 'splashscreen_background';\n\nexport const withAndroidSplashStyles: ConfigPlugin<AndroidSplashConfig> = (config, props) => {\n config = withAndroidColors(config, (config) => {\n const backgroundColor = getSplashBackgroundColor(config, props);\n if (!backgroundColor) {\n return config;\n }\n config.modResults = setSplashColorsForTheme(config.modResults, backgroundColor);\n return config;\n });\n config = withAndroidColorsNight(config, (config) => {\n const backgroundColor = getSplashDarkBackgroundColor(config, props);\n if (!backgroundColor) {\n return config;\n }\n config.modResults = setSplashColorsForTheme(config.modResults, backgroundColor);\n return config;\n });\n config = withAndroidStyles(config, (config) => {\n config.modResults = removeOldSplashStyleGroup(config.modResults);\n config.modResults = addSplashScreenStyle(config.modResults);\n return config;\n });\n return config;\n};\n\n// Add the style that extends Theme.SplashScreen\nfunction addSplashScreenStyle(styles: AndroidConfig.Resources.ResourceXML) {\n const { resources } = styles;\n const { style = [] } = resources;\n\n const item = [\n {\n $: { name: 'windowSplashScreenBackground' },\n _: '@color/splashscreen_background',\n },\n {\n $: { name: 'windowSplashScreenAnimatedIcon' },\n _: '@drawable/splashscreen_logo',\n },\n {\n $: { name: 'postSplashScreenTheme' },\n _: '@style/AppTheme',\n },\n ];\n\n styles.resources.style = [\n ...style.filter(({ $ }) => $.name !== 'Theme.App.SplashScreen'),\n {\n $: {\n ...styleResourceGroup,\n },\n item,\n },\n ];\n\n return styles;\n}\n\n// Remove the old style group which didn't extend the base theme properly.\nexport function removeOldSplashStyleGroup(styles: AndroidConfig.Resources.ResourceXML) {\n const group = {\n name: 'Theme.App.SplashScreen',\n parent: 'Theme.AppCompat.Light.NoActionBar',\n };\n\n styles.resources.style = styles.resources.style?.filter?.(({ $: head }) => {\n let matches = head.name === group.name;\n if (group.parent != null && matches) {\n matches = head.parent === group.parent;\n }\n return !matches;\n });\n\n return styles;\n}\n\nexport function getSplashBackgroundColor(\n config: ExpoConfig,\n props: AndroidSplashConfig | null\n): string | null {\n return getAndroidSplashConfig(config, props)?.backgroundColor ?? null;\n}\n\nexport function getSplashDarkBackgroundColor(\n config: ExpoConfig,\n props: AndroidSplashConfig | null\n): string | null {\n return getAndroidDarkSplashConfig(config, props)?.backgroundColor ?? null;\n}\n\nexport function setSplashStylesForTheme(styles: AndroidConfig.Resources.ResourceXML) {\n // Add splash screen image\n return AndroidConfig.Styles.assignStylesValue(styles, {\n add: true,\n value: '@drawable/
|
|
1
|
+
{"version":3,"file":"withAndroidSplashStyles.js","names":["_configPlugins","data","require","_android","_getAndroidSplashConfig","styleResourceGroup","name","parent","SPLASH_COLOR_NAME","withAndroidSplashStyles","config","props","withAndroidColors","backgroundColor","getSplashBackgroundColor","modResults","setSplashColorsForTheme","withAndroidColorsNight","getSplashDarkBackgroundColor","withAndroidStyles","removeOldSplashStyleGroup","addSplashScreenStyle","exports","styles","resources","style","item","$","_","filter","group","head","matches","getAndroidSplashConfig","getAndroidDarkSplashConfig","setSplashStylesForTheme","AndroidConfig","Styles","assignStylesValue","add","value","colors","Colors","assignColorValue"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withAndroidSplashStyles.ts"],"sourcesContent":["import {\n AndroidConfig,\n ConfigPlugin,\n withAndroidColors,\n withAndroidColorsNight,\n withAndroidStyles,\n} from '@expo/config-plugins';\nimport { Colors } from '@expo/config-plugins/build/android';\nimport { ExpoConfig } from '@expo/config-types';\n\nimport {\n AndroidSplashConfig,\n getAndroidDarkSplashConfig,\n getAndroidSplashConfig,\n} from './getAndroidSplashConfig';\n\nconst styleResourceGroup = {\n name: 'Theme.App.SplashScreen',\n parent: 'Theme.SplashScreen',\n};\n\nconst SPLASH_COLOR_NAME = 'splashscreen_background';\n\nexport const withAndroidSplashStyles: ConfigPlugin<AndroidSplashConfig> = (config, props) => {\n config = withAndroidColors(config, (config) => {\n const backgroundColor = getSplashBackgroundColor(config, props);\n if (!backgroundColor) {\n return config;\n }\n config.modResults = setSplashColorsForTheme(config.modResults, backgroundColor);\n return config;\n });\n config = withAndroidColorsNight(config, (config) => {\n const backgroundColor = getSplashDarkBackgroundColor(config, props);\n if (!backgroundColor) {\n return config;\n }\n config.modResults = setSplashColorsForTheme(config.modResults, backgroundColor);\n return config;\n });\n config = withAndroidStyles(config, (config) => {\n config.modResults = removeOldSplashStyleGroup(config.modResults);\n config.modResults = addSplashScreenStyle(config.modResults);\n return config;\n });\n return config;\n};\n\n// Add the style that extends Theme.SplashScreen\nfunction addSplashScreenStyle(styles: AndroidConfig.Resources.ResourceXML) {\n const { resources } = styles;\n const { style = [] } = resources;\n\n const item = [\n {\n $: { name: 'windowSplashScreenBackground' },\n _: '@color/splashscreen_background',\n },\n {\n $: { name: 'windowSplashScreenAnimatedIcon' },\n _: '@drawable/splashscreen_logo',\n },\n {\n $: { name: 'postSplashScreenTheme' },\n _: '@style/AppTheme',\n },\n ];\n\n styles.resources.style = [\n ...style.filter(({ $ }) => $.name !== 'Theme.App.SplashScreen'),\n {\n $: {\n ...styleResourceGroup,\n },\n item,\n },\n ];\n\n return styles;\n}\n\n// Remove the old style group which didn't extend the base theme properly.\nexport function removeOldSplashStyleGroup(styles: AndroidConfig.Resources.ResourceXML) {\n const group = {\n name: 'Theme.App.SplashScreen',\n parent: 'Theme.AppCompat.Light.NoActionBar',\n };\n\n styles.resources.style = styles.resources.style?.filter?.(({ $: head }) => {\n let matches = head.name === group.name;\n if (group.parent != null && matches) {\n matches = head.parent === group.parent;\n }\n return !matches;\n });\n\n return styles;\n}\n\nexport function getSplashBackgroundColor(\n config: ExpoConfig,\n props: AndroidSplashConfig | null\n): string | null {\n return getAndroidSplashConfig(config, props)?.backgroundColor ?? null;\n}\n\nexport function getSplashDarkBackgroundColor(\n config: ExpoConfig,\n props: AndroidSplashConfig | null\n): string | null {\n return getAndroidDarkSplashConfig(config, props)?.backgroundColor ?? null;\n}\n\nexport function setSplashStylesForTheme(styles: AndroidConfig.Resources.ResourceXML) {\n // Add splash screen image\n return AndroidConfig.Styles.assignStylesValue(styles, {\n add: true,\n value: '@drawable/splashscreen_logo',\n name: 'android:windowSplashScreenBackground',\n parent: styleResourceGroup,\n });\n}\n\nexport function setSplashColorsForTheme(\n colors: AndroidConfig.Resources.ResourceXML,\n backgroundColor: string | null\n): AndroidConfig.Resources.ResourceXML {\n return Colors.assignColorValue(colors, { value: backgroundColor, name: SPLASH_COLOR_NAME });\n}\n"],"mappings":";;;;;;;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAOA,SAAAE,SAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAG,wBAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,uBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAMA,MAAMI,kBAAkB,GAAG;EACzBC,IAAI,EAAE,wBAAwB;EAC9BC,MAAM,EAAE;AACV,CAAC;AAED,MAAMC,iBAAiB,GAAG,yBAAyB;AAE5C,MAAMC,uBAA0D,GAAGA,CAACC,MAAM,EAAEC,KAAK,KAAK;EAC3FD,MAAM,GAAG,IAAAE,kCAAiB,EAACF,MAAM,EAAGA,MAAM,IAAK;IAC7C,MAAMG,eAAe,GAAGC,wBAAwB,CAACJ,MAAM,EAAEC,KAAK,CAAC;IAC/D,IAAI,CAACE,eAAe,EAAE;MACpB,OAAOH,MAAM;IACf;IACAA,MAAM,CAACK,UAAU,GAAGC,uBAAuB,CAACN,MAAM,CAACK,UAAU,EAAEF,eAAe,CAAC;IAC/E,OAAOH,MAAM;EACf,CAAC,CAAC;EACFA,MAAM,GAAG,IAAAO,uCAAsB,EAACP,MAAM,EA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AED,KAAK,EAAE3B,eAAe;IAAEP,IAAI,EAAEE;EAAkB,CAAC,CAAC;AAC7F","ignoreList":[]}
|
|
@@ -70,7 +70,8 @@ const withIosSplashAssets = (config, splash) => {
|
|
|
70
70
|
darkImage: splash.dark?.image,
|
|
71
71
|
tabletImage: splash.tabletImage,
|
|
72
72
|
darkTabletImage: splash.dark?.tabletImage,
|
|
73
|
-
|
|
73
|
+
imageWidth: splash.imageWidth ?? 100,
|
|
74
|
+
enableFullScreenImage: splash.enableFullScreenImage_legacy
|
|
74
75
|
});
|
|
75
76
|
return config;
|
|
76
77
|
}]);
|
|
@@ -87,10 +88,10 @@ async function configureImageAssets({
|
|
|
87
88
|
darkImage,
|
|
88
89
|
tabletImage,
|
|
89
90
|
darkTabletImage,
|
|
90
|
-
|
|
91
|
+
imageWidth,
|
|
92
|
+
enableFullScreenImage
|
|
91
93
|
}) {
|
|
92
94
|
const imageSetPath = _path().default.resolve(iosNamedProjectRoot, IMAGESET_PATH);
|
|
93
|
-
|
|
94
95
|
// ensure old SplashScreen imageSet is removed
|
|
95
96
|
await _fsExtra().default.remove(imageSetPath);
|
|
96
97
|
if (!image) {
|
|
@@ -110,7 +111,8 @@ async function configureImageAssets({
|
|
|
110
111
|
darkImage,
|
|
111
112
|
tabletImage,
|
|
112
113
|
darkTabletImage,
|
|
113
|
-
|
|
114
|
+
imageWidth,
|
|
115
|
+
enableFullScreenImage
|
|
114
116
|
});
|
|
115
117
|
}
|
|
116
118
|
async function copyImageFiles({
|
|
@@ -120,7 +122,8 @@ async function copyImageFiles({
|
|
|
120
122
|
darkImage,
|
|
121
123
|
tabletImage,
|
|
122
124
|
darkTabletImage,
|
|
123
|
-
|
|
125
|
+
imageWidth,
|
|
126
|
+
enableFullScreenImage
|
|
124
127
|
}) {
|
|
125
128
|
await generateImagesAssetsAsync({
|
|
126
129
|
async generateImageAsset(item, fileName) {
|
|
@@ -137,7 +140,7 @@ async function copyImageFiles({
|
|
|
137
140
|
ratio,
|
|
138
141
|
suffix
|
|
139
142
|
}) => {
|
|
140
|
-
const size =
|
|
143
|
+
const size = imageWidth * ratio;
|
|
141
144
|
// Using this method will cache the images in `.expo` based on the properties used to generate them.
|
|
142
145
|
// this method also supports remote URLs and using the global sharp instance.
|
|
143
146
|
const {
|
|
@@ -147,8 +150,8 @@ async function copyImageFiles({
|
|
|
147
150
|
cacheType: IMAGE_CACHE_NAME
|
|
148
151
|
}, {
|
|
149
152
|
src: item,
|
|
150
|
-
width: size,
|
|
151
|
-
height: size
|
|
153
|
+
width: enableFullScreenImage ? undefined : size,
|
|
154
|
+
height: enableFullScreenImage ? undefined : size
|
|
152
155
|
});
|
|
153
156
|
// Write image buffer to the file system.
|
|
154
157
|
// const assetPath = join(iosNamedProjectRoot, IMAGESET_PATH, filename);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withIosSplashAssets.js","names":["_configPlugins","data","require","_imageUtils","_debug","_interopRequireDefault","_fsExtra","_path","_AssetContents","e","__esModule","default","debug","Debug","IMAGE_CACHE_NAME","IMAGESET_PATH","PNG_FILENAME","DARK_PNG_FILENAME","TABLET_PNG_FILENAME","DARK_TABLET_PNG_FILENAME","withIosSplashAssets","config","splash","withDangerousMod","iosNamedProjectRoot","IOSConfig","Paths","getSourceRoot","modRequest","projectRoot","configureImageAssets","image","darkImage","dark","tabletImage","darkTabletImage","logoWidth","exports","imageSetPath","path","resolve","fs","remove","writeContentsJsonFileAsync","assetPath","copyImageFiles","generateImagesAssetsAsync","generateImageAsset","item","fileName","ratio","suffix","map","size","source","generateImageAsync","cacheType","src","width","height","writeFile","anyItem","darkItem","tabletItem","darkTabletItem","items","filter","Promise","all","darkAppearances","appearance","value","buildContentsJsonImages","createContentsJsonItem","idiom","filename","scale","appearances","Boolean","images","writeContentsJsonAsync"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withIosSplashAssets.ts"],"sourcesContent":["import { ConfigPlugin, IOSConfig, withDangerousMod } from '@expo/config-plugins';\nimport { generateImageAsync } from '@expo/image-utils';\nimport Debug from 'debug';\nimport fs from 'fs-extra';\n// @ts-ignore\nimport path from 'path';\n\nimport { IOSSplashConfig } from './getIosSplashConfig';\nimport {\n ContentsJsonImage,\n ContentsJsonAppearance,\n createContentsJsonItem,\n writeContentsJsonAsync,\n} from '../../icons/AssetContents';\n\nconst debug = Debug('expo:prebuild-config:expo-splash-screen:ios:assets');\n\nconst IMAGE_CACHE_NAME = 'splash-ios';\nconst IMAGESET_PATH = 'Images.xcassets/SplashScreenLogo.imageset';\nconst PNG_FILENAME = 'image';\nconst DARK_PNG_FILENAME = 'dark_image';\nconst TABLET_PNG_FILENAME = 'tablet_image';\nconst DARK_TABLET_PNG_FILENAME = 'dark_tablet_image';\n\nexport const withIosSplashAssets: ConfigPlugin<IOSSplashConfig> = (config, splash) => {\n if (!splash) {\n return config;\n }\n return withDangerousMod(config, [\n 'ios',\n async (config) => {\n const iosNamedProjectRoot = IOSConfig.Paths.getSourceRoot(config.modRequest.projectRoot);\n\n await configureImageAssets({\n projectRoot: config.modRequest.projectRoot,\n iosNamedProjectRoot,\n image: splash.image,\n darkImage: splash.dark?.image,\n tabletImage: splash.tabletImage,\n darkTabletImage: splash.dark?.tabletImage,\n logoWidth: splash.logoWidth ?? 100,\n });\n\n return config;\n },\n ]);\n};\n\n/**\n * Creates imageset containing image for Splash/Launch Screen.\n */\nasync function configureImageAssets({\n projectRoot,\n iosNamedProjectRoot,\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n logoWidth,\n}: {\n projectRoot: string;\n iosNamedProjectRoot: string;\n image?: string | null;\n darkImage?: string | null;\n tabletImage: string | null;\n darkTabletImage?: string | null;\n logoWidth: number;\n}) {\n const imageSetPath = path.resolve(iosNamedProjectRoot, IMAGESET_PATH);\n\n // ensure old SplashScreen imageSet is removed\n await fs.remove(imageSetPath);\n\n if (!image) {\n return;\n }\n\n await writeContentsJsonFileAsync({\n assetPath: imageSetPath,\n image: PNG_FILENAME,\n darkImage: darkImage ? DARK_PNG_FILENAME : null,\n tabletImage: tabletImage ? TABLET_PNG_FILENAME : null,\n darkTabletImage: darkTabletImage ? DARK_TABLET_PNG_FILENAME : null,\n });\n\n await copyImageFiles({\n projectRoot,\n iosNamedProjectRoot,\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n logoWidth,\n });\n}\n\nasync function copyImageFiles({\n projectRoot,\n iosNamedProjectRoot,\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n logoWidth,\n}: {\n projectRoot: string;\n iosNamedProjectRoot: string;\n image: string;\n darkImage?: string | null;\n tabletImage?: string | null;\n darkTabletImage?: string | null;\n logoWidth: number;\n}) {\n await generateImagesAssetsAsync({\n async generateImageAsset(item, fileName) {\n [\n { ratio: 1, suffix: '' },\n { ratio: 2, suffix: '@2x' },\n { ratio: 3, suffix: '@3x' },\n ].map(async ({ ratio, suffix }) => {\n const size = logoWidth * ratio;\n // Using this method will cache the images in `.expo` based on the properties used to generate them.\n // this method also supports remote URLs and using the global sharp instance.\n const { source } = await generateImageAsync({ projectRoot, cacheType: IMAGE_CACHE_NAME }, {\n src: item,\n width: size,\n height: size,\n } as any);\n // Write image buffer to the file system.\n // const assetPath = join(iosNamedProjectRoot, IMAGESET_PATH, filename);\n await fs.writeFile(\n path.resolve(iosNamedProjectRoot, IMAGESET_PATH, `${fileName}${suffix}.png`),\n source\n );\n });\n },\n anyItem: image,\n darkItem: darkImage,\n tabletItem: tabletImage,\n darkTabletItem: darkTabletImage,\n });\n}\n\nasync function generateImagesAssetsAsync({\n generateImageAsset,\n anyItem,\n darkItem,\n tabletItem,\n darkTabletItem,\n}: {\n generateImageAsset: (item: string, fileName: string) => Promise<void>;\n anyItem: string;\n darkItem?: string | null;\n tabletItem?: string | null;\n darkTabletItem?: string | null;\n}) {\n const items = [\n [anyItem, PNG_FILENAME],\n [darkItem, DARK_PNG_FILENAME],\n [tabletItem, TABLET_PNG_FILENAME],\n [darkTabletItem, DARK_TABLET_PNG_FILENAME],\n ].filter(([item]) => !!item) as unknown as [string, string];\n\n await Promise.all(items.map(([item, fileName]) => generateImageAsset(item, fileName)));\n}\n\nconst darkAppearances: ContentsJsonAppearance[] = [\n {\n appearance: 'luminosity',\n value: 'dark',\n } as ContentsJsonAppearance,\n];\n\nexport function buildContentsJsonImages({\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n}: {\n image: string;\n tabletImage: string | null;\n darkImage: string | null;\n darkTabletImage: string | null;\n}): ContentsJsonImage[] {\n return [\n // Phone light\n createContentsJsonItem({\n idiom: 'universal',\n filename: `${image}.png`,\n scale: '1x',\n }),\n createContentsJsonItem({\n idiom: 'universal',\n filename: `${image}@2x.png`,\n scale: '2x',\n }),\n createContentsJsonItem({\n idiom: 'universal',\n filename: `${image}@3x.png`,\n scale: '3x',\n }),\n // Phone dark\n darkImage &&\n createContentsJsonItem({\n idiom: 'universal',\n appearances: darkAppearances,\n scale: '1x',\n filename: `${darkImage}.png`,\n }),\n darkImage &&\n createContentsJsonItem({\n idiom: 'universal',\n appearances: darkAppearances,\n scale: '2x',\n filename: `${darkImage}@2x.png`,\n }),\n darkImage &&\n createContentsJsonItem({\n idiom: 'universal',\n appearances: darkAppearances,\n scale: '3x',\n filename: `${darkImage}@3x.png`,\n }),\n // Tablet light\n tabletImage &&\n createContentsJsonItem({\n idiom: 'ipad',\n filename: `${tabletImage}.png`,\n scale: '1x',\n }),\n tabletImage &&\n createContentsJsonItem({\n idiom: 'ipad',\n scale: '2x',\n filename: `${tabletImage}@2x.png`,\n }),\n // Phone dark\n darkTabletImage &&\n createContentsJsonItem({\n idiom: 'ipad',\n appearances: darkAppearances,\n filename: `${darkTabletImage}.png`,\n scale: '1x',\n }),\n darkTabletImage &&\n createContentsJsonItem({\n idiom: 'ipad',\n appearances: darkAppearances,\n filename: `${darkTabletImage}@2x.png`,\n scale: '2x',\n }),\n ].filter(Boolean) as ContentsJsonImage[];\n}\n\nasync function writeContentsJsonFileAsync({\n assetPath,\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n}: {\n assetPath: string;\n image: string;\n darkImage: string | null;\n tabletImage: string | null;\n darkTabletImage: string | null;\n}) {\n const images = buildContentsJsonImages({ image, darkImage, tabletImage, darkTabletImage });\n\n debug(`create contents.json:`, assetPath);\n debug(`use images:`, images);\n await writeContentsJsonAsync(assetPath, { images });\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAE,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,SAAA;EAAA,MAAAL,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAI,QAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,MAAA;EAAA,MAAAN,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAK,KAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAO,eAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;EAAAM,cAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAKmC,SAAAI,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AATnC;;AAWA,MAAMG,KAAK,GAAG,IAAAC,gBAAK,EAAC,oDAAoD,CAAC;AAEzE,MAAMC,gBAAgB,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QAAQ,EAAE,GAAGxC,eAAe,SAAS;IACrCyC,KAAK,EAAE;EACT,CAAC,CAAC,CACL,CAACV,MAAM,CAACY,OAAO,CAAC;AACnB;AAEA,eAAenC,0BAA0BA,CAAC;EACxCC,SAAS;EACTb,KAAK;EACLC,SAAS;EACTE,WAAW;EACXC;AAOF,CAAC,EAAE;EACD,MAAM4C,MAAM,GAAGP,uBAAuB,CAAC;IAAEzC,KAAK;IAAEC,SAAS;IAAEE,WAAW;IAAEC;EAAgB,CAAC,CAAC;EAE1FvB,KAAK,CAAC,uBAAuB,EAAEgC,SAAS,CAAC;EACzChC,KAAK,CAAC,aAAa,EAAEmE,MAAM,CAAC;EAC5B,MAAM,IAAAC,uCAAsB,EAACpC,SAAS,EAAE;IAAEmC;EAAO,CAAC,CAAC;AACrD","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"withIosSplashAssets.js","names":["_configPlugins","data","require","_imageUtils","_debug","_interopRequireDefault","_fsExtra","_path","_AssetContents","e","__esModule","default","debug","Debug","IMAGE_CACHE_NAME","IMAGESET_PATH","PNG_FILENAME","DARK_PNG_FILENAME","TABLET_PNG_FILENAME","DARK_TABLET_PNG_FILENAME","withIosSplashAssets","config","splash","withDangerousMod","iosNamedProjectRoot","IOSConfig","Paths","getSourceRoot","modRequest","projectRoot","configureImageAssets","image","darkImage","dark","tabletImage","darkTabletImage","imageWidth","enableFullScreenImage","enableFullScreenImage_legacy","exports","imageSetPath","path","resolve","fs","remove","writeContentsJsonFileAsync","assetPath","copyImageFiles","generateImagesAssetsAsync","generateImageAsset","item","fileName","ratio","suffix","map","size","source","generateImageAsync","cacheType","src","width","undefined","height","writeFile","anyItem","darkItem","tabletItem","darkTabletItem","items","filter","Promise","all","darkAppearances","appearance","value","buildContentsJsonImages","createContentsJsonItem","idiom","filename","scale","appearances","Boolean","images","writeContentsJsonAsync"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withIosSplashAssets.ts"],"sourcesContent":["import { ConfigPlugin, IOSConfig, withDangerousMod } from '@expo/config-plugins';\nimport { generateImageAsync } from '@expo/image-utils';\nimport Debug from 'debug';\nimport fs from 'fs-extra';\n// @ts-ignore\nimport path from 'path';\n\nimport { IOSSplashConfig } from './getIosSplashConfig';\nimport {\n ContentsJsonImage,\n ContentsJsonAppearance,\n createContentsJsonItem,\n writeContentsJsonAsync,\n} from '../../icons/AssetContents';\n\nconst debug = Debug('expo:prebuild-config:expo-splash-screen:ios:assets');\n\nconst IMAGE_CACHE_NAME = 'splash-ios';\nconst IMAGESET_PATH = 'Images.xcassets/SplashScreenLogo.imageset';\nconst PNG_FILENAME = 'image';\nconst DARK_PNG_FILENAME = 'dark_image';\nconst TABLET_PNG_FILENAME = 'tablet_image';\nconst DARK_TABLET_PNG_FILENAME = 'dark_tablet_image';\n\nexport const withIosSplashAssets: ConfigPlugin<IOSSplashConfig> = (config, splash) => {\n if (!splash) {\n return config;\n }\n return withDangerousMod(config, [\n 'ios',\n async (config) => {\n const iosNamedProjectRoot = IOSConfig.Paths.getSourceRoot(config.modRequest.projectRoot);\n\n await configureImageAssets({\n projectRoot: config.modRequest.projectRoot,\n iosNamedProjectRoot,\n image: splash.image,\n darkImage: splash.dark?.image,\n tabletImage: splash.tabletImage,\n darkTabletImage: splash.dark?.tabletImage,\n imageWidth: splash.imageWidth ?? 100,\n enableFullScreenImage: splash.enableFullScreenImage_legacy,\n });\n\n return config;\n },\n ]);\n};\n\n/**\n * Creates imageset containing image for Splash/Launch Screen.\n */\nasync function configureImageAssets({\n projectRoot,\n iosNamedProjectRoot,\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n imageWidth,\n enableFullScreenImage,\n}: {\n projectRoot: string;\n iosNamedProjectRoot: string;\n image?: string | null;\n darkImage?: string | null;\n tabletImage?: string;\n darkTabletImage?: string | null;\n imageWidth: number;\n enableFullScreenImage?: boolean;\n}) {\n const imageSetPath = path.resolve(iosNamedProjectRoot, IMAGESET_PATH);\n // ensure old SplashScreen imageSet is removed\n await fs.remove(imageSetPath);\n\n if (!image) {\n return;\n }\n\n await writeContentsJsonFileAsync({\n assetPath: imageSetPath,\n image: PNG_FILENAME,\n darkImage: darkImage ? DARK_PNG_FILENAME : null,\n tabletImage: tabletImage ? TABLET_PNG_FILENAME : null,\n darkTabletImage: darkTabletImage ? DARK_TABLET_PNG_FILENAME : null,\n });\n\n await copyImageFiles({\n projectRoot,\n iosNamedProjectRoot,\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n imageWidth,\n enableFullScreenImage,\n });\n}\n\nasync function copyImageFiles({\n projectRoot,\n iosNamedProjectRoot,\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n imageWidth,\n enableFullScreenImage,\n}: {\n projectRoot: string;\n iosNamedProjectRoot: string;\n image: string;\n darkImage?: string | null;\n tabletImage?: string | null;\n darkTabletImage?: string | null;\n imageWidth: number;\n enableFullScreenImage?: boolean;\n}) {\n await generateImagesAssetsAsync({\n async generateImageAsset(item, fileName) {\n [\n { ratio: 1, suffix: '' },\n { ratio: 2, suffix: '@2x' },\n { ratio: 3, suffix: '@3x' },\n ].map(async ({ ratio, suffix }) => {\n const size = imageWidth * ratio;\n // Using this method will cache the images in `.expo` based on the properties used to generate them.\n // this method also supports remote URLs and using the global sharp instance.\n const { source } = await generateImageAsync({ projectRoot, cacheType: IMAGE_CACHE_NAME }, {\n src: item,\n width: enableFullScreenImage ? undefined : size,\n height: enableFullScreenImage ? undefined : size,\n } as any);\n // Write image buffer to the file system.\n // const assetPath = join(iosNamedProjectRoot, IMAGESET_PATH, filename);\n await fs.writeFile(\n path.resolve(iosNamedProjectRoot, IMAGESET_PATH, `${fileName}${suffix}.png`),\n source\n );\n });\n },\n anyItem: image,\n darkItem: darkImage,\n tabletItem: tabletImage,\n darkTabletItem: darkTabletImage,\n });\n}\n\nasync function generateImagesAssetsAsync({\n generateImageAsset,\n anyItem,\n darkItem,\n tabletItem,\n darkTabletItem,\n}: {\n generateImageAsset: (item: string, fileName: string) => Promise<void>;\n anyItem: string;\n darkItem?: string | null;\n tabletItem?: string | null;\n darkTabletItem?: string | null;\n}) {\n const items = [\n [anyItem, PNG_FILENAME],\n [darkItem, DARK_PNG_FILENAME],\n [tabletItem, TABLET_PNG_FILENAME],\n [darkTabletItem, DARK_TABLET_PNG_FILENAME],\n ].filter(([item]) => !!item) as unknown as [string, string];\n\n await Promise.all(items.map(([item, fileName]) => generateImageAsset(item, fileName)));\n}\n\nconst darkAppearances: ContentsJsonAppearance[] = [\n {\n appearance: 'luminosity',\n value: 'dark',\n } as ContentsJsonAppearance,\n];\n\nexport function buildContentsJsonImages({\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n}: {\n image: string;\n tabletImage: string | null;\n darkImage: string | null;\n darkTabletImage: string | null;\n}): ContentsJsonImage[] {\n return [\n // Phone light\n createContentsJsonItem({\n idiom: 'universal',\n filename: `${image}.png`,\n scale: '1x',\n }),\n createContentsJsonItem({\n idiom: 'universal',\n filename: `${image}@2x.png`,\n scale: '2x',\n }),\n createContentsJsonItem({\n idiom: 'universal',\n filename: `${image}@3x.png`,\n scale: '3x',\n }),\n // Phone dark\n darkImage &&\n createContentsJsonItem({\n idiom: 'universal',\n appearances: darkAppearances,\n scale: '1x',\n filename: `${darkImage}.png`,\n }),\n darkImage &&\n createContentsJsonItem({\n idiom: 'universal',\n appearances: darkAppearances,\n scale: '2x',\n filename: `${darkImage}@2x.png`,\n }),\n darkImage &&\n createContentsJsonItem({\n idiom: 'universal',\n appearances: darkAppearances,\n scale: '3x',\n filename: `${darkImage}@3x.png`,\n }),\n // Tablet light\n tabletImage &&\n createContentsJsonItem({\n idiom: 'ipad',\n filename: `${tabletImage}.png`,\n scale: '1x',\n }),\n tabletImage &&\n createContentsJsonItem({\n idiom: 'ipad',\n scale: '2x',\n filename: `${tabletImage}@2x.png`,\n }),\n // Phone dark\n darkTabletImage &&\n createContentsJsonItem({\n idiom: 'ipad',\n appearances: darkAppearances,\n filename: `${darkTabletImage}.png`,\n scale: '1x',\n }),\n darkTabletImage &&\n createContentsJsonItem({\n idiom: 'ipad',\n appearances: darkAppearances,\n filename: `${darkTabletImage}@2x.png`,\n scale: '2x',\n }),\n ].filter(Boolean) as ContentsJsonImage[];\n}\n\nasync function writeContentsJsonFileAsync({\n assetPath,\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n}: {\n assetPath: string;\n image: string;\n darkImage: string | null;\n tabletImage: string | null;\n darkTabletImage: string | null;\n}) {\n const images = buildContentsJsonImages({ image, darkImage, tabletImage, darkTabletImage });\n\n debug(`create contents.json:`, assetPath);\n debug(`use images:`, images);\n await writeContentsJsonAsync(assetPath, { images });\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAE,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,SAAA;EAAA,MAAAL,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAI,QAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,MAAA;EAAA,MAAAN,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAK,KAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAO,eAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;EAAAM,cAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAKmC,SAAA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IAAI;IACXD,QAAQ,EAAE,GAAG5C,WAAW;EAC1B,CAAC,CAAC;EACJ;EACAC,eAAe,IACb,IAAAyC,uCAAsB,EAAC;IACrBC,KAAK,EAAE,MAAM;IACbG,WAAW,EAAER,eAAe;IAC5BM,QAAQ,EAAE,GAAG3C,eAAe,MAAM;IAClC4C,KAAK,EAAE;EACT,CAAC,CAAC,EACJ5C,eAAe,IACb,IAAAyC,uCAAsB,EAAC;IACrBC,KAAK,EAAE,MAAM;IACbG,WAAW,EAAER,eAAe;IAC5BM,QAAQ,EAAE,GAAG3C,eAAe,SAAS;IACrC4C,KAAK,EAAE;EACT,CAAC,CAAC,CACL,CAACV,MAAM,CAACY,OAAO,CAAC;AACnB;AAEA,eAAepC,0BAA0BA,CAAC;EACxCC,SAAS;EACTf,KAAK;EACLC,SAAS;EACTE,WAAW;EACXC;AAOF,CAAC,EAAE;EACD,MAAM+C,MAAM,GAAGP,uBAAuB,CAAC;IAAE5C,KAAK;IAAEC,SAAS;IAAEE,WAAW;IAAEC;EAAgB,CAAC,CAAC;EAE1FvB,KAAK,CAAC,uBAAuB,EAAEkC,SAAS,CAAC;EACzClC,KAAK,CAAC,aAAa,EAAEsE,MAAM,CAAC;EAC5B,MAAM,IAAAC,uCAAsB,EAACrC,SAAS,EAAE;IAAEoC;EAAO,CAAC,CAAC;AACrD","ignoreList":[]}
|
|
@@ -69,20 +69,13 @@ function _withIosSplashXcodeProject() {
|
|
|
69
69
|
}
|
|
70
70
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
71
71
|
const debug = (0, _debug().default)('expo:prebuild-config:expo-splash-screen:ios');
|
|
72
|
-
const withIosSplashScreen = (config,
|
|
72
|
+
const withIosSplashScreen = (config, props) => {
|
|
73
73
|
// If the user didn't specify a splash object, infer the splash object from the Expo config.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
splash = {
|
|
78
|
-
...(0, _getIosSplashConfig().getIosSplashConfig)(config),
|
|
79
|
-
...splash
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
debug(`config:`, splash);
|
|
83
|
-
return (0, _configPlugins().withPlugins)(config, [[_withIosSplashInfoPlist().withIosSplashInfoPlist, splash], [_withIosSplashAssets().withIosSplashAssets, splash], [_withIosSplashColors().withIosSplashColors, splash],
|
|
74
|
+
props = (0, _getIosSplashConfig().getIosSplashConfig)(config, props ?? null);
|
|
75
|
+
debug(`config:`, props);
|
|
76
|
+
return (0, _configPlugins().withPlugins)(config, [[_withIosSplashInfoPlist().withIosSplashInfoPlist, props], [_withIosSplashAssets().withIosSplashAssets, props], [_withIosSplashColors().withIosSplashColors, props],
|
|
84
77
|
// Add the image settings to the storyboard.
|
|
85
|
-
[_withIosSplashScreenStoryboardImage().withIosSplashScreenImage,
|
|
78
|
+
[_withIosSplashScreenStoryboardImage().withIosSplashScreenImage, props],
|
|
86
79
|
// Link storyboard to xcode project.
|
|
87
80
|
// TODO: Maybe fold this into the base mod.
|
|
88
81
|
_withIosSplashXcodeProject().withIosSplashXcodeProject,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withIosSplashScreen.js","names":["_configPlugins","data","require","_debug","_interopRequireDefault","_getIosSplashConfig","_withIosSplashAssets","_withIosSplashColors","_withIosSplashInfoPlist","_withIosSplashScreenStoryboard","_withIosSplashScreenStoryboardImage","_withIosSplashXcodeProject","e","__esModule","default","debug","Debug","withIosSplashScreen","config","
|
|
1
|
+
{"version":3,"file":"withIosSplashScreen.js","names":["_configPlugins","data","require","_debug","_interopRequireDefault","_getIosSplashConfig","_withIosSplashAssets","_withIosSplashColors","_withIosSplashInfoPlist","_withIosSplashScreenStoryboard","_withIosSplashScreenStoryboardImage","_withIosSplashXcodeProject","e","__esModule","default","debug","Debug","withIosSplashScreen","config","props","getIosSplashConfig","withPlugins","withIosSplashInfoPlist","withIosSplashAssets","withIosSplashColors","withIosSplashScreenImage","withIosSplashXcodeProject","withIosSplashScreenStoryboardBaseMod","exports"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withIosSplashScreen.ts"],"sourcesContent":["import { ConfigPlugin, withPlugins } from '@expo/config-plugins';\nimport Debug from 'debug';\n\nimport { getIosSplashConfig, IOSSplashConfig } from './getIosSplashConfig';\nimport { withIosSplashAssets } from './withIosSplashAssets';\nimport { withIosSplashColors } from './withIosSplashColors';\nimport { withIosSplashInfoPlist } from './withIosSplashInfoPlist';\nimport { withIosSplashScreenStoryboardBaseMod } from './withIosSplashScreenStoryboard';\nimport { withIosSplashScreenImage } from './withIosSplashScreenStoryboardImage';\nimport { withIosSplashXcodeProject } from './withIosSplashXcodeProject';\n\nconst debug = Debug('expo:prebuild-config:expo-splash-screen:ios');\n\nexport const withIosSplashScreen: ConfigPlugin<IOSSplashConfig | undefined | null | void> = (\n config,\n props\n) => {\n // If the user didn't specify a splash object, infer the splash object from the Expo config.\n props = getIosSplashConfig(config, props ?? null);\n\n debug(`config:`, props);\n\n return withPlugins(config, [\n [withIosSplashInfoPlist, props],\n [withIosSplashAssets, props],\n [withIosSplashColors, props],\n // Add the image settings to the storyboard.\n [withIosSplashScreenImage, props],\n // Link storyboard to xcode project.\n // TODO: Maybe fold this into the base mod.\n withIosSplashXcodeProject,\n // Insert the base mod last, no other ios.splashScreenStoryboard mods can be added after this.\n withIosSplashScreenStoryboardBaseMod,\n ]);\n};\n"],"mappings":";;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,oBAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,mBAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;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DAAsB,EAAEH,KAAK,CAAC,EAC/B,CAACI,0CAAmB,EAAEJ,KAAK,CAAC,EAC5B,CAACK,0CAAmB,EAAEL,KAAK,CAAC;EAC5B;EACA,CAACM,8DAAwB,EAAEN,KAAK,CAAC;EACjC;EACA;EACAO,sDAAyB;EACzB;EACAC,qEAAoC,CACrC,CAAC;AACJ,CAAC;AAACC,OAAA,CAAAX,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
@@ -138,6 +138,7 @@ async function getTemplateAsync() {
|
|
|
138
138
|
<constraint firstItem="EXPO-SplashScreen" firstAttribute="centerY" secondItem="EXPO-ContainerView" secondAttribute="centerY" id="0VC-Wk-OaO"/>
|
|
139
139
|
<constraint firstItem="EXPO-SplashScreen" firstAttribute="centerX" secondItem="EXPO-ContainerView" secondAttribute="centerX" id="zR4-NK-mVN"/>
|
|
140
140
|
</constraints>
|
|
141
|
+
<color key="backgroundColor" name="SplashScreenBackground"/>
|
|
141
142
|
</view>
|
|
142
143
|
</viewController>
|
|
143
144
|
<placeholder placeholderIdentifier="IBFirstResponder" id="EXPO-PLACEHOLDER-1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
|
@@ -147,6 +148,9 @@ async function getTemplateAsync() {
|
|
|
147
148
|
</scenes>
|
|
148
149
|
<resources>
|
|
149
150
|
<image name="SplashScreenLogo" width="100" height="90.333335876464844"/>
|
|
151
|
+
<namedColor name="SplashScreenBackground">
|
|
152
|
+
<color alpha="1.000" blue="1.00000000000000" green="1.00000000000000" red="1.00000000000000" customColorSpace="sRGB" colorSpace="custom"/>
|
|
153
|
+
</namedColor>
|
|
150
154
|
</resources>
|
|
151
155
|
</document>`;
|
|
152
156
|
return await new (_xml2js().Parser)().parseStringPromise(contents);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withIosSplashScreenStoryboard.js","names":["_configPlugins","data","require","fs","_interopRequireWildcard","path","_xml2js","_InterfaceBuilder","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","STORYBOARD_FILE_PATH","exports","STORYBOARD_MOD_NAME","withIosSplashScreenStoryboard","config","action","withMod","platform","mod","withIosSplashScreenStoryboardBaseMod","BaseMods","withGeneratedBaseMods","saveToInternal","skipEmptyMod","providers","provider","isIntrospective","getFilePath","modRequest","join","platformProjectRoot","projectName","read","filePath","contents","promises","readFile","xml","Parser","parseStringPromise","getTemplateAsync","write","modResults","introspect","writeFile","toString"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withIosSplashScreenStoryboard.ts"],"sourcesContent":["import { BaseMods, ConfigPlugin, Mod, withMod } from '@expo/config-plugins';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { Parser } from 'xml2js';\n\nimport { IBSplashScreenDocument, toString } from './InterfaceBuilder';\n\nexport const STORYBOARD_FILE_PATH = './SplashScreen.storyboard';\n\nconst STORYBOARD_MOD_NAME = 'splashScreenStoryboard';\n\n/**\n * Provides the SplashScreen `.storyboard` xml data for modification.\n *\n * @param config\n * @param action\n */\nexport const withIosSplashScreenStoryboard: ConfigPlugin<Mod<IBSplashScreenDocument>> = (\n config,\n action\n) => {\n return withMod(config, {\n platform: 'ios',\n mod: STORYBOARD_MOD_NAME,\n action,\n });\n};\n\n/** Append a custom rule to supply SplashScreen `.storyboard` xml data to mods on `mods.ios.splashScreenStoryboard` */\nexport const withIosSplashScreenStoryboardBaseMod: ConfigPlugin = (config) => {\n return BaseMods.withGeneratedBaseMods(config, {\n platform: 'ios',\n saveToInternal: true,\n skipEmptyMod: false,\n providers: {\n // Append a custom rule to supply .storyboard xml data to mods on `mods.ios.splashScreenStoryboard`\n [STORYBOARD_MOD_NAME]: BaseMods.provider<IBSplashScreenDocument>({\n isIntrospective: true,\n async getFilePath({ modRequest }) {\n //: [root]/myapp/ios/MyApp/SplashScreen.storyboard\n return path.join(\n //: myapp/ios\n modRequest.platformProjectRoot,\n // ./MyApp\n modRequest.projectName!,\n // ./SplashScreen.storyboard\n STORYBOARD_FILE_PATH\n );\n },\n async read(filePath) {\n try {\n const contents = await fs.promises.readFile(filePath, 'utf8');\n const xml = await new Parser().parseStringPromise(contents);\n return xml;\n } catch {\n return getTemplateAsync();\n }\n },\n async write(filePath, { modResults, modRequest: { introspect } }) {\n if (introspect) {\n return;\n }\n await fs.promises.writeFile(filePath, toString(modResults));\n },\n }),\n },\n });\n};\n\n/** Get a template splash screen storyboard file. */\nexport async function getTemplateAsync(): Promise<IBSplashScreenDocument> {\n const contents = `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <document type=\"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB\" version=\"3.0\" toolsVersion=\"32700.99.1234\" targetRuntime=\"iOS.CocoaTouch\" propertyAccessControl=\"none\" useAutolayout=\"YES\" launchScreen=\"YES\" useTraitCollections=\"YES\" useSafeAreas=\"YES\" colorMatched=\"YES\" initialViewController=\"EXPO-VIEWCONTROLLER-1\">\n <device id=\"retina6_12\" orientation=\"portrait\" appearance=\"light\"/>\n <dependencies>\n <deployment identifier=\"iOS\"/>\n <plugIn identifier=\"com.apple.InterfaceBuilder.IBCocoaTouchPlugin\" version=\"22685\"/>\n <capability name=\"Safe area layout guides\" minToolsVersion=\"9.0\"/>\n <capability name=\"documents saved in the Xcode 8 format\" minToolsVersion=\"8.0\"/>\n </dependencies>\n <scenes>\n <!--View Controller-->\n <scene sceneID=\"EXPO-SCENE-1\">\n <objects>\n <viewController storyboardIdentifier=\"SplashScreenViewController\" id=\"EXPO-VIEWCONTROLLER-1\" sceneMemberID=\"viewController\">\n <view key=\"view\" userInteractionEnabled=\"NO\" contentMode=\"scaleToFill\" insetsLayoutMarginsFromSafeArea=\"NO\" id=\"EXPO-ContainerView\" userLabel=\"ContainerView\">\n <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"393\" height=\"852\"/>\n <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n <subviews>\n <imageView clipsSubviews=\"YES\" userInteractionEnabled=\"NO\" contentMode=\"scaleAspectFit\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" image=\"SplashScreen\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"EXPO-SplashScreen\" userLabel=\"SplashScreen\">\n <rect key=\"frame\" x=\"146.66666666666666\" y=\"381\" width=\"100\" height=\"90.333333333333314\"/>\n </imageView>\n </subviews>\n <viewLayoutGuide key=\"safeArea\" id=\"Rmq-lb-GrQ\"/>\n <constraints>\n <constraint firstItem=\"EXPO-SplashScreen\" firstAttribute=\"centerY\" secondItem=\"EXPO-ContainerView\" secondAttribute=\"centerY\" id=\"0VC-Wk-OaO\"/>\n <constraint firstItem=\"EXPO-SplashScreen\" firstAttribute=\"centerX\" secondItem=\"EXPO-ContainerView\" secondAttribute=\"centerX\" id=\"zR4-NK-mVN\"/>\n </constraints>\n </view>\n </viewController>\n <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"EXPO-PLACEHOLDER-1\" userLabel=\"First Responder\" sceneMemberID=\"firstResponder\"/>\n </objects>\n <point key=\"canvasLocation\" x=\"140.625\" y=\"129.4921875\"/>\n </scene>\n </scenes>\n <resources>\n <image name=\"SplashScreenLogo\" width=\"100\" height=\"90.333335876464844\"/>\n </resources>\n </document>`;\n return await new Parser().parseStringPromise(contents);\n}\n"],"mappings":";;;;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,GAAA;EAAA,MAAAF,IAAA,GAAAG,uBAAA,CAAAF,OAAA;EAAAC,EAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,KAAA;EAAA,MAAAJ,IAAA,GAAAG,uBAAA,CAAAF,OAAA;EAAAG,IAAA,YA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AC,CAAC,CAACC,kBAAkB,CAACL,QAAQ,CAAC;YAC3D,OAAOG,GAAG;UACZ,CAAC,CAAC,MAAM;YACN,OAAOG,gBAAgB,CAAC,CAAC;UAC3B;QACF,CAAC;QACD,MAAMC,KAAKA,CAACR,QAAQ,EAAE;UAAES,UAAU;UAAEd,UAAU,EAAE;YAAEe;UAAW;QAAE,CAAC,EAAE;UAChE,IAAIA,UAAU,EAAE;YACd;UACF;UACA,MAAM1D,EAAE,CAAD,CAAC,CAACkD,QAAQ,CAACS,SAAS,CAACX,QAAQ,EAAE,IAAAY,4BAAQ,EAACH,UAAU,CAAC,CAAC;QAC7D;MACF,CAAC;IACH;EACF,CAAC,CAAC;AACJ,CAAC;;AAED;AAAA/B,OAAA,CAAAQ,oCAAA,GAAAA,oCAAA;AACO,eAAeqB,gBAAgBA,CAAA,EAAoC;EACxE,MAAMN,QAAQ,GAAG;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;EACZ,OAAO,MAAM,KAAII,gBAAM,EAAC,CAAC,CAACC,kBAAkB,CAACL,QAAQ,CAAC;AACxD","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"withIosSplashScreenStoryboard.js","names":["_configPlugins","data","require","fs","_interopRequireWildcard","path","_xml2js","_InterfaceBuilder","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","STORYBOARD_FILE_PATH","exports","STORYBOARD_MOD_NAME","withIosSplashScreenStoryboard","config","action","withMod","platform","mod","withIosSplashScreenStoryboardBaseMod","BaseMods","withGeneratedBaseMods","saveToInternal","skipEmptyMod","providers","provider","isIntrospective","getFilePath","modRequest","join","platformProjectRoot","projectName","read","filePath","contents","promises","readFile","xml","Parser","parseStringPromise","getTemplateAsync","write","modResults","introspect","writeFile","toString"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withIosSplashScreenStoryboard.ts"],"sourcesContent":["import { BaseMods, ConfigPlugin, Mod, withMod } from '@expo/config-plugins';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { Parser } from 'xml2js';\n\nimport { IBSplashScreenDocument, toString } from './InterfaceBuilder';\n\nexport const STORYBOARD_FILE_PATH = './SplashScreen.storyboard';\n\nconst STORYBOARD_MOD_NAME = 'splashScreenStoryboard';\n\n/**\n * Provides the SplashScreen `.storyboard` xml data for modification.\n *\n * @param config\n * @param action\n */\nexport const withIosSplashScreenStoryboard: ConfigPlugin<Mod<IBSplashScreenDocument>> = (\n config,\n action\n) => {\n return withMod(config, {\n platform: 'ios',\n mod: STORYBOARD_MOD_NAME,\n action,\n });\n};\n\n/** Append a custom rule to supply SplashScreen `.storyboard` xml data to mods on `mods.ios.splashScreenStoryboard` */\nexport const withIosSplashScreenStoryboardBaseMod: ConfigPlugin = (config) => {\n return BaseMods.withGeneratedBaseMods(config, {\n platform: 'ios',\n saveToInternal: true,\n skipEmptyMod: false,\n providers: {\n // Append a custom rule to supply .storyboard xml data to mods on `mods.ios.splashScreenStoryboard`\n [STORYBOARD_MOD_NAME]: BaseMods.provider<IBSplashScreenDocument>({\n isIntrospective: true,\n async getFilePath({ modRequest }) {\n //: [root]/myapp/ios/MyApp/SplashScreen.storyboard\n return path.join(\n //: myapp/ios\n modRequest.platformProjectRoot,\n // ./MyApp\n modRequest.projectName!,\n // ./SplashScreen.storyboard\n STORYBOARD_FILE_PATH\n );\n },\n async read(filePath) {\n try {\n const contents = await fs.promises.readFile(filePath, 'utf8');\n const xml = await new Parser().parseStringPromise(contents);\n return xml;\n } catch {\n return getTemplateAsync();\n }\n },\n async write(filePath, { modResults, modRequest: { introspect } }) {\n if (introspect) {\n return;\n }\n await fs.promises.writeFile(filePath, toString(modResults));\n },\n }),\n },\n });\n};\n\n/** Get a template splash screen storyboard file. */\nexport async function getTemplateAsync(): Promise<IBSplashScreenDocument> {\n const contents = `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <document type=\"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB\" version=\"3.0\" toolsVersion=\"32700.99.1234\" targetRuntime=\"iOS.CocoaTouch\" propertyAccessControl=\"none\" useAutolayout=\"YES\" launchScreen=\"YES\" useTraitCollections=\"YES\" useSafeAreas=\"YES\" colorMatched=\"YES\" initialViewController=\"EXPO-VIEWCONTROLLER-1\">\n <device id=\"retina6_12\" orientation=\"portrait\" appearance=\"light\"/>\n <dependencies>\n <deployment identifier=\"iOS\"/>\n <plugIn identifier=\"com.apple.InterfaceBuilder.IBCocoaTouchPlugin\" version=\"22685\"/>\n <capability name=\"Safe area layout guides\" minToolsVersion=\"9.0\"/>\n <capability name=\"documents saved in the Xcode 8 format\" minToolsVersion=\"8.0\"/>\n </dependencies>\n <scenes>\n <!--View Controller-->\n <scene sceneID=\"EXPO-SCENE-1\">\n <objects>\n <viewController storyboardIdentifier=\"SplashScreenViewController\" id=\"EXPO-VIEWCONTROLLER-1\" sceneMemberID=\"viewController\">\n <view key=\"view\" userInteractionEnabled=\"NO\" contentMode=\"scaleToFill\" insetsLayoutMarginsFromSafeArea=\"NO\" id=\"EXPO-ContainerView\" userLabel=\"ContainerView\">\n <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"393\" height=\"852\"/>\n <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n <subviews>\n <imageView clipsSubviews=\"YES\" userInteractionEnabled=\"NO\" contentMode=\"scaleAspectFit\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" image=\"SplashScreen\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"EXPO-SplashScreen\" userLabel=\"SplashScreen\">\n <rect key=\"frame\" x=\"146.66666666666666\" y=\"381\" width=\"100\" height=\"90.333333333333314\"/>\n </imageView>\n </subviews>\n <viewLayoutGuide key=\"safeArea\" id=\"Rmq-lb-GrQ\"/>\n <constraints>\n <constraint firstItem=\"EXPO-SplashScreen\" firstAttribute=\"centerY\" secondItem=\"EXPO-ContainerView\" secondAttribute=\"centerY\" id=\"0VC-Wk-OaO\"/>\n <constraint firstItem=\"EXPO-SplashScreen\" firstAttribute=\"centerX\" secondItem=\"EXPO-ContainerView\" secondAttribute=\"centerX\" id=\"zR4-NK-mVN\"/>\n </constraints>\n <color key=\"backgroundColor\" name=\"SplashScreenBackground\"/>\n </view>\n </viewController>\n <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"EXPO-PLACEHOLDER-1\" userLabel=\"First Responder\" sceneMemberID=\"firstResponder\"/>\n </objects>\n <point key=\"canvasLocation\" x=\"140.625\" y=\"129.4921875\"/>\n </scene>\n </scenes>\n <resources>\n <image name=\"SplashScreenLogo\" width=\"100\" height=\"90.333335876464844\"/>\n <namedColor name=\"SplashScreenBackground\">\n <color alpha=\"1.000\" blue=\"1.00000000000000\" green=\"1.00000000000000\" red=\"1.00000000000000\" customColorSpace=\"sRGB\" colorSpace=\"custom\"/>\n </namedColor>\n </resources>\n </document>`;\n return await new Parser().parseStringPromise(contents);\n}\n"],"mappings":";;;;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,GAAA;EAAA,MAAAF,IAAA,GAAAG,uBAAA,CAAAF,OAAA;EAAAC,EAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,KAAA;EAAA,MAAAJ,IAAA,GAAAG,uBAAA,CAAAF,OAAA;EAAAG,IAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,QAAA;EAA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AM;YACN,OAAOG,gBAAgB,CAAC,CAAC;UAC3B;QACF,CAAC;QACD,MAAMC,KAAKA,CAACR,QAAQ,EAAE;UAAES,UAAU;UAAEd,UAAU,EAAE;YAAEe;UAAW;QAAE,CAAC,EAAE;UAChE,IAAIA,UAAU,EAAE;YACd;UACF;UACA,MAAM1D,EAAE,CAAD,CAAC,CAACkD,QAAQ,CAACS,SAAS,CAACX,QAAQ,EAAE,IAAAY,4BAAQ,EAACH,UAAU,CAAC,CAAC;QAC7D;MACF,CAAC;IACH;EACF,CAAC,CAAC;AACJ,CAAC;;AAED;AAAA/B,OAAA,CAAAQ,oCAAA,GAAAA,oCAAA;AACO,eAAeqB,gBAAgBA,CAAA,EAAoC;EACxE,MAAMN,QAAQ,GAAG;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;EACZ,OAAO,MAAM,KAAII,gBAAM,EAAC,CAAC,CAACC,kBAAkB,CAACL,QAAQ,CAAC;AACxD","ignoreList":[]}
|
|
@@ -37,7 +37,8 @@ function applySplashScreenStoryboard(obj, splash) {
|
|
|
37
37
|
contentMode,
|
|
38
38
|
imageName,
|
|
39
39
|
backgroundColor: splash.backgroundColor,
|
|
40
|
-
|
|
40
|
+
enableFullScreenImage: splash.enableFullScreenImage_legacy ?? false,
|
|
41
|
+
imageWidth: splash.imageWidth
|
|
41
42
|
});
|
|
42
43
|
}
|
|
43
44
|
return (0, _InterfaceBuilder().removeImageFromSplashScreen)(obj, {
|
package/build/plugins/unversioned/expo-splash-screen/withIosSplashScreenStoryboardImage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withIosSplashScreenStoryboardImage.js","names":["_InterfaceBuilder","data","require","_withIosSplashScreenStoryboard","withIosSplashScreenImage","config","props","withIosSplashScreenStoryboard","modResults","applySplashScreenStoryboard","exports","obj","splash","resizeMode","splashScreenImagePresent","Boolean","image","imageName","contentMode","getImageContentMode","applyImageToSplashScreenXML","backgroundColor","
|
|
1
|
+
{"version":3,"file":"withIosSplashScreenStoryboardImage.js","names":["_InterfaceBuilder","data","require","_withIosSplashScreenStoryboard","withIosSplashScreenImage","config","props","withIosSplashScreenStoryboard","modResults","applySplashScreenStoryboard","exports","obj","splash","resizeMode","splashScreenImagePresent","Boolean","image","imageName","contentMode","getImageContentMode","applyImageToSplashScreenXML","backgroundColor","enableFullScreenImage","enableFullScreenImage_legacy","imageWidth","removeImageFromSplashScreen","Error"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withIosSplashScreenStoryboardImage.ts"],"sourcesContent":["import { ConfigPlugin } from '@expo/config-plugins';\n\nimport {\n applyImageToSplashScreenXML,\n IBSplashScreenDocument,\n ImageContentMode,\n removeImageFromSplashScreen,\n} from './InterfaceBuilder';\nimport { IOSSplashConfig } from './getIosSplashConfig';\nimport { withIosSplashScreenStoryboard } from './withIosSplashScreenStoryboard';\n\nexport const withIosSplashScreenImage: ConfigPlugin<IOSSplashConfig> = (config, props) => {\n return withIosSplashScreenStoryboard(config, (config) => {\n config.modResults = applySplashScreenStoryboard(config.modResults, props);\n return config;\n });\n};\n\nexport function applySplashScreenStoryboard(obj: IBSplashScreenDocument, splash: IOSSplashConfig) {\n const resizeMode = splash?.resizeMode;\n const splashScreenImagePresent = Boolean(splash?.image);\n const imageName = 'SplashScreenLogo';\n // Only get the resize mode when the image is present.\n if (splashScreenImagePresent) {\n const contentMode = getImageContentMode(resizeMode || 'contain');\n return applyImageToSplashScreenXML(obj, {\n contentMode,\n imageName,\n backgroundColor: splash.backgroundColor,\n enableFullScreenImage: splash.enableFullScreenImage_legacy ?? false,\n imageWidth: splash.imageWidth,\n });\n }\n\n return removeImageFromSplashScreen(obj, { imageName });\n}\n\nfunction getImageContentMode(resizeMode: string): ImageContentMode {\n switch (resizeMode) {\n case 'contain':\n return 'scaleAspectFit';\n case 'cover':\n return 'scaleAspectFill';\n default:\n throw new Error(`{ resizeMode: \"${resizeMode}\" } is not supported for iOS platform.`);\n }\n}\n"],"mappings":";;;;;;;AAEA,SAAAA,kBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,iBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAOA,SAAAE,+BAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,8BAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAMG,wBAAuD,GAAGA,CAACC,MAAM,EAAEC,KAAK,KAAK;EACxF,OAAO,IAAAC,8DAA6B,EAACF,MAAM,EAAGA,MAAM,IAAK;IACvDA,MAAM,CAACG,UAAU,GAAGC,2BAA2B,CAACJ,MAAM,CAACG,UAAU,EAAEF,KAAK,CAAC;IACzE,OAAOD,MAAM;EACf,CAAC,CAAC;AACJ,CAAC;AAACK,OAAA,CAAAN,wBAAA,GAAAA,wBAAA;AAEK,SAASK,2BAA2BA,CAACE,GAA2B,EAAEC,MAAuB,EAAE;EAChG,MAAMC,UAAU,GAAGD,MAAM,EAAEC,UAAU;EACrC,MAAMC,wBAAwB,GAAGC,OAAO,CAACH,MAAM,EAAEI,KAAK,CAAC;EACvD,MAAMC,SAAS,GAAG,kBAAkB;EACpC;EACA,IAAIH,wBAAwB,EAAE;IAC5B,MAAMI,WAAW,GAAGC,mBAAmB,CAACN,UAAU,IAAI,SAAS,CAAC;IAChE,OAAO,IAAAO,+CAA2B,EAACT,GAAG,EAAE;MACtCO,WAAW;MACXD,SAAS;MACTI,eAAe,EAAET,MAAM,CAACS,eAAe;MACvCC,qBAAqB,EAAEV,MAAM,CAACW,4BAA4B,IAAI,KAAK;MACnEC,UAAU,EAAEZ,MAAM,CAACY;IACrB,CAAC,CAAC;EACJ;EAEA,OAAO,IAAAC,+CAA2B,EAACd,GAAG,EAAE;IAAEM;EAAU,CAAC,CAAC;AACxD;AAEA,SAASE,mBAAmBA,CAACN,UAAkB,EAAoB;EACjE,QAAQA,UAAU;IAChB,KAAK,SAAS;MACZ,OAAO,gBAAgB;IACzB,KAAK,OAAO;MACV,OAAO,iBAAiB;IAC1B;MACE,MAAM,IAAIa,KAAK,CAAC,kBAAkBb,UAAU,wCAAwC,CAAC;EACzF;AACF","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/prebuild-config",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.10",
|
|
4
4
|
"description": "Get the prebuild config",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "c0899e56c5be08b0142f06f05aa7bac8d6bc18b8"
|
|
59
59
|
}
|