This repository has been archived on 2022-03-12. You can view files and clone it, but cannot push or open issues or pull requests.

34 lines
1.3 KiB
JavaScript
Raw Permalink Normal View History

2021-04-02 02:24:13 +03:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const ios_plugins_1 = require("../plugins/ios-plugins");
exports.withOrientation = ios_plugins_1.createInfoPlistPlugin(setOrientation, 'withOrientation');
function getOrientation(config) {
var _a;
return (_a = config.orientation) !== null && _a !== void 0 ? _a : null;
}
exports.getOrientation = getOrientation;
exports.PORTRAIT_ORIENTATIONS = [
'UIInterfaceOrientationPortrait',
'UIInterfaceOrientationPortraitUpsideDown',
];
exports.LANDSCAPE_ORIENTATIONS = [
'UIInterfaceOrientationLandscapeLeft',
'UIInterfaceOrientationLandscapeRight',
];
function getUISupportedInterfaceOrientations(orientation) {
if (orientation === 'portrait') {
return exports.PORTRAIT_ORIENTATIONS;
}
else if (orientation === 'landscape') {
return exports.LANDSCAPE_ORIENTATIONS;
}
else {
return [...exports.PORTRAIT_ORIENTATIONS, ...exports.LANDSCAPE_ORIENTATIONS];
}
}
function setOrientation(config, infoPlist) {
const orientation = getOrientation(config);
return Object.assign(Object.assign({}, infoPlist), { UISupportedInterfaceOrientations: getUISupportedInterfaceOrientations(orientation) });
}
exports.setOrientation = setOrientation;
//# sourceMappingURL=Orientation.js.map