1"use strict"; 2 3Object.defineProperty(exports, "__esModule", { 4 value: true 5}); 6exports.getAndroidDarkSplashConfig = getAndroidDarkSplashConfig; 7exports.getAndroidSplashConfig = getAndroidSplashConfig; 8const defaultResizeMode = 'contain'; 9 10function getAndroidSplashConfig(config) { 11 var _config$android; 12 13 // Respect the splash screen object, don't mix and match across different splash screen objects 14 // in case the user wants the top level splash to apply to every platform except android. 15 if ((_config$android = config.android) !== null && _config$android !== void 0 && _config$android.splash) { 16 var _config$android2, _ref, _splash$xxxhdpi, _ref2, _splash$xxhdpi, _ref3, _splash$xhdpi, _ref4, _splash$hdpi, _ref5, _splash$mdpi, _splash$backgroundCol, _splash$resizeMode; 17 18 const splash = (_config$android2 = config.android) === null || _config$android2 === void 0 ? void 0 : _config$android2.splash; 19 return { 20 xxxhdpi: (_ref = (_splash$xxxhdpi = splash.xxxhdpi) !== null && _splash$xxxhdpi !== void 0 ? _splash$xxxhdpi : splash.image) !== null && _ref !== void 0 ? _ref : null, 21 xxhdpi: (_ref2 = (_splash$xxhdpi = splash.xxhdpi) !== null && _splash$xxhdpi !== void 0 ? _splash$xxhdpi : splash.image) !== null && _ref2 !== void 0 ? _ref2 : null, 22 xhdpi: (_ref3 = (_splash$xhdpi = splash.xhdpi) !== null && _splash$xhdpi !== void 0 ? _splash$xhdpi : splash.image) !== null && _ref3 !== void 0 ? _ref3 : null, 23 hdpi: (_ref4 = (_splash$hdpi = splash.hdpi) !== null && _splash$hdpi !== void 0 ? _splash$hdpi : splash.image) !== null && _ref4 !== void 0 ? _ref4 : null, 24 mdpi: (_ref5 = (_splash$mdpi = splash.mdpi) !== null && _splash$mdpi !== void 0 ? _splash$mdpi : splash.image) !== null && _ref5 !== void 0 ? _ref5 : null, 25 backgroundColor: (_splash$backgroundCol = splash.backgroundColor) !== null && _splash$backgroundCol !== void 0 ? _splash$backgroundCol : null, 26 resizeMode: (_splash$resizeMode = splash.resizeMode) !== null && _splash$resizeMode !== void 0 ? _splash$resizeMode : defaultResizeMode 27 }; 28 } 29 30 if (config.splash) { 31 var _splash$image, _splash$image2, _splash$image3, _splash$image4, _splash$image5, _splash$backgroundCol2, _splash$resizeMode2; 32 33 const splash = config.splash; 34 return { 35 xxxhdpi: (_splash$image = splash.image) !== null && _splash$image !== void 0 ? _splash$image : null, 36 xxhdpi: (_splash$image2 = splash.image) !== null && _splash$image2 !== void 0 ? _splash$image2 : null, 37 xhdpi: (_splash$image3 = splash.image) !== null && _splash$image3 !== void 0 ? _splash$image3 : null, 38 hdpi: (_splash$image4 = splash.image) !== null && _splash$image4 !== void 0 ? _splash$image4 : null, 39 mdpi: (_splash$image5 = splash.image) !== null && _splash$image5 !== void 0 ? _splash$image5 : null, 40 backgroundColor: (_splash$backgroundCol2 = splash.backgroundColor) !== null && _splash$backgroundCol2 !== void 0 ? _splash$backgroundCol2 : null, 41 resizeMode: (_splash$resizeMode2 = splash.resizeMode) !== null && _splash$resizeMode2 !== void 0 ? _splash$resizeMode2 : defaultResizeMode 42 }; 43 } 44 45 return null; 46} // TODO: dark isn't supported in the Expo config spec yet. 47 48 49function getAndroidDarkSplashConfig(config) { 50 var _config$android3, _config$android3$spla; 51 52 // Respect the splash screen object, don't mix and match across different splash screen objects 53 // in case the user wants the top level splash to apply to every platform except android. 54 if ((_config$android3 = config.android) !== null && _config$android3 !== void 0 && (_config$android3$spla = _config$android3.splash) !== null && _config$android3$spla !== void 0 && _config$android3$spla.dark) { 55 var _config$android4, _config$android4$spla, _ref6, _splash$xxxhdpi2, _ref7, _splash$xxhdpi2, _ref8, _splash$xhdpi2, _ref9, _splash$hdpi2, _ref10, _splash$mdpi2, _splash$backgroundCol3, _lightTheme$resizeMod; 56 57 const splash = (_config$android4 = config.android) === null || _config$android4 === void 0 ? void 0 : (_config$android4$spla = _config$android4.splash) === null || _config$android4$spla === void 0 ? void 0 : _config$android4$spla.dark; 58 const lightTheme = getAndroidSplashConfig(config); 59 return { 60 xxxhdpi: (_ref6 = (_splash$xxxhdpi2 = splash.xxxhdpi) !== null && _splash$xxxhdpi2 !== void 0 ? _splash$xxxhdpi2 : splash.image) !== null && _ref6 !== void 0 ? _ref6 : null, 61 xxhdpi: (_ref7 = (_splash$xxhdpi2 = splash.xxhdpi) !== null && _splash$xxhdpi2 !== void 0 ? _splash$xxhdpi2 : splash.image) !== null && _ref7 !== void 0 ? _ref7 : null, 62 xhdpi: (_ref8 = (_splash$xhdpi2 = splash.xhdpi) !== null && _splash$xhdpi2 !== void 0 ? _splash$xhdpi2 : splash.image) !== null && _ref8 !== void 0 ? _ref8 : null, 63 hdpi: (_ref9 = (_splash$hdpi2 = splash.hdpi) !== null && _splash$hdpi2 !== void 0 ? _splash$hdpi2 : splash.image) !== null && _ref9 !== void 0 ? _ref9 : null, 64 mdpi: (_ref10 = (_splash$mdpi2 = splash.mdpi) !== null && _splash$mdpi2 !== void 0 ? _splash$mdpi2 : splash.image) !== null && _ref10 !== void 0 ? _ref10 : null, 65 backgroundColor: (_splash$backgroundCol3 = splash.backgroundColor) !== null && _splash$backgroundCol3 !== void 0 ? _splash$backgroundCol3 : null, 66 // Can't support dark resizeMode because the resize mode is hardcoded into the MainActivity.java 67 resizeMode: (_lightTheme$resizeMod = lightTheme === null || lightTheme === void 0 ? void 0 : lightTheme.resizeMode) !== null && _lightTheme$resizeMod !== void 0 ? _lightTheme$resizeMod : defaultResizeMode 68 }; 69 } 70 71 return null; 72} 73//# sourceMappingURL=getAndroidSplashConfig.js.map