function handleOrientationSettings()

in lib/prepare.js [246:282]


function handleOrientationSettings (platformConfig, project) {
    function setProp (name, value) {
        if (value) {
            project.xcode.updateBuildProperty(`INFOPLIST_KEY_${name}`, `"${value}"`, null, 'App');
        } else {
            project.xcode.updateBuildProperty(`INFOPLIST_KEY_${name}`, null, null, 'App');
        }
    }

    const kPort = 'UIInterfaceOrientationPortrait';
    const kPortU = 'UIInterfaceOrientationPortraitUpsideDown';
    const kLandL = 'UIInterfaceOrientationLandscapeLeft';
    const kLandR = 'UIInterfaceOrientationLandscapeRight';

    switch (getOrientationValue(platformConfig)) {
    case 'portrait':
        setProp('UIInterfaceOrientation', kPort);
        setProp('UISupportedInterfaceOrientations_iPhone', [kPort, kPortU].join(' '));
        setProp('UISupportedInterfaceOrientations_iPad', [kPort, kPortU].join(' '));
        break;
    case 'landscape':
        setProp('UIInterfaceOrientation', kLandL);
        setProp('UISupportedInterfaceOrientations_iPhone', [kLandL, kLandR].join(' '));
        setProp('UISupportedInterfaceOrientations_iPad', [kLandL, kLandR].join(' '));
        break;
    case 'all':
        // TODO: Should we default to portrait in this case or set it to null?
        setProp('UIInterfaceOrientation', kPort);
        setProp('UISupportedInterfaceOrientations_iPhone', [kPort, kPortU, kLandL, kLandR].join(' '));
        setProp('UISupportedInterfaceOrientations_iPad', [kPort, kPortU, kLandL, kLandR].join(' '));
        break;
    case 'default':
        setProp('UIInterfaceOrientation', null);
        setProp('UISupportedInterfaceOrientations_iPhone', [kPort, kLandL, kLandR].join(' '));
        setProp('UISupportedInterfaceOrientations_iPad', [kPort, kPortU, kLandL, kLandR].join(' '));
    }
}