@expo/prebuild-config 8.0.5 → 8.0.7
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.d.ts +1 -1
- package/build/plugins/icons/withAndroidIcons.js +46 -27
- package/build/plugins/icons/withAndroidIcons.js.map +1 -1
- package/build/plugins/unversioned/expo-splash-screen/InterfaceBuilder.d.ts +23 -5
- package/build/plugins/unversioned/expo-splash-screen/InterfaceBuilder.js +47 -10
- package/build/plugins/unversioned/expo-splash-screen/InterfaceBuilder.js.map +1 -1
- package/build/plugins/unversioned/expo-splash-screen/getAndroidSplashConfig.d.ts +21 -7
- package/build/plugins/unversioned/expo-splash-screen/getAndroidSplashConfig.js +29 -3
- package/build/plugins/unversioned/expo-splash-screen/getAndroidSplashConfig.js.map +1 -1
- package/build/plugins/unversioned/expo-splash-screen/getIosSplashConfig.d.ts +1 -0
- package/build/plugins/unversioned/expo-splash-screen/getIosSplashConfig.js.map +1 -1
- package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashDrawables.js +2 -2
- package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashDrawables.js.map +1 -1
- package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashImages.d.ts +4 -4
- package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashImages.js +33 -19
- package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashImages.js.map +1 -1
- package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashLegacyMainActivity.d.ts +3 -2
- package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashLegacyMainActivity.js +5 -5
- package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashLegacyMainActivity.js.map +1 -1
- package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashMainActivity.d.ts +3 -0
- package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashMainActivity.js +58 -0
- package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashMainActivity.js.map +1 -0
- package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashScreen.d.ts +2 -1
- package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashScreen.js +6 -41
- package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashScreen.js.map +1 -1
- package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashStrings.d.ts +2 -1
- package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashStrings.js +2 -2
- package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashStrings.js.map +1 -1
- package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashStyles.d.ts +4 -3
- package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashStyles.js +45 -10
- package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashStyles.js.map +1 -1
- package/build/plugins/unversioned/expo-splash-screen/withIosSplashAssets.js +46 -67
- package/build/plugins/unversioned/expo-splash-screen/withIosSplashAssets.js.map +1 -1
- package/build/plugins/unversioned/expo-splash-screen/withIosSplashScreen.js +11 -8
- package/build/plugins/unversioned/expo-splash-screen/withIosSplashScreen.js.map +1 -1
- package/build/plugins/unversioned/expo-splash-screen/withIosSplashScreenStoryboard.js +31 -64
- package/build/plugins/unversioned/expo-splash-screen/withIosSplashScreenStoryboard.js.map +1 -1
- package/build/plugins/unversioned/expo-splash-screen/{wtihIosSplashScreenStoryboardImage.js → withIosSplashScreenStoryboardImage.js} +7 -5
- package/build/plugins/unversioned/expo-splash-screen/withIosSplashScreenStoryboardImage.js.map +1 -0
- package/build/plugins/withDefaultPlugins.js +1 -1
- package/build/plugins/withDefaultPlugins.js.map +1 -1
- package/package.json +2 -2
- package/build/plugins/unversioned/expo-splash-screen/wtihIosSplashScreenStoryboardImage.js.map +0 -1
- /package/build/plugins/unversioned/expo-splash-screen/{wtihIosSplashScreenStoryboardImage.d.ts → withIosSplashScreenStoryboardImage.d.ts} +0 -0
|
@@ -6,9 +6,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getAndroidDarkSplashConfig = getAndroidDarkSplashConfig;
|
|
7
7
|
exports.getAndroidSplashConfig = getAndroidSplashConfig;
|
|
8
8
|
const defaultResizeMode = 'contain';
|
|
9
|
-
function getAndroidSplashConfig(config) {
|
|
9
|
+
function getAndroidSplashConfig(config, props) {
|
|
10
10
|
// Respect the splash screen object, don't mix and match across different splash screen objects
|
|
11
11
|
// in case the user wants the top level splash to apply to every platform except android.
|
|
12
|
+
if (props) {
|
|
13
|
+
const splash = props;
|
|
14
|
+
return {
|
|
15
|
+
xxxhdpi: splash.xxxhdpi ?? splash.image ?? null,
|
|
16
|
+
xxhdpi: splash.xxhdpi ?? splash.image ?? null,
|
|
17
|
+
xhdpi: splash.xhdpi ?? splash.image ?? null,
|
|
18
|
+
hdpi: splash.hdpi ?? splash.image ?? null,
|
|
19
|
+
mdpi: splash.mdpi ?? splash.image ?? null,
|
|
20
|
+
backgroundColor: splash.backgroundColor ?? null,
|
|
21
|
+
resizeMode: splash.resizeMode ?? defaultResizeMode
|
|
22
|
+
};
|
|
23
|
+
}
|
|
12
24
|
if (config.android?.splash) {
|
|
13
25
|
const splash = config.android?.splash;
|
|
14
26
|
return {
|
|
@@ -35,12 +47,26 @@ function getAndroidSplashConfig(config) {
|
|
|
35
47
|
}
|
|
36
48
|
return null;
|
|
37
49
|
}
|
|
38
|
-
function getAndroidDarkSplashConfig(config) {
|
|
50
|
+
function getAndroidDarkSplashConfig(config, props) {
|
|
51
|
+
if (props?.dark) {
|
|
52
|
+
const splash = props.dark;
|
|
53
|
+
const lightTheme = getAndroidSplashConfig(config, props);
|
|
54
|
+
return {
|
|
55
|
+
xxxhdpi: splash.xxxhdpi ?? splash.image ?? null,
|
|
56
|
+
xxhdpi: splash.xxhdpi ?? splash.image ?? null,
|
|
57
|
+
xhdpi: splash.xhdpi ?? splash.image ?? null,
|
|
58
|
+
hdpi: splash.hdpi ?? splash.image ?? null,
|
|
59
|
+
mdpi: splash.mdpi ?? splash.image ?? null,
|
|
60
|
+
backgroundColor: splash.backgroundColor ?? null,
|
|
61
|
+
resizeMode: lightTheme?.resizeMode ?? defaultResizeMode
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
39
65
|
// Respect the splash screen object, don't mix and match across different splash screen objects
|
|
40
66
|
// in case the user wants the top level splash to apply to every platform except android.
|
|
41
67
|
if (config.android?.splash?.dark) {
|
|
42
68
|
const splash = config.android?.splash?.dark;
|
|
43
|
-
const lightTheme = getAndroidSplashConfig(config);
|
|
69
|
+
const lightTheme = getAndroidSplashConfig(config, props);
|
|
44
70
|
return {
|
|
45
71
|
xxxhdpi: splash.xxxhdpi ?? splash.image ?? null,
|
|
46
72
|
xxhdpi: splash.xxhdpi ?? splash.image ?? null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAndroidSplashConfig.js","names":["defaultResizeMode","getAndroidSplashConfig","config","
|
|
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 | null;\n xxhdpi?: string | null;\n xhdpi?: string | null;\n hdpi?: string | null;\n mdpi?: string | null;\n image?: string | null;\n backgroundColor: string | null;\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 logoWidth?: number;\n} & SplashScreenConfig;\n\nconst defaultResizeMode = 'contain';\n\nexport function getAndroidSplashConfig(\n config: Pick<ExpoConfig, 'splash' | 'android'>,\n props?: AndroidSplashConfig | null\n): SplashScreenConfig | 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 ?? null,\n xxhdpi: splash.xxhdpi ?? splash.image ?? null,\n xhdpi: splash.xhdpi ?? splash.image ?? null,\n hdpi: splash.hdpi ?? splash.image ?? null,\n mdpi: splash.mdpi ?? splash.image ?? null,\n backgroundColor: splash.backgroundColor ?? null,\n resizeMode: splash.resizeMode ?? defaultResizeMode,\n };\n }\n\n if (config.android?.splash) {\n const splash = config.android?.splash;\n return {\n xxxhdpi: splash.xxxhdpi ?? splash.image ?? null,\n xxhdpi: splash.xxhdpi ?? splash.image ?? null,\n xhdpi: splash.xhdpi ?? splash.image ?? null,\n hdpi: splash.hdpi ?? splash.image ?? null,\n mdpi: splash.mdpi ?? splash.image ?? null,\n backgroundColor: splash.backgroundColor ?? null,\n resizeMode: splash.resizeMode ?? defaultResizeMode,\n };\n }\n\n if (config.splash) {\n const splash = config.splash;\n return {\n xxxhdpi: splash.image ?? null,\n xxhdpi: splash.image ?? null,\n xhdpi: splash.image ?? null,\n hdpi: splash.image ?? null,\n mdpi: splash.image ?? null,\n backgroundColor: splash.backgroundColor ?? null,\n resizeMode: splash.resizeMode ?? defaultResizeMode,\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 ?? null,\n xxhdpi: splash.xxhdpi ?? splash.image ?? null,\n xhdpi: splash.xhdpi ?? splash.image ?? null,\n hdpi: splash.hdpi ?? splash.image ?? null,\n mdpi: splash.mdpi ?? splash.image ?? null,\n backgroundColor: splash.backgroundColor ?? null,\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 ?? null,\n xxhdpi: splash.xxhdpi ?? splash.image ?? null,\n xhdpi: splash.xhdpi ?? splash.image ?? null,\n hdpi: splash.hdpi ?? splash.image ?? null,\n mdpi: splash.mdpi ?? splash.image ?? null,\n backgroundColor: splash.backgroundColor ?? null,\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":";;;;;;;AA2BA,MAAMA,iBAAiB,GAAG,SAAS;AAE5B,SAASC,sBAAsBA,CACpCC,MAA8C,EAC9CC,KAAkC,EACP;EAC3B;EACA;EACA,IAAIA,KAAK,EAAE;IACT,MAAMC,MAAM,GAAGD,KAAK;IACpB,OAAO;MACLE,OAAO,EAAED,MAAM,CAACC,OAAO,IAAID,MAAM,CAACE,KAAK,IAAI,IAAI;MAC/CC,MAAM,EAAEH,MAAM,CAACG,MAAM,IAAIH,MAAM,CAACE,KAAK,IAAI,IAAI;MAC7CE,KAAK,EAAEJ,MAAM,CAACI,KAAK,IAAIJ,MAAM,CAACE,KAAK,IAAI,IAAI;MAC3CG,IAAI,EAAEL,MAAM,CAACK,IAAI,IAAIL,MAAM,CAACE,KAAK,IAAI,IAAI;MACzCI,IAAI,EAAEN,MAAM,CAACM,IAAI,IAAIN,MAAM,CAACE,KAAK,IAAI,IAAI;MACzCK,eAAe,EAAEP,MAAM,CAACO,eAAe,IAAI,IAAI;MAC/CC,UAAU,EAAER,MAAM,CAACQ,UAAU,IAAIZ;IACnC,CAAC;EACH;EAEA,IAAIE,MAAM,CAACW,OAAO,EAAET,MAAM,EAAE;IAC1B,MAAMA,MAAM,GAAGF,MAAM,C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ACH;EAEA,OAAO,IAAI;AACb","ignoreList":[]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ExpoConfig } from '@expo/config-types';
|
|
2
2
|
type ExpoConfigIosSplash = NonNullable<NonNullable<ExpoConfig['ios']>['splash']>;
|
|
3
3
|
export interface IOSSplashConfig {
|
|
4
|
+
logoWidth?: number;
|
|
4
5
|
image?: string | null;
|
|
5
6
|
backgroundColor: string;
|
|
6
7
|
resizeMode: NonNullable<ExpoConfigIosSplash['resizeMode']>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getIosSplashConfig.js","names":["defaultResizeMode","defaultBackgroundColor","getIosSplashConfig","config","ios","splash","image","resizeMode","backgroundColor","tabletImage","tabletBackgroundColor","dark"],"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 image?: string | null;\n // tabletImage: string | null;\n backgroundColor: string;\n resizeMode: NonNullable<ExpoConfigIosSplash['resizeMode']>;\n tabletImage: string | null;\n // TODO: These are here just to test the functionality, the API should be more robust and account for tablet images.\n tabletBackgroundColor: string | null;\n dark?: {\n image?: string | null;\n backgroundColor?: string | null;\n tabletImage?: string | null;\n tabletBackgroundColor?: string | null;\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(config: ExpoConfig): 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 if (config.ios?.splash) {\n const splash = config.ios?.splash;\n const image = splash.image ?? null;\n return {\n image,\n resizeMode: splash.resizeMode ?? defaultResizeMode,\n backgroundColor: splash.backgroundColor ?? defaultBackgroundColor,\n tabletImage: splash.tabletImage ?? null,\n tabletBackgroundColor: splash.tabletBackgroundColor,\n dark: {\n image: splash.dark?.image ?? null,\n backgroundColor: splash.dark?.backgroundColor,\n tabletImage: splash.dark?.tabletImage ?? null,\n tabletBackgroundColor: splash.dark?.tabletBackgroundColor,\n },\n };\n }\n\n if (config.splash) {\n const splash = config.splash;\n const image = splash.image ?? null;\n return {\n image,\n resizeMode: splash.resizeMode ?? defaultResizeMode,\n backgroundColor: splash.backgroundColor ?? defaultBackgroundColor,\n tabletImage: null,\n tabletBackgroundColor: null,\n dark: {\n image: null,\n backgroundColor: null,\n tabletImage: null,\n tabletBackgroundColor: null,\n },\n };\n }\n\n return {\n backgroundColor: '#ffffff',\n resizeMode: 'contain',\n tabletImage: null,\n tabletBackgroundColor: null,\n };\n}\n"],"mappings":";;;;;;AAIA,MAAMA,iBAAiB,GAAG,SAAS;AACnC,MAAMC,sBAAsB,GAAG,SAAS;
|
|
1
|
+
{"version":3,"file":"getIosSplashConfig.js","names":["defaultResizeMode","defaultBackgroundColor","getIosSplashConfig","config","ios","splash","image","resizeMode","backgroundColor","tabletImage","tabletBackgroundColor","dark"],"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 logoWidth?: number;\n image?: string | null;\n // tabletImage: string | null;\n backgroundColor: string;\n resizeMode: NonNullable<ExpoConfigIosSplash['resizeMode']>;\n tabletImage: string | null;\n // TODO: These are here just to test the functionality, the API should be more robust and account for tablet images.\n tabletBackgroundColor: string | null;\n dark?: {\n image?: string | null;\n backgroundColor?: string | null;\n tabletImage?: string | null;\n tabletBackgroundColor?: string | null;\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(config: ExpoConfig): 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 if (config.ios?.splash) {\n const splash = config.ios?.splash;\n const image = splash.image ?? null;\n return {\n image,\n resizeMode: splash.resizeMode ?? defaultResizeMode,\n backgroundColor: splash.backgroundColor ?? defaultBackgroundColor,\n tabletImage: splash.tabletImage ?? null,\n tabletBackgroundColor: splash.tabletBackgroundColor,\n dark: {\n image: splash.dark?.image ?? null,\n backgroundColor: splash.dark?.backgroundColor,\n tabletImage: splash.dark?.tabletImage ?? null,\n tabletBackgroundColor: splash.dark?.tabletBackgroundColor,\n },\n };\n }\n\n if (config.splash) {\n const splash = config.splash;\n const image = splash.image ?? null;\n return {\n image,\n resizeMode: splash.resizeMode ?? defaultResizeMode,\n backgroundColor: splash.backgroundColor ?? defaultBackgroundColor,\n tabletImage: null,\n tabletBackgroundColor: null,\n dark: {\n image: null,\n backgroundColor: null,\n tabletImage: null,\n tabletBackgroundColor: null,\n },\n };\n }\n\n return {\n backgroundColor: '#ffffff',\n resizeMode: 'contain',\n tabletImage: null,\n tabletBackgroundColor: null,\n };\n}\n"],"mappings":";;;;;;AAIA,MAAMA,iBAAiB,GAAG,SAAS;AACnC,MAAMC,sBAAsB,GAAG,SAAS;AAmBxC;AACO,SAASC,kBAAkBA,CAACC,MAAkB,EAA0B;EAC7E;EACA;EACA,IAAIA,MAAM,CAACC,GAAG,EAAEC,MAAM,EAAE;IACtB,MAAMA,MAAM,GAAGF,MAAM,CAACC,GAAG,EAAEC,MAAM;IACjC,MAAMC,KAAK,GAAGD,MAAM,CAACC,KAAK,IAAI,IAAI;IAClC,OAAO;MACLA,KAAK;MACLC,UAAU,EAAEF,MAAM,CAACE,UAAU,IAAIP,iBAAiB;MAClDQ,eAAe,EAAEH,MAAM,CAACG,eAAe,IAAIP,sBAAsB;MACjEQ,WAAW,EAAEJ,MAAM,CAACI,WAAW,IAAI,IAAI;MACvCC,qBAAqB,EAAEL,MAAM,CAACK,qBAAqB;MACnDC,IAAI,EAAE;QACJL,KAAK,EAAED,MAAM,CAACM,IAAI,EAAEL,KAAK,IAAI,IAAI;QACjCE,eAAe,EAAEH,MAAM,CAACM,IAAI,EAAEH,eAAe;QAC7CC,WAAW,EAAEJ,MAAM,CAACM,IAAI,EAAEF,WAAW,IAAI,IAAI;QAC7CC,qBAAqB,EAAEL,MAAM,CAACM,IAAI,EAAED;MACtC;IACF,CAAC;EACH;EAEA,IAAIP,MAAM,CAACE,MAAM,EAAE;IACjB,MAAMA,MAAM,GAAGF,MAAM,CAACE,MAAM;IAC5B,MAAMC,KAAK,GAAGD,MAAM,CAACC,KAAK,IAAI,IAAI;IAClC,OAAO;MACLA,KAAK;MACLC,UAAU,EAAEF,MAAM,CAACE,UAAU,IAAIP,iBAAiB;MAClDQ,eAAe,EAAEH,MAAM,CAACG,eAAe,IAAIP,sBAAsB;MACjEQ,WAAW,EAAE,IAAI;MACjBC,qBAAqB,EAAE,IAAI;MAC3BC,IAAI,EAAE;QACJL,KAAK,EAAE,IAAI;QACXE,eAAe,EAAE,IAAI;QACrBC,WAAW,EAAE,IAAI;QACjBC,qBAAqB,EAAE;MACzB;IACF,CAAC;EACH;EAEA,OAAO;IACLF,eAAe,EAAE,SAAS;IAC1BD,UAAU,EAAE,SAAS;IACrBE,WAAW,EAAE,IAAI;IACjBC,qBAAqB,EAAE;EACzB,CAAC;AACH","ignoreList":[]}
|
|
@@ -25,7 +25,7 @@ async function setSplashDrawableAsync({
|
|
|
25
25
|
resizeMode
|
|
26
26
|
}, projectRoot) {
|
|
27
27
|
const filePath = await _configPlugins().AndroidConfig.Paths.getResourceXMLPathAsync(projectRoot, {
|
|
28
|
-
name: '
|
|
28
|
+
name: 'ic_launcher_background',
|
|
29
29
|
kind: 'drawable'
|
|
30
30
|
});
|
|
31
31
|
|
|
@@ -47,7 +47,7 @@ async function setSplashDrawableAsync({
|
|
|
47
47
|
$: {
|
|
48
48
|
'android:gravity': 'center',
|
|
49
49
|
// TODO: Ensure these keys don't get out of sync
|
|
50
|
-
'android:src': '@drawable/
|
|
50
|
+
'android:src': '@drawable/splashscreen_logo'
|
|
51
51
|
}
|
|
52
52
|
}]
|
|
53
53
|
}].filter(Boolean)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withAndroidSplashDrawables.js","names":["_configPlugins","data","require","withAndroidSplashDrawables","config","splash","withDangerousMod","setSplashDrawableAsync","modRequest","projectRoot","exports","resizeMode","filePath","AndroidConfig","Paths","getResourceXMLPathAsync","name","kind","xmlContent","$","item","bitmap","filter","Boolean","XML","writeXMLAsync","path","xml"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withAndroidSplashDrawables.ts"],"sourcesContent":["import { AndroidConfig, ConfigPlugin, withDangerousMod, XML } from '@expo/config-plugins';\n\nimport { SplashScreenConfig } from './getAndroidSplashConfig';\n\nexport const withAndroidSplashDrawables: ConfigPlugin<Pick<SplashScreenConfig, 'resizeMode'>> = (\n config,\n splash\n) => {\n return withDangerousMod(config, [\n 'android',\n async (config) => {\n if (splash) {\n await setSplashDrawableAsync(splash, config.modRequest.projectRoot);\n }\n return config;\n },\n ]);\n};\n\nexport async function setSplashDrawableAsync(\n { resizeMode }: Pick<SplashScreenConfig, 'resizeMode'>,\n projectRoot: string\n) {\n const filePath = (await AndroidConfig.Paths.getResourceXMLPathAsync(projectRoot, {\n name: '
|
|
1
|
+
{"version":3,"file":"withAndroidSplashDrawables.js","names":["_configPlugins","data","require","withAndroidSplashDrawables","config","splash","withDangerousMod","setSplashDrawableAsync","modRequest","projectRoot","exports","resizeMode","filePath","AndroidConfig","Paths","getResourceXMLPathAsync","name","kind","xmlContent","$","item","bitmap","filter","Boolean","XML","writeXMLAsync","path","xml"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withAndroidSplashDrawables.ts"],"sourcesContent":["import { AndroidConfig, ConfigPlugin, withDangerousMod, XML } from '@expo/config-plugins';\n\nimport { SplashScreenConfig } from './getAndroidSplashConfig';\n\nexport const withAndroidSplashDrawables: ConfigPlugin<Pick<SplashScreenConfig, 'resizeMode'>> = (\n config,\n splash\n) => {\n return withDangerousMod(config, [\n 'android',\n async (config) => {\n if (splash) {\n await setSplashDrawableAsync(splash, config.modRequest.projectRoot);\n }\n return config;\n },\n ]);\n};\n\nexport async function setSplashDrawableAsync(\n { resizeMode }: Pick<SplashScreenConfig, 'resizeMode'>,\n projectRoot: string\n) {\n const filePath = (await AndroidConfig.Paths.getResourceXMLPathAsync(projectRoot, {\n name: 'ic_launcher_background',\n kind: 'drawable',\n }))!;\n\n // Nuke and rewrite the splashscreen.xml drawable\n const xmlContent = {\n 'layer-list': {\n $: {\n 'xmlns:android': 'http://schemas.android.com/apk/res/android',\n },\n item: [\n {\n $: {\n // TODO: Ensure these keys don't get out of sync\n 'android:drawable': '@color/splashscreen_background',\n },\n },\n // Only include the image if resizeMode native is in-use.\n resizeMode === 'native' && {\n bitmap: [\n {\n $: {\n 'android:gravity': 'center',\n // TODO: Ensure these keys don't get out of sync\n 'android:src': '@drawable/splashscreen_logo',\n },\n },\n ],\n },\n ].filter(Boolean),\n },\n };\n await XML.writeXMLAsync({ path: filePath, xml: xmlContent });\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIO,MAAME,0BAAgF,GAAGA,CAC9FC,MAAM,EACNC,MAAM,KACH;EACH,OAAO,IAAAC,iCAAgB,EAACF,MAAM,EAAE,CAC9B,SAAS,EACT,MAAOA,MAAM,IAAK;IAChB,IAAIC,MAAM,EAAE;MACV,MAAME,sBAAsB,CAACF,MAAM,EAAED,MAAM,CAACI,UAAU,CAACC,WAAW,CAAC;IACrE;IACA,OAAOL,MAAM;EACf,CAAC,CACF,CAAC;AACJ,CAAC;AAACM,OAAA,CAAAP,0BAAA,GAAAA,0BAAA;AAEK,eAAeI,sBAAsBA,CAC1C;EAAEI;AAAmD,CAAC,EACtDF,WAAmB,EACnB;EACA,MAAMG,QAAQ,GAAI,MAAMC,8BAAa,CAACC,KAAK,CAACC,uBAAuB,CAACN,WAAW,EAAE;IAC/EO,IAAI,EAAE,wBAAwB;IAC9BC,IAAI,EAAE;EACR,CAAC,CAAG;;EAEJ;EACA,MAAMC,UAAU,GAAG;IACjB,YAAY,EAAE;MACZC,CAAC,EAAE;QACD,eAAe,EAAE;MACnB,CAAC;MACDC,IAAI,EAAE,CACJ;QACED,CAAC,EAAE;UACD;UACA,kBAAkB,EAAE;QACtB;MACF,CAAC;MACD;MACAR,UAAU,KAAK,QAAQ,IAAI;QACzBU,MAAM,EAAE,CACN;UACEF,CAAC,EAAE;YACD,iBAAiB,EAAE,QAAQ;YAC3B;YACA,aAAa,EAAE;UACjB;QACF,CAAC;MAEL,CAAC,CACF,CAACG,MAAM,CAACC,OAAO;IAClB;EACF,CAAC;EACD,MAAMC,oBAAG,CAACC,aAAa,CAAC;IAAEC,IAAI,EAAEd,QAAQ;IAAEe,GAAG,EAAET;EAAW,CAAC,CAAC;AAC9D","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ConfigPlugin } from '@expo/config-plugins';
|
|
2
2
|
import { ExpoConfig } from '@expo/config-types';
|
|
3
|
-
import { SplashScreenConfig } from './getAndroidSplashConfig';
|
|
4
|
-
export declare const withAndroidSplashImages: ConfigPlugin
|
|
3
|
+
import { AndroidSplashConfig, SplashScreenConfig } from './getAndroidSplashConfig';
|
|
4
|
+
export declare const withAndroidSplashImages: ConfigPlugin<AndroidSplashConfig>;
|
|
5
5
|
/**
|
|
6
6
|
* Deletes all previous splash_screen_images and copies new one to desired drawable directory.
|
|
7
7
|
* If path isn't provided then no new image is placed in drawable directories.
|
|
@@ -9,5 +9,5 @@ export declare const withAndroidSplashImages: ConfigPlugin;
|
|
|
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'>, projectRoot: string): Promise<void>;
|
|
13
|
-
export declare function setSplashImageDrawablesForThemeAsync(config: SplashScreenConfig | null, theme: 'dark' | 'light', projectRoot: string): Promise<void>;
|
|
12
|
+
export declare function setSplashImageDrawablesAsync(config: Pick<ExpoConfig, 'android' | 'splash'>, props: AndroidSplashConfig | null, projectRoot: string, logoWidth: number): Promise<void>;
|
|
13
|
+
export declare function setSplashImageDrawablesForThemeAsync(config: SplashScreenConfig | null, theme: 'dark' | 'light', projectRoot: string, logoWidth: number): Promise<void>;
|
|
@@ -43,7 +43,7 @@ function _getAndroidSplashConfig() {
|
|
|
43
43
|
}
|
|
44
44
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
45
45
|
const IMAGE_CACHE_NAME = 'splash-android';
|
|
46
|
-
const SPLASH_SCREEN_FILENAME = '
|
|
46
|
+
const SPLASH_SCREEN_FILENAME = 'splashscreen_logo.png';
|
|
47
47
|
const DRAWABLES_CONFIGS = {
|
|
48
48
|
default: {
|
|
49
49
|
modes: {
|
|
@@ -112,9 +112,9 @@ const DRAWABLES_CONFIGS = {
|
|
|
112
112
|
dimensionsMultiplier: 4
|
|
113
113
|
}
|
|
114
114
|
};
|
|
115
|
-
const withAndroidSplashImages = config => {
|
|
115
|
+
const withAndroidSplashImages = (config, props) => {
|
|
116
116
|
return (0, _configPlugins().withDangerousMod)(config, ['android', async config => {
|
|
117
|
-
await setSplashImageDrawablesAsync(config, config.modRequest.projectRoot);
|
|
117
|
+
await setSplashImageDrawablesAsync(config, props, config.modRequest.projectRoot, props?.logoWidth ?? 100);
|
|
118
118
|
return config;
|
|
119
119
|
}]);
|
|
120
120
|
};
|
|
@@ -127,11 +127,11 @@ const withAndroidSplashImages = config => {
|
|
|
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, projectRoot) {
|
|
130
|
+
async function setSplashImageDrawablesAsync(config, props, projectRoot, logoWidth) {
|
|
131
131
|
await clearAllExistingSplashImagesAsync(projectRoot);
|
|
132
|
-
const splash = (0, _getAndroidSplashConfig().getAndroidSplashConfig)(config);
|
|
133
|
-
const darkSplash = (0, _getAndroidSplashConfig().getAndroidDarkSplashConfig)(config);
|
|
134
|
-
await Promise.all([setSplashImageDrawablesForThemeAsync(splash, 'light', projectRoot), setSplashImageDrawablesForThemeAsync(darkSplash, 'dark', projectRoot)]);
|
|
132
|
+
const splash = (0, _getAndroidSplashConfig().getAndroidSplashConfig)(config, props);
|
|
133
|
+
const darkSplash = (0, _getAndroidSplashConfig().getAndroidDarkSplashConfig)(config, props);
|
|
134
|
+
await Promise.all([setSplashImageDrawablesForThemeAsync(splash, 'light', projectRoot, logoWidth), setSplashImageDrawablesForThemeAsync(darkSplash, 'dark', projectRoot, logoWidth)]);
|
|
135
135
|
}
|
|
136
136
|
async function clearAllExistingSplashImagesAsync(projectRoot) {
|
|
137
137
|
const androidMainPath = _path().default.join(projectRoot, 'android/app/src/main');
|
|
@@ -147,33 +147,47 @@ async function clearAllExistingSplashImagesAsync(projectRoot) {
|
|
|
147
147
|
}));
|
|
148
148
|
}));
|
|
149
149
|
}
|
|
150
|
-
async function setSplashImageDrawablesForThemeAsync(config, theme, projectRoot) {
|
|
150
|
+
async function setSplashImageDrawablesForThemeAsync(config, theme, projectRoot, logoWidth) {
|
|
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'];
|
|
154
|
+
await Promise.all(sizes.map(async imageKey => {
|
|
154
155
|
// @ts-ignore
|
|
155
156
|
const image = config[imageKey];
|
|
156
157
|
if (image) {
|
|
157
|
-
|
|
158
|
-
//
|
|
158
|
+
const multiplier = DRAWABLES_CONFIGS[imageKey].dimensionsMultiplier;
|
|
159
|
+
const size = logoWidth * multiplier; // "logoWidth" must be replaced by the logo width chosen by the user in its config file
|
|
160
|
+
const canvasSize = 288 * multiplier;
|
|
161
|
+
const background = await (0, _imageUtils().generateImageBackgroundAsync)({
|
|
162
|
+
width: canvasSize,
|
|
163
|
+
height: canvasSize,
|
|
164
|
+
backgroundColor: config.backgroundColor ?? 'transparent',
|
|
165
|
+
resizeMode: 'cover'
|
|
166
|
+
});
|
|
159
167
|
const {
|
|
160
|
-
source
|
|
168
|
+
source: foreground
|
|
161
169
|
} = await (0, _imageUtils().generateImageAsync)({
|
|
162
170
|
projectRoot,
|
|
163
171
|
cacheType: IMAGE_CACHE_NAME
|
|
164
172
|
}, {
|
|
165
|
-
src: image
|
|
173
|
+
src: image,
|
|
174
|
+
resizeMode: 'contain',
|
|
175
|
+
width: size,
|
|
176
|
+
height: size
|
|
177
|
+
});
|
|
178
|
+
const composedImage = await (0, _imageUtils().compositeImagesAsync)({
|
|
179
|
+
background,
|
|
180
|
+
foreground,
|
|
181
|
+
x: (canvasSize - size) / 2,
|
|
182
|
+
y: (canvasSize - size) / 2
|
|
166
183
|
});
|
|
167
184
|
|
|
168
185
|
// Get output path for drawable.
|
|
169
|
-
const outputPath = _path().default.join(androidMainPath,
|
|
170
|
-
// @ts-ignore
|
|
171
|
-
DRAWABLES_CONFIGS[imageKey].modes[theme].path);
|
|
172
|
-
// Ensure directory exists.
|
|
186
|
+
const outputPath = _path().default.join(androidMainPath, DRAWABLES_CONFIGS[imageKey].modes[theme].path);
|
|
173
187
|
const folder = _path().default.dirname(outputPath);
|
|
188
|
+
// Ensure directory exists.
|
|
174
189
|
await _fsExtra().default.ensureDir(folder);
|
|
175
|
-
|
|
176
|
-
await _fsExtra().default.writeFile(outputPath, source);
|
|
190
|
+
await _fsExtra().default.writeFile(outputPath, composedImage);
|
|
177
191
|
}
|
|
178
192
|
return null;
|
|
179
193
|
}));
|
|
@@ -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","withDangerousMod","setSplashImageDrawablesAsync","modRequest","projectRoot","exports","clearAllExistingSplashImagesAsync","splash","getAndroidSplashConfig","darkSplash","getAndroidDarkSplashConfig","Promise","all","setSplashImageDrawablesForThemeAsync","androidMainPath","join","Object","values","map","filePath","fs","pathExists","resolve","remove","theme","imageKey","image","source","generateImageAsync","cacheType","src","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 { generateImageAsync } from '@expo/image-utils';\nimport fs from 'fs-extra';\nimport path from 'path';\n\nimport {\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_image.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 = (config) => {\n return withDangerousMod(config, [\n 'android',\n async (config) => {\n await setSplashImageDrawablesAsync(config, config.modRequest.projectRoot);\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 projectRoot: string\n) {\n await clearAllExistingSplashImagesAsync(projectRoot);\n\n const splash = getAndroidSplashConfig(config);\n const darkSplash = getAndroidDarkSplashConfig(config);\n\n await Promise.all([\n setSplashImageDrawablesForThemeAsync(splash, 'light', projectRoot),\n setSplashImageDrawablesForThemeAsync(darkSplash, 'dark', projectRoot),\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) {\n if (!config) return;\n const androidMainPath = path.join(projectRoot, 'android/app/src/main');\n\n await Promise.all(\n ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi', 'xxxhdpi'].map(async (imageKey) => {\n // @ts-ignore\n const image = config[imageKey];\n if (image) {\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: image,\n } as any);\n\n // Get output path for drawable.\n const outputPath = path.join(\n androidMainPath,\n // @ts-ignore\n DRAWABLES_CONFIGS[imageKey].modes[theme].path\n );\n // Ensure directory exists.\n const folder = path.dirname(outputPath);\n await fs.ensureDir(folder);\n // Write image buffer to the file system.\n await fs.writeFile(outputPath, source);\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;AAA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,CAAC,MAAOO,QAAQ,IAAK;IACrE;IACA,MAAMC,KAAK,GAAG1B,MAAM,CAACyB,QAAQ,CAAC;IAC9B,IAAIC,KAAK,EAAE;MACT;MACA;MACA,MAAM;QAAEC;MAAO,CAAC,GAAG,MAAM,IAAAC,gCAAkB,EAAC;QAAExB,WAAW;QAAEyB,SAAS,EAAE3C;MAAiB,CAAC,EAAE;QACxF4C,GAAG,EAAEJ;MACP,CAAQ,CAAC;;MAET;MACA,MAAMK,UAAU,GAAGxC,eAAI,CAACwB,IAAI,CAC1BD,eAAe;MACf;MACA1B,iBAAiB,CAACqC,QAAQ,CAAC,CAACpC,KAAK,CAACmC,KAAK,CAAC,CAACjC,IAC3C,CAAC;MACD;MACA,MAAMyC,MAAM,GAAGzC,eAAI,CAAC0C,OAAO,CAACF,UAAU,CAAC;MACvC,MAAMX,kBAAE,CAACc,SAAS,CAACF,MAAM,CAAC;MAC1B;MACA,MAAMZ,kBAAE,CAACe,SAAS,CAACJ,UAAU,EAAEJ,MAAM,CAAC;IACxC;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","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,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AAM,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":[]}
|
package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashLegacyMainActivity.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ConfigPlugin } from '@expo/config-plugins';
|
|
2
2
|
import { ExpoConfig } from '@expo/config-types';
|
|
3
|
-
|
|
4
|
-
export declare
|
|
3
|
+
import { AndroidSplashConfig } from './getAndroidSplashConfig';
|
|
4
|
+
export declare const withAndroidSplashLegacyMainActivity: ConfigPlugin<AndroidSplashConfig>;
|
|
5
|
+
export declare function setSplashScreenLegacyMainActivity(config: Pick<ExpoConfig, 'android' | 'androidStatusBar' | 'userInterfaceStyle'>, props: AndroidSplashConfig, mainActivity: string, language: 'java' | 'kt'): string;
|
|
@@ -45,16 +45,16 @@ const debug = (0, _debug().default)('expo:prebuild-config:expo-splash-screen:and
|
|
|
45
45
|
|
|
46
46
|
// DO NOT CHANGE
|
|
47
47
|
const SHOW_SPLASH_ID = 'expo-splash-screen-mainActivity-onCreate-show-splash';
|
|
48
|
-
const withAndroidSplashLegacyMainActivity = config => {
|
|
48
|
+
const withAndroidSplashLegacyMainActivity = (config, props) => {
|
|
49
49
|
return (0, _configPlugins().withMainActivity)(config, config => {
|
|
50
|
-
config.modResults.contents = setSplashScreenLegacyMainActivity(config, config.modResults.contents, config.modResults.language);
|
|
50
|
+
config.modResults.contents = setSplashScreenLegacyMainActivity(config, props, config.modResults.contents, config.modResults.language);
|
|
51
51
|
return config;
|
|
52
52
|
});
|
|
53
53
|
};
|
|
54
54
|
exports.withAndroidSplashLegacyMainActivity = withAndroidSplashLegacyMainActivity;
|
|
55
|
-
function setSplashScreenLegacyMainActivity(config, mainActivity, language) {
|
|
55
|
+
function setSplashScreenLegacyMainActivity(config, props, mainActivity, language) {
|
|
56
56
|
debug(`Modify with language: "${language}"`);
|
|
57
|
-
const splashConfig = (0, _getAndroidSplashConfig().getAndroidSplashConfig)(config);
|
|
57
|
+
const splashConfig = (0, _getAndroidSplashConfig().getAndroidSplashConfig)(config, props);
|
|
58
58
|
if (!splashConfig) {
|
|
59
59
|
// Remove our generated code safely...
|
|
60
60
|
const mod = (0, _generateCode().removeContents)({
|
|
@@ -74,7 +74,7 @@ function setSplashScreenLegacyMainActivity(config, mainActivity, language) {
|
|
|
74
74
|
} = splashConfig;
|
|
75
75
|
const isJava = language === 'java';
|
|
76
76
|
const LE = isJava ? ';' : '';
|
|
77
|
-
mainActivity = (0, _codeMod().addImports)(mainActivity, ['
|
|
77
|
+
mainActivity = (0, _codeMod().addImports)(mainActivity, ['host.exp.exponent.experience.splashscreen.legacy.singletons.SplashScreen', 'host.exp.exponent.experience.splashscreen.legacy.SplashScreenImageResizeMode', 'com.facebook.react.ReactRootView', 'android.os.Bundle'], isJava);
|
|
78
78
|
if (!mainActivity.match(/(?<=^.*super\.onCreate.*$)/m)) {
|
|
79
79
|
const onCreateBlock = isJava ? [' @Override', ' protected void onCreate(Bundle savedInstanceState) {', ' super.onCreate(savedInstanceState);', ' }'] : [' override fun onCreate(savedInstanceState: Bundle?) {', ' super.onCreate(savedInstanceState)', ' }'];
|
|
80
80
|
mainActivity = (0, _generateCode().mergeContents)({
|
package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashLegacyMainActivity.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withAndroidSplashLegacyMainActivity.js","names":["_configPlugins","data","require","_codeMod","_generateCode","_debug","_interopRequireDefault","_getAndroidSplashConfig","e","__esModule","default","debug","Debug","SHOW_SPLASH_ID","withAndroidSplashLegacyMainActivity","config","withMainActivity","modResults","contents","setSplashScreenLegacyMainActivity","language","exports","mainActivity","splashConfig","getAndroidSplashConfig","mod","removeContents","src","tag","didClear","statusBarTranslucent","androidStatusBar","translucent","resizeMode","isJava","LE","addImports","match","onCreateBlock","mergeContents","anchor","offset","comment","newSrc","join","split","filter","line","test","toUpperCase"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withAndroidSplashLegacyMainActivity.ts"],"sourcesContent":["import { ConfigPlugin, withMainActivity } from '@expo/config-plugins';\nimport { addImports } from '@expo/config-plugins/build/android/codeMod';\nimport { mergeContents, removeContents } from '@expo/config-plugins/build/utils/generateCode';\nimport { ExpoConfig } from '@expo/config-types';\nimport Debug from 'debug';\n\nimport { getAndroidSplashConfig } from './getAndroidSplashConfig';\n\nconst debug = Debug('expo:prebuild-config:expo-splash-screen:android:mainActivity');\n\n// DO NOT CHANGE\nconst SHOW_SPLASH_ID = 'expo-splash-screen-mainActivity-onCreate-show-splash';\n\nexport const withAndroidSplashLegacyMainActivity: ConfigPlugin = (config) => {\n return withMainActivity(config, (config) => {\n config.modResults.contents = setSplashScreenLegacyMainActivity(\n config,\n config.modResults.contents,\n config.modResults.language\n );\n return config;\n });\n};\n\nexport function setSplashScreenLegacyMainActivity(\n config: Pick<ExpoConfig, 'android' | 'androidStatusBar' | 'userInterfaceStyle'>,\n mainActivity: string,\n language: 'java' | 'kt'\n): string {\n debug(`Modify with language: \"${language}\"`);\n const splashConfig = getAndroidSplashConfig(config);\n\n if (!splashConfig) {\n // Remove our generated code safely...\n const mod = removeContents({\n src: mainActivity,\n tag: SHOW_SPLASH_ID,\n });\n\n mainActivity = mod.contents;\n if (mod.didClear) {\n debug('Removed SplashScreen.show()');\n }\n return mainActivity;\n }\n // TODO: Translucent is weird\n const statusBarTranslucent = !!config.androidStatusBar?.translucent;\n\n const { resizeMode } = splashConfig;\n const isJava = language === 'java';\n const LE = isJava ? ';' : '';\n\n mainActivity = addImports(\n mainActivity,\n [\n '
|
|
1
|
+
{"version":3,"file":"withAndroidSplashLegacyMainActivity.js","names":["_configPlugins","data","require","_codeMod","_generateCode","_debug","_interopRequireDefault","_getAndroidSplashConfig","e","__esModule","default","debug","Debug","SHOW_SPLASH_ID","withAndroidSplashLegacyMainActivity","config","props","withMainActivity","modResults","contents","setSplashScreenLegacyMainActivity","language","exports","mainActivity","splashConfig","getAndroidSplashConfig","mod","removeContents","src","tag","didClear","statusBarTranslucent","androidStatusBar","translucent","resizeMode","isJava","LE","addImports","match","onCreateBlock","mergeContents","anchor","offset","comment","newSrc","join","split","filter","line","test","toUpperCase"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withAndroidSplashLegacyMainActivity.ts"],"sourcesContent":["import { ConfigPlugin, withMainActivity } from '@expo/config-plugins';\nimport { addImports } from '@expo/config-plugins/build/android/codeMod';\nimport { mergeContents, removeContents } from '@expo/config-plugins/build/utils/generateCode';\nimport { ExpoConfig } from '@expo/config-types';\nimport Debug from 'debug';\n\nimport { AndroidSplashConfig, getAndroidSplashConfig } from './getAndroidSplashConfig';\n\nconst debug = Debug('expo:prebuild-config:expo-splash-screen:android:mainActivity');\n\n// DO NOT CHANGE\nconst SHOW_SPLASH_ID = 'expo-splash-screen-mainActivity-onCreate-show-splash';\n\nexport const withAndroidSplashLegacyMainActivity: ConfigPlugin<AndroidSplashConfig> = (\n config,\n props\n) => {\n return withMainActivity(config, (config) => {\n config.modResults.contents = setSplashScreenLegacyMainActivity(\n config,\n props,\n config.modResults.contents,\n config.modResults.language\n );\n return config;\n });\n};\n\nexport function setSplashScreenLegacyMainActivity(\n config: Pick<ExpoConfig, 'android' | 'androidStatusBar' | 'userInterfaceStyle'>,\n props: AndroidSplashConfig,\n mainActivity: string,\n language: 'java' | 'kt'\n): string {\n debug(`Modify with language: \"${language}\"`);\n const splashConfig = getAndroidSplashConfig(config, props);\n\n if (!splashConfig) {\n // Remove our generated code safely...\n const mod = removeContents({\n src: mainActivity,\n tag: SHOW_SPLASH_ID,\n });\n\n mainActivity = mod.contents;\n if (mod.didClear) {\n debug('Removed SplashScreen.show()');\n }\n return mainActivity;\n }\n // TODO: Translucent is weird\n const statusBarTranslucent = !!config.androidStatusBar?.translucent;\n\n const { resizeMode } = splashConfig;\n const isJava = language === 'java';\n const LE = isJava ? ';' : '';\n\n mainActivity = addImports(\n mainActivity,\n [\n 'host.exp.exponent.experience.splashscreen.legacy.singletons.SplashScreen',\n 'host.exp.exponent.experience.splashscreen.legacy.SplashScreenImageResizeMode',\n 'com.facebook.react.ReactRootView',\n 'android.os.Bundle',\n ],\n isJava\n );\n\n if (!mainActivity.match(/(?<=^.*super\\.onCreate.*$)/m)) {\n const onCreateBlock = isJava\n ? [\n ' @Override',\n ' protected void onCreate(Bundle savedInstanceState) {',\n ' super.onCreate(savedInstanceState);',\n ' }',\n ]\n : [\n ' override fun onCreate(savedInstanceState: Bundle?) {',\n ' super.onCreate(savedInstanceState)',\n ' }',\n ];\n\n mainActivity = mergeContents({\n src: mainActivity,\n // insert just below super.onCreate\n anchor: isJava\n ? /(?<=public\\s+class\\s+.*\\s+extends\\s+.*\\s+{.*$)/m\n : /(?<=class\\s+.*\\s+:\\s+.*\\s+{.*$)/m,\n offset: 1,\n comment: '//',\n tag: 'expo-splash-screen-mainActivity-onCreate',\n newSrc: onCreateBlock.join('\\n'),\n }).contents;\n }\n\n // Remove our generated code safely...\n mainActivity = removeContents({\n src: mainActivity,\n tag: SHOW_SPLASH_ID,\n }).contents;\n\n // Remove code from `@expo/configure-splash-screen`\n mainActivity = mainActivity\n .split('\\n')\n .filter((line) => {\n return !/SplashScreen\\.show\\(this,\\s?SplashScreenImageResizeMode\\./.test(line);\n })\n .join('\\n');\n\n // Reapply generated code.\n mainActivity = mergeContents({\n src: mainActivity,\n // insert just below super.onCreate\n anchor: /(?<=^.*super\\.onCreate.*$)/m,\n offset: 1,\n comment: '//',\n tag: SHOW_SPLASH_ID,\n newSrc: ` SplashScreen.show(this, SplashScreenImageResizeMode.${resizeMode.toUpperCase()}, ReactRootView${\n isJava ? '.class' : '::class.java'\n }, ${status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EAAEL,YAAY;MACjB;MACAkB,MAAM,EAAEN,MAAM,GACV,iDAAiD,GACjD,kCAAkC;MACtCO,MAAM,EAAE,CAAC;MACTC,OAAO,EAAE,IAAI;MACbd,GAAG,EAAE,0CAA0C;MAC/Ce,MAAM,EAAEL,aAAa,CAACM,IAAI,CAAC,IAAI;IACjC,CAAC,CAAC,CAAC1B,QAAQ;EACb;;EAEA;EACAI,YAAY,GAAG,IAAAI,8BAAc,EAAC;IAC5BC,GAAG,EAAEL,YAAY;IACjBM,GAAG,EAAEhB;EACP,CAAC,CAAC,CAACM,QAAQ;;EAEX;EACAI,YAAY,GAAGA,YAAY,CACxBuB,KAAK,CAAC,IAAI,CAAC,CACXC,MAAM,CAAEC,IAAI,IAAK;IAChB,OAAO,CAAC,2DAA2D,CAACC,IAAI,CAACD,IAAI,CAAC;EAChF,CAAC,CAAC,CACDH,IAAI,CAAC,IAAI,CAAC;;EAEb;EACAtB,YAAY,GAAG,IAAAiB,6BAAa,EAAC;IAC3BZ,GAAG,EAAEL,YAAY;IACjB;IACAkB,MAAM,EAAE,6BAA6B;IACrCC,MAAM,EAAE,CAAC;IACTC,OAAO,EAAE,IAAI;IACbd,GAAG,EAAEhB,cAAc;IACnB+B,MAAM,EAAE,2DAA2DV,UAAU,CAACgB,WAAW,CAAC,CAAC,kBACzFf,MAAM,GAAG,QAAQ,GAAG,cAAc,KAC/BJ,oBAAoB,IAAIK,EAAE;EACjC,CAAC,CAAC,CAACjB,QAAQ;;EAEX;;EAEA,OAAOI,YAAY;AACrB","ignoreList":[]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.withAndroidSplashMainActivity = void 0;
|
|
7
|
+
function _configPlugins() {
|
|
8
|
+
const data = require("@expo/config-plugins");
|
|
9
|
+
_configPlugins = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _codeMod() {
|
|
15
|
+
const data = require("@expo/config-plugins/build/android/codeMod");
|
|
16
|
+
_codeMod = function () {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
function _generateCode() {
|
|
22
|
+
const data = require("@expo/config-plugins/build/utils/generateCode");
|
|
23
|
+
_generateCode = function () {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
const withAndroidSplashMainActivity = (config, props) => {
|
|
29
|
+
if (!props) {
|
|
30
|
+
return config;
|
|
31
|
+
}
|
|
32
|
+
return (0, _configPlugins().withMainActivity)(config, config => {
|
|
33
|
+
const {
|
|
34
|
+
modResults
|
|
35
|
+
} = config;
|
|
36
|
+
const {
|
|
37
|
+
language
|
|
38
|
+
} = modResults;
|
|
39
|
+
const withImports = (0, _codeMod().addImports)(modResults.contents.replace(/(\/\/ )?setTheme\(R\.style\.AppTheme\)/, '// setTheme(R.style.AppTheme)'), ['expo.modules.splashscreen.SplashScreenManager'], language === 'java');
|
|
40
|
+
const init = (0, _generateCode().mergeContents)({
|
|
41
|
+
src: withImports,
|
|
42
|
+
comment: ' //',
|
|
43
|
+
tag: 'expo-splashscreen',
|
|
44
|
+
offset: 0,
|
|
45
|
+
anchor: /super\.onCreate\(null\)/,
|
|
46
|
+
newSrc: ' SplashScreenManager.registerOnActivity(this)' + (language === 'java' ? ';' : '')
|
|
47
|
+
});
|
|
48
|
+
return {
|
|
49
|
+
...config,
|
|
50
|
+
modResults: {
|
|
51
|
+
...modResults,
|
|
52
|
+
contents: init.contents
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
exports.withAndroidSplashMainActivity = withAndroidSplashMainActivity;
|
|
58
|
+
//# sourceMappingURL=withAndroidSplashMainActivity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withAndroidSplashMainActivity.js","names":["_configPlugins","data","require","_codeMod","_generateCode","withAndroidSplashMainActivity","config","props","withMainActivity","modResults","language","withImports","addImports","contents","replace","init","mergeContents","src","comment","tag","offset","anchor","newSrc","exports"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withAndroidSplashMainActivity.ts"],"sourcesContent":["import { ConfigPlugin, withMainActivity } from '@expo/config-plugins';\nimport { addImports } from '@expo/config-plugins/build/android/codeMod';\nimport { mergeContents } from '@expo/config-plugins/build/utils/generateCode';\n\nimport { AndroidSplashConfig } from './getAndroidSplashConfig';\n\nexport const withAndroidSplashMainActivity: ConfigPlugin<AndroidSplashConfig> = (config, props) => {\n if (!props) {\n return config;\n }\n return withMainActivity(config, (config) => {\n const { modResults } = config;\n const { language } = modResults;\n\n const withImports = addImports(\n modResults.contents.replace(\n /(\\/\\/ )?setTheme\\(R\\.style\\.AppTheme\\)/,\n '// setTheme(R.style.AppTheme)'\n ),\n ['expo.modules.splashscreen.SplashScreenManager'],\n language === 'java'\n );\n\n const init = mergeContents({\n src: withImports,\n comment: ' //',\n tag: 'expo-splashscreen',\n offset: 0,\n anchor: /super\\.onCreate\\(null\\)/,\n newSrc: ' SplashScreenManager.registerOnActivity(this)' + (language === 'java' ? ';' : ''),\n });\n\n return {\n ...config,\n modResults: {\n ...modResults,\n contents: init.contents,\n },\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;AACA,SAAAE,SAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,cAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,aAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIO,MAAMI,6BAAgE,GAAGA,CAACC,MAAM,EAAEC,KAAK,KAAK;EACjG,IAAI,CAACA,KAAK,EAAE;IACV,OAAOD,MAAM;EACf;EACA,OAAO,IAAAE,iCAAgB,EAACF,MAAM,EAAGA,MAAM,IAAK;IAC1C,MAAM;MAAEG;IAAW,CAAC,GAAGH,MAAM;IAC7B,MAAM;MAAEI;IAAS,CAAC,GAAGD,UAAU;IAE/B,MAAME,WAAW,GAAG,IAAAC,qBAAU,EAC5BH,UAAU,CAACI,QAAQ,CAACC,OAAO,CACzB,wCAAwC,EACxC,+BACF,CAAC,EACD,CAAC,+CAA+C,CAAC,EACjDJ,QAAQ,KAAK,MACf,CAAC;IAED,MAAMK,IAAI,GAAG,IAAAC,6BAAa,EAAC;MACzBC,GAAG,EAAEN,WAAW;MAChBO,OAAO,EAAE,QAAQ;MACjBC,GAAG,EAAE,mBAAmB;MACxBC,MAAM,EAAE,CAAC;MACTC,MAAM,EAAE,yBAAyB;MACjCC,MAAM,EAAE,kDAAkD,IAAIZ,QAAQ,KAAK,MAAM,GAAG,GAAG,GAAG,EAAE;IAC9F,CAAC,CAAC;IAEF,OAAO;MACL,GAAGJ,MAAM;MACTG,UAAU,EAAE;QACV,GAAGA,UAAU;QACbI,QAAQ,EAAEE,IAAI,CAACF;MACjB;IACF,CAAC;EACH,CAAC,CAAC;AACJ,CAAC;AAACU,OAAA,CAAAlB,6BAAA,GAAAA,6BAAA","ignoreList":[]}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { ConfigPlugin } from '@expo/config-plugins';
|
|
2
|
-
|
|
2
|
+
import { AndroidSplashConfig } from './getAndroidSplashConfig';
|
|
3
|
+
export declare const withAndroidSplashScreen: ConfigPlugin<AndroidSplashConfig | undefined | null | void>;
|
|
@@ -11,27 +11,6 @@ function _configPlugins() {
|
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
-
function _jsonFile() {
|
|
15
|
-
const data = _interopRequireDefault(require("@expo/json-file"));
|
|
16
|
-
_jsonFile = function () {
|
|
17
|
-
return data;
|
|
18
|
-
};
|
|
19
|
-
return data;
|
|
20
|
-
}
|
|
21
|
-
function _resolveFrom() {
|
|
22
|
-
const data = _interopRequireDefault(require("resolve-from"));
|
|
23
|
-
_resolveFrom = function () {
|
|
24
|
-
return data;
|
|
25
|
-
};
|
|
26
|
-
return data;
|
|
27
|
-
}
|
|
28
|
-
function _semver() {
|
|
29
|
-
const data = _interopRequireDefault(require("semver"));
|
|
30
|
-
_semver = function () {
|
|
31
|
-
return data;
|
|
32
|
-
};
|
|
33
|
-
return data;
|
|
34
|
-
}
|
|
35
14
|
function _getAndroidSplashConfig() {
|
|
36
15
|
const data = require("./getAndroidSplashConfig");
|
|
37
16
|
_getAndroidSplashConfig = function () {
|
|
@@ -53,9 +32,9 @@ function _withAndroidSplashImages() {
|
|
|
53
32
|
};
|
|
54
33
|
return data;
|
|
55
34
|
}
|
|
56
|
-
function
|
|
57
|
-
const data = require("./
|
|
58
|
-
|
|
35
|
+
function _withAndroidSplashMainActivity() {
|
|
36
|
+
const data = require("./withAndroidSplashMainActivity");
|
|
37
|
+
_withAndroidSplashMainActivity = function () {
|
|
59
38
|
return data;
|
|
60
39
|
};
|
|
61
40
|
return data;
|
|
@@ -74,9 +53,8 @@ function _withAndroidSplashStyles() {
|
|
|
74
53
|
};
|
|
75
54
|
return data;
|
|
76
55
|
}
|
|
77
|
-
|
|
78
|
-
const
|
|
79
|
-
const splashConfig = (0, _getAndroidSplashConfig().getAndroidSplashConfig)(config);
|
|
56
|
+
const withAndroidSplashScreen = (config, props) => {
|
|
57
|
+
const splashConfig = (0, _getAndroidSplashConfig().getAndroidSplashConfig)(config, props ?? null);
|
|
80
58
|
|
|
81
59
|
// Update the android status bar to match the splash screen
|
|
82
60
|
// androidStatusBar applies info to the app activity style.
|
|
@@ -89,20 +67,7 @@ const withAndroidSplashScreen = config => {
|
|
|
89
67
|
if (!config.androidStatusBar) config.androidStatusBar = {};
|
|
90
68
|
config.androidStatusBar.backgroundColor = backgroundColor;
|
|
91
69
|
}
|
|
92
|
-
return (0, _configPlugins().withPlugins)(config, [
|
|
70
|
+
return (0, _configPlugins().withPlugins)(config, [[_withAndroidSplashMainActivity().withAndroidSplashMainActivity, props], [_withAndroidSplashImages().withAndroidSplashImages, props], [_withAndroidSplashDrawables().withAndroidSplashDrawables, splashConfig], [_withAndroidSplashStyles().withAndroidSplashStyles, props], [_withAndroidSplashStrings().withAndroidSplashStrings, props]]);
|
|
93
71
|
};
|
|
94
72
|
exports.withAndroidSplashScreen = withAndroidSplashScreen;
|
|
95
|
-
function shouldUpdateLegacyMainActivity(config) {
|
|
96
|
-
try {
|
|
97
|
-
const projectRoot = config._internal?.projectRoot;
|
|
98
|
-
const packagePath = (0, _resolveFrom().default)(projectRoot, 'expo-splash-screen/package.json');
|
|
99
|
-
if (packagePath) {
|
|
100
|
-
const version = _jsonFile().default.read(packagePath).version?.toString() ?? '';
|
|
101
|
-
return _semver().default.lt(version, '0.12.0');
|
|
102
|
-
}
|
|
103
|
-
// If expo-splash-screen didn't be installed or included in template, we check the sdkVersion instead.
|
|
104
|
-
return !!(config.sdkVersion && _semver().default.lt(config.sdkVersion, '43.0.0'));
|
|
105
|
-
} catch {}
|
|
106
|
-
return false;
|
|
107
|
-
}
|
|
108
73
|
//# sourceMappingURL=withAndroidSplashScreen.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withAndroidSplashScreen.js","names":["_configPlugins","data","require","
|
|
1
|
+
{"version":3,"file":"withAndroidSplashScreen.js","names":["_configPlugins","data","require","_getAndroidSplashConfig","_withAndroidSplashDrawables","_withAndroidSplashImages","_withAndroidSplashMainActivity","_withAndroidSplashStrings","_withAndroidSplashStyles","withAndroidSplashScreen","config","props","splashConfig","getAndroidSplashConfig","backgroundColor","androidStatusBar","toLowerCase","WarningAggregator","addWarningAndroid","withPlugins","withAndroidSplashMainActivity","withAndroidSplashImages","withAndroidSplashDrawables","withAndroidSplashStyles","withAndroidSplashStrings","exports"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withAndroidSplashScreen.ts"],"sourcesContent":["import { ConfigPlugin, WarningAggregator, withPlugins } from '@expo/config-plugins';\n\nimport { AndroidSplashConfig, getAndroidSplashConfig } from './getAndroidSplashConfig';\nimport { withAndroidSplashDrawables } from './withAndroidSplashDrawables';\nimport { withAndroidSplashImages } from './withAndroidSplashImages';\nimport { withAndroidSplashMainActivity } from './withAndroidSplashMainActivity';\nimport { withAndroidSplashStrings } from './withAndroidSplashStrings';\nimport { withAndroidSplashStyles } from './withAndroidSplashStyles';\n\nexport const withAndroidSplashScreen: ConfigPlugin<\n AndroidSplashConfig | undefined | null | void\n> = (config, props) => {\n const splashConfig = getAndroidSplashConfig(config, props ?? null);\n\n // Update the android status bar to match the splash screen\n // androidStatusBar applies info to the app activity style.\n const backgroundColor = splashConfig?.backgroundColor || '#ffffff';\n if (config.androidStatusBar?.backgroundColor) {\n if (\n backgroundColor.toLowerCase() !== config.androidStatusBar?.backgroundColor?.toLowerCase?.()\n ) {\n WarningAggregator.addWarningAndroid(\n 'androidStatusBar.backgroundColor',\n 'Color conflicts with the splash.backgroundColor'\n );\n }\n } else {\n if (!config.androidStatusBar) config.androidStatusBar = {};\n config.androidStatusBar.backgroundColor = backgroundColor;\n }\n\n return withPlugins(config, [\n [withAndroidSplashMainActivity, props],\n [withAndroidSplashImages, props],\n [withAndroidSplashDrawables, splashConfig],\n [withAndroidSplashStyles, props],\n [withAndroidSplashStrings, props],\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,wBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,uBAAA,YAA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