1{"version":3,"file":"RequiresFullScreen.js","names":["withRequiresFullScreen","createInfoPlistPlugin","setRequiresFullScreen","getRequiresFullScreen","config","ios","hasOwnProperty","requireFullScreen","gteSdkVersion","iPadInterfaceKey","requiredIPadInterface","isStringArray","value","Array","isArray","every","hasMinimumOrientations","masks","mask","includes","resolveExistingIpadInterfaceOrientations","interfaceOrientations","length","existingList","join","addWarningIOS","infoPlist","requiresFullScreen","existing","Set","concat","UIRequiresFullScreen"],"sources":["../../src/ios/RequiresFullScreen.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { createInfoPlistPlugin } from '../plugins/ios-plugins';\nimport { gteSdkVersion } from '../utils/versions';\nimport { addWarningIOS } from '../utils/warnings';\nimport { InfoPlist } from './IosConfig.types';\n\nexport const withRequiresFullScreen = createInfoPlistPlugin(\n setRequiresFullScreen,\n 'withRequiresFullScreen'\n);\n\n// NOTES: This is defaulted to `true` for now to match the behavior prior to SDK\n// 34, but will change to `false` in SDK +43.\nexport function getRequiresFullScreen(config: Pick<ExpoConfig, 'ios' | 'sdkVersion'>) {\n // Yes, the property is called ios.requireFullScreen, without the s - not \"requires\"\n // This is confusing indeed because the actual property name does have the s\n if (config.ios?.hasOwnProperty('requireFullScreen')) {\n return !!config.ios.requireFullScreen;\n } else {\n // In SDK 43, the `requireFullScreen` default has been changed to false.\n if (\n gteSdkVersion(config, '43.0.0')\n // TODO: Uncomment after SDK 43 is released.\n // || !config.sdkVersion\n ) {\n return false;\n }\n return true;\n }\n}\n\nconst iPadInterfaceKey = 'UISupportedInterfaceOrientations~ipad';\n\nconst requiredIPadInterface = [\n 'UIInterfaceOrientationPortrait',\n 'UIInterfaceOrientationPortraitUpsideDown',\n 'UIInterfaceOrientationLandscapeLeft',\n 'UIInterfaceOrientationLandscapeRight',\n];\n\nfunction isStringArray(value: any): value is string[] {\n return Array.isArray(value) && value.every((value) => typeof value === 'string');\n}\n\nfunction hasMinimumOrientations(masks: string[]): boolean {\n return requiredIPadInterface.every((mask) => masks.includes(mask));\n}\n\n/**\n * Require full screen being disabled requires all ipad interfaces to to be added,\n * otherwise submissions to the iOS App Store will fail.\n *\n * ERROR ITMS-90474: \"Invalid Bundle. iPad Multitasking support requires these orientations: 'UIInterfaceOrientationPortrait,UIInterfaceOrientationPortraitUpsideDown,UIInterfaceOrientationLandscapeLeft,UIInterfaceOrientationLandscapeRight'. Found 'UIInterfaceOrientationPortrait,UIInterfaceOrientationPortraitUpsideDown' in bundle 'com.bacon.app'.\"\n *\n * @param interfaceOrientations\n * @returns\n */\nfunction resolveExistingIpadInterfaceOrientations(interfaceOrientations: any): string[] {\n if (\n // Ensure type.\n isStringArray(interfaceOrientations) &&\n // Don't warn if it's an empty array, this is invalid regardless.\n interfaceOrientations.length &&\n // Check if the minimum requirements are met.\n !hasMinimumOrientations(interfaceOrientations)\n ) {\n const existingList = interfaceOrientations!.join(', ');\n addWarningIOS(\n 'ios.requireFullScreen',\n `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}`\n );\n return interfaceOrientations;\n }\n return [];\n}\n\n// Whether requires full screen on iPad\nexport function setRequiresFullScreen(\n config: Pick<ExpoConfig, 'ios'>,\n infoPlist: InfoPlist\n): InfoPlist {\n const requiresFullScreen = getRequiresFullScreen(config);\n if (!requiresFullScreen) {\n const existing = resolveExistingIpadInterfaceOrientations(infoPlist[iPadInterfaceKey]);\n\n // There currently exists no mechanism to safely undo this feature besides `expo prebuild --clear`,\n // this seems ok though because anyone using `UISupportedInterfaceOrientations~ipad` probably\n // wants them to be defined to this value anyways. This is also the default value used in the Xcode iOS template.\n\n // Merge any previous interfaces with the required interfaces.\n infoPlist[iPadInterfaceKey] = [...new Set(existing.concat(requiredIPadInterface))];\n }\n\n return {\n ...infoPlist,\n UIRequiresFullScreen: requiresFullScreen,\n };\n}\n"],"mappings":";;;;;;;;;AAEA;EAAA;;EAAA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