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