1"use strict"; 2 3Object.defineProperty(exports, "__esModule", { 4 value: true 5}); 6exports.getRequiresFullScreen = getRequiresFullScreen; 7exports.setRequiresFullScreen = setRequiresFullScreen; 8exports.withRequiresFullScreen = void 0; 9function _iosPlugins() { 10 const data = require("../plugins/ios-plugins"); 11 _iosPlugins = function () { 12 return data; 13 }; 14 return data; 15} 16function _versions() { 17 const data = require("../utils/versions"); 18 _versions = function () { 19 return data; 20 }; 21 return data; 22} 23function _warnings() { 24 const data = require("../utils/warnings"); 25 _warnings = function () { 26 return data; 27 }; 28 return data; 29} 30const withRequiresFullScreen = (0, _iosPlugins().createInfoPlistPlugin)(setRequiresFullScreen, 'withRequiresFullScreen'); 31 32// NOTES: This is defaulted to `true` for now to match the behavior prior to SDK 33// 34, but will change to `false` in SDK +43. 34exports.withRequiresFullScreen = withRequiresFullScreen; 35function getRequiresFullScreen(config) { 36 var _config$ios; 37 // Yes, the property is called ios.requireFullScreen, without the s - not "requires" 38 // This is confusing indeed because the actual property name does have the s 39 if ((_config$ios = config.ios) !== null && _config$ios !== void 0 && _config$ios.hasOwnProperty('requireFullScreen')) { 40 return !!config.ios.requireFullScreen; 41 } else { 42 // In SDK 43, the `requireFullScreen` default has been changed to false. 43 if ((0, _versions().gteSdkVersion)(config, '43.0.0') 44 // TODO: Uncomment after SDK 43 is released. 45 // || !config.sdkVersion 46 ) { 47 return false; 48 } 49 return true; 50 } 51} 52const iPadInterfaceKey = 'UISupportedInterfaceOrientations~ipad'; 53const requiredIPadInterface = ['UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight']; 54function isStringArray(value) { 55 return Array.isArray(value) && value.every(value => typeof value === 'string'); 56} 57function hasMinimumOrientations(masks) { 58 return requiredIPadInterface.every(mask => masks.includes(mask)); 59} 60 61/** 62 * Require full screen being disabled requires all ipad interfaces to to be added, 63 * otherwise submissions to the iOS App Store will fail. 64 * 65 * ERROR ITMS-90474: "Invalid Bundle. iPad Multitasking support requires these orientations: 'UIInterfaceOrientationPortrait,UIInterfaceOrientationPortraitUpsideDown,UIInterfaceOrientationLandscapeLeft,UIInterfaceOrientationLandscapeRight'. Found 'UIInterfaceOrientationPortrait,UIInterfaceOrientationPortraitUpsideDown' in bundle 'com.bacon.app'." 66 * 67 * @param interfaceOrientations 68 * @returns 69 */ 70function resolveExistingIpadInterfaceOrientations(interfaceOrientations) { 71 if ( 72 // Ensure type. 73 isStringArray(interfaceOrientations) && 74 // Don't warn if it's an empty array, this is invalid regardless. 75 interfaceOrientations.length && 76 // Check if the minimum requirements are met. 77 !hasMinimumOrientations(interfaceOrientations)) { 78 const existingList = interfaceOrientations.join(', '); 79 (0, _warnings().addWarningIOS)('ios.requireFullScreen', `iPad multitasking requires all \`${iPadInterfaceKey}\` orientations to be defined in the Info.plist. The Info.plist currently defines values that are incompatible with multitasking, these will be overwritten to prevent submission failure. Existing: ${existingList}`); 80 return interfaceOrientations; 81 } 82 return []; 83} 84 85// Whether requires full screen on iPad 86function setRequiresFullScreen(config, infoPlist) { 87 const requiresFullScreen = getRequiresFullScreen(config); 88 if (!requiresFullScreen) { 89 const existing = resolveExistingIpadInterfaceOrientations(infoPlist[iPadInterfaceKey]); 90 91 // There currently exists no mechanism to safely undo this feature besides `npx expo prebuild --clear`, 92 // this seems ok though because anyone using `UISupportedInterfaceOrientations~ipad` probably 93 // wants them to be defined to this value anyways. This is also the default value used in the Xcode iOS template. 94 95 // Merge any previous interfaces with the required interfaces. 96 infoPlist[iPadInterfaceKey] = [...new Set(existing.concat(requiredIPadInterface))]; 97 } 98 return { 99 ...infoPlist, 100 UIRequiresFullScreen: requiresFullScreen 101 }; 102} 103//# sourceMappingURL=RequiresFullScreen.js.map