300 lines
17 KiB
TypeScript
300 lines
17 KiB
TypeScript
/* Metro module 7717; source: modules/device/native/DeviceOrientation.tsx; dependencies: [31, 27, 629, 477, 690, 4092, 7718, 2] */
|
|
import Module07718 from '../../../by-id/module-07718.js'; /* Metro dependency 7718 */
|
|
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ReactNativeModule from '../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
|
|
import * as ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
|
|
import * as PlatformUtilsModule from '../../../utils/PlatformUtils.tsx'; /* Metro dependency 477 */
|
|
import * as Module00629Module from '../../../by-id/module-00629.js'; /* Metro dependency 629 */
|
|
|
|
function _fun61716(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#61716, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7895:6, offset: 0x01b49394, size: 470 bytes, params: 8, frame: 27
|
|
const env0_0 = require;
|
|
const handleOrientationChange2 = handleOrientationChange;
|
|
const consumeUnlockAfterRotationToLockRequest = function() {
|
|
unlockOrientation({unlockAfterRotatingToPreviousLock: false});
|
|
env0_8 = false;
|
|
};
|
|
const unlockOrientation2 = unlockOrientation;
|
|
const lockOrientation2 = lockOrientation;
|
|
const closure4 = function(a0) {
|
|
if (!(require(dependencyMap[3]).isAndroid() || require(dependencyMap[5]).isIpadOS() && a0 == null)) {
|
|
lockOrientation(a0);
|
|
}
|
|
};
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const AppState = (ReactNativeModule).AppState;
|
|
object = {PORTRAIT: 0};
|
|
object[0] = 'PORTRAIT';
|
|
object.LANDSCAPE = 1;
|
|
object[1] = 'LANDSCAPE';
|
|
const env0_5 = ['PORTRAIT', 'PORTRAITUPSIDEDOWN'];
|
|
let value = Module00629Module;
|
|
value = value.create(_fun61728);
|
|
(Module07718).addOrientationDegreesChangeListener(handleOrientationDegreesChange);
|
|
(Module07718).addOrientationListener(handleOrientationChange2);
|
|
const getInitialOrientation = Module07718.getInitialOrientation;
|
|
handleOrientationChange2(Reflect.apply(getInitialOrientation, Module07718, []));
|
|
AppState.addEventListener('change', applyLockStateOnAppActive);
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/device/native/DeviceOrientation.tsx');
|
|
exports.OrientationType = object;
|
|
exports.useStore = value;
|
|
exports.handleOrientationChange = handleOrientationChange2;
|
|
exports.unlockOrientation = unlockOrientation2;
|
|
exports.lockOrientation = lockOrientation2;
|
|
exports.lockOrientationForiOS = closure4;
|
|
exports.toggleOrientation = toggleOrientation;
|
|
exports.getOrientation = getOrientation;
|
|
exports.getOrientationLock = getOrientationLock;
|
|
exports.useOrientation = useOrientation;
|
|
exports.useOrientationListener = useOrientationListener;
|
|
exports.restoreDefaultOrientation = restoreDefaultOrientation;
|
|
function handleOrientationChange(a0) { // fn#61717, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7895:329, offset: 0x01b4956a, size: 276 bytes, params: 2, frame: 17
|
|
var r3;
|
|
var binding;
|
|
var orientationLock;
|
|
if (PlatformUtilsModule.isIOS()) {
|
|
handleDeviceOrientationChange(a0);
|
|
}
|
|
if (env0_7 !== a0) {
|
|
env0_7 = a0;
|
|
binding = env0_6;
|
|
orientationLock = binding.getState().orientationLock;
|
|
r3 = orientationLock != null && env0_5.includes(orientationLock);
|
|
if (env0_7 !== 'LANDSCAPE') {
|
|
r3 = env0_7 === 'PORTRAIT' || (require(4092) /* metro dependency 4092: DeviceUtils */).isIpadOS() && env0_7 === 'PORTRAITUPSIDEDOWN';
|
|
r3 = r3 && orientationLock !== 'LANDSCAPE';
|
|
if (r3) {
|
|
(require(690) /* metro dependency 690: ReactBatchUpdatesNative */).batchUpdates(_fun61718);
|
|
}
|
|
} else if (r3) {
|
|
r3 = env0_7 === 'PORTRAIT' || (require(4092) /* metro dependency 4092: DeviceUtils */).isIpadOS() && env0_7 === 'PORTRAITUPSIDEDOWN';
|
|
r3 = r3 && orientationLock !== 'LANDSCAPE';
|
|
if (r3) {
|
|
(require(690) /* metro dependency 690: ReactBatchUpdatesNative */).batchUpdates(_fun61718);
|
|
}
|
|
} else {
|
|
(require(690) /* metro dependency 690: ReactBatchUpdatesNative */).batchUpdates(_fun61719);
|
|
}
|
|
}
|
|
function _fun61718() { // fn#61718, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7895:611, offset: 0x01b4967e, size: 37 bytes, params: 1, frame: 12
|
|
const binding = env1_6;
|
|
const setState = binding.setState;
|
|
const PORTRAIT = env1_4.PORTRAIT;
|
|
return Reflect.apply(setState, binding, [{orientation: PORTRAIT}]);
|
|
}
|
|
|
|
function _fun61719() { // fn#61719, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7895:676, offset: 0x01b496a3, size: 37 bytes, params: 1, frame: 12
|
|
const binding = env1_6;
|
|
const setState = binding.setState;
|
|
const LANDSCAPE = env1_4.LANDSCAPE;
|
|
return Reflect.apply(setState, binding, [{orientation: LANDSCAPE}]);
|
|
}
|
|
|
|
}
|
|
|
|
function handleDeviceOrientationChange(a0) { // fn#61720, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7895:721, offset: 0x01b496c8, size: 83 bytes, params: 2, frame: 12
|
|
const binding = env0_6;
|
|
const getState = binding.getState;
|
|
const orientationLock = Reflect.apply(getState, binding, []).orientationLock;
|
|
if (env0_8) {
|
|
if (a0 === 'LANDSCAPE') {
|
|
if (orientationLock === 'LANDSCAPE') {
|
|
consumeUnlockAfterRotationToLockRequest();
|
|
}
|
|
} else if (a0 === 'PORTRAIT') {
|
|
if (orientationLock === 'PORTRAIT') {
|
|
consumeUnlockAfterRotationToLockRequest();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function unlockOrientation({unlockAfterRotatingToPreviousLock}) { // fn#61722, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7895:1082, offset: 0x01b49738, size: 239 bytes, params: 2, frame: 16
|
|
var moduleValue2;
|
|
const binding = env0_6;
|
|
const getState = binding.getState;
|
|
const orientationLock = Reflect.apply(getState, binding, []).orientationLock;
|
|
if (PlatformUtilsModule.isAndroid()) {
|
|
if (unlockAfterRotatingToPreviousLock) {
|
|
if (orientationLock == null) {
|
|
(importDefault(7718) /* metro dependency 7718 */).ignoreAutoRotate(false);
|
|
(importDefault(7718) /* metro dependency 7718 */).unlockAllOrientations();
|
|
(require(690) /* metro dependency 690: ReactBatchUpdatesNative */).batchUpdates(_fun61723);
|
|
}
|
|
} else {
|
|
(importDefault(7718) /* metro dependency 7718 */).ignoreAutoRotate(false);
|
|
(importDefault(7718) /* metro dependency 7718 */).unlockAllOrientations();
|
|
(require(690) /* metro dependency 690: ReactBatchUpdatesNative */).batchUpdates(_fun61723);
|
|
}
|
|
} else {
|
|
moduleValue2 = PlatformUtilsModule;
|
|
if (moduleValue2.isIOS()) {
|
|
if ((require(4092) /* metro dependency 4092: DeviceUtils */).getSystemVersionMajor() >= 16) {
|
|
if (unlockAfterRotatingToPreviousLock) {
|
|
if (orientationLock == null) {
|
|
(importDefault(7718) /* metro dependency 7718 */).ignoreAutoRotate(false);
|
|
(importDefault(7718) /* metro dependency 7718 */).unlockAllOrientations();
|
|
(require(690) /* metro dependency 690: ReactBatchUpdatesNative */).batchUpdates(_fun61723);
|
|
}
|
|
} else {
|
|
(importDefault(7718) /* metro dependency 7718 */).ignoreAutoRotate(false);
|
|
(importDefault(7718) /* metro dependency 7718 */).unlockAllOrientations();
|
|
(require(690) /* metro dependency 690: ReactBatchUpdatesNative */).batchUpdates(_fun61723);
|
|
}
|
|
} else {
|
|
(importDefault(7718) /* metro dependency 7718 */).ignoreAutoRotate(false);
|
|
(importDefault(7718) /* metro dependency 7718 */).unlockAllOrientations();
|
|
(require(690) /* metro dependency 690: ReactBatchUpdatesNative */).batchUpdates(_fun61723);
|
|
}
|
|
} else {
|
|
(importDefault(7718) /* metro dependency 7718 */).ignoreAutoRotate(false);
|
|
(importDefault(7718) /* metro dependency 7718 */).unlockAllOrientations();
|
|
(require(690) /* metro dependency 690: ReactBatchUpdatesNative */).batchUpdates(_fun61723);
|
|
}
|
|
}
|
|
function _fun61723() { // fn#61723, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7895:1360, offset: 0x01b49827, size: 31 bytes, params: 1, frame: 12
|
|
env1_6.setState({orientationLock: null});
|
|
}
|
|
|
|
}
|
|
|
|
function lockOrientation(a0, a1) { // fn#61724, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7895:1404, offset: 0x01b49846, size: 192 bytes, params: 3, frame: 17
|
|
let value = a1;
|
|
const defaultImport = importDefault(7718) /* metro dependency 7718 */;
|
|
defaultImport.ignoreAutoRotate(value != null && value);
|
|
if (a0 === 'LANDSCAPE') {
|
|
value = defaultImport;
|
|
value.lockToLandscapeLeft();
|
|
value = require(690) /* metro dependency 690: ReactBatchUpdatesNative */;
|
|
value.batchUpdates(_fun61725);
|
|
} else {
|
|
value = importDefault(7718) /* metro dependency 7718 */;
|
|
value.lockToPortrait();
|
|
value = require(690) /* metro dependency 690: ReactBatchUpdatesNative */;
|
|
value.batchUpdates(_fun61726);
|
|
}
|
|
function _fun61725() { // fn#61725, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7895:1547, offset: 0x01b49906, size: 33 bytes, params: 1, frame: 12
|
|
env1_6.setState({orientationLock: 'LANDSCAPE'});
|
|
}
|
|
|
|
function _fun61726() { // fn#61726, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7895:1649, offset: 0x01b49927, size: 33 bytes, params: 1, frame: 12
|
|
env1_6.setState({orientationLock: 'PORTRAIT'});
|
|
}
|
|
|
|
}
|
|
|
|
function _fun61728() { // fn#61728, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7895:263, offset: 0x01b499a9, size: 29 bytes, params: 1, frame: 2
|
|
const PORTRAIT = env0_4.PORTRAIT;
|
|
return {orientation: PORTRAIT, orientationLock: null};
|
|
}
|
|
|
|
function handleOrientationDegreesChange(a0) { // fn#61729, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7895:1846, offset: 0x01b499c6, size: 198 bytes, params: 2, frame: 14
|
|
let r1 = a0 >= 0 && a0 <= 5;
|
|
r1 = !r1 ? a0 >= 355 : r1;
|
|
value = 'PORTRAIT';
|
|
const r0 = r1 === true ? value : (a0 >= 85 && a0 <= 95) === true ? 'LANDSCAPE-RIGHT' : (a0 >= 175 && a0 <= 185) === true ? 'PORTRAITUPSIDEDOWN' : (a0 >= 265 && a0 <= 275) === true ? 'LANDSCAPE-LEFT' : 'UNKNOWN';
|
|
if (r0 === 'LANDSCAPE-LEFT') {
|
|
handleDeviceOrientationChange('LANDSCAPE');
|
|
} else if (r0 === 'LANDSCAPE-RIGHT') {
|
|
handleDeviceOrientationChange('LANDSCAPE');
|
|
} else if (value === r0) {
|
|
handleDeviceOrientationChange(value);
|
|
}
|
|
}
|
|
|
|
function applyLockStateOnAppActive(a0) { // fn#61730, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7895:2422, offset: 0x01b49a8c, size: 64 bytes, params: 2, frame: 13
|
|
const binding = env0_6;
|
|
const getState = binding.getState;
|
|
const orientationLock = Reflect.apply(getState, binding, []).orientationLock;
|
|
if (a0 === 'active' && orientationLock != null) {
|
|
lockOrientation(orientationLock, true);
|
|
}
|
|
}
|
|
|
|
function toggleOrientation() { // fn#61731, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7895:2841, offset: 0x01b49acc, size: 274 bytes, params: 1, frame: 16
|
|
const {orientation, orientationLock} = env0_6.getState();
|
|
const r3 = orientationLock != null && env0_5.includes(orientationLock);
|
|
const LANDSCAPE = env0_4.LANDSCAPE;
|
|
if (orientation !== LANDSCAPE) {
|
|
if (!(orientation !== env0_4.PORTRAIT || r3)) {
|
|
(importDefault(7718) /* metro dependency 7718 */).lockToLandscapeLeft();
|
|
(importDefault(7718) /* metro dependency 7718 */).unlockAllOrientations();
|
|
(require(690) /* metro dependency 690: ReactBatchUpdatesNative */).batchUpdates(_fun61733);
|
|
}
|
|
} else if (orientationLock !== 'LANDSCAPE') {
|
|
(importDefault(7718) /* metro dependency 7718 */).lockToPortrait();
|
|
(importDefault(7718) /* metro dependency 7718 */).unlockAllOrientations();
|
|
(require(690) /* metro dependency 690: ReactBatchUpdatesNative */).batchUpdates(_fun61732);
|
|
} else if (!(orientation !== env0_4.PORTRAIT || r3)) {
|
|
(importDefault(7718) /* metro dependency 7718 */).lockToLandscapeLeft();
|
|
(importDefault(7718) /* metro dependency 7718 */).unlockAllOrientations();
|
|
(require(690) /* metro dependency 690: ReactBatchUpdatesNative */).batchUpdates(_fun61733);
|
|
}
|
|
function _fun61732() { // fn#61732, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7895:3039, offset: 0x01b4967e, size: 37 bytes, params: 1, frame: 12
|
|
const binding = env1_6;
|
|
const setState = binding.setState;
|
|
const PORTRAIT = env1_4.PORTRAIT;
|
|
return Reflect.apply(setState, binding, [{orientation: PORTRAIT}]);
|
|
}
|
|
|
|
function _fun61733() { // fn#61733, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7895:3187, offset: 0x01b496a3, size: 37 bytes, params: 1, frame: 12
|
|
const binding = env1_6;
|
|
const setState = binding.setState;
|
|
const LANDSCAPE = env1_4.LANDSCAPE;
|
|
return Reflect.apply(setState, binding, [{orientation: LANDSCAPE}]);
|
|
}
|
|
|
|
}
|
|
|
|
function getOrientation() { // fn#61734, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7895:3250, offset: 0x01b49bde, size: 25 bytes, params: 1, frame: 9
|
|
const binding = env0_6;
|
|
const getState = binding.getState;
|
|
return Reflect.apply(getState, binding, []).orientation;
|
|
}
|
|
|
|
function getOrientationLock() { // fn#61735, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7895:3330, offset: 0x01b49bf7, size: 25 bytes, params: 1, frame: 9
|
|
const binding = env0_6;
|
|
const getState = binding.getState;
|
|
return Reflect.apply(getState, binding, []).orientationLock;
|
|
}
|
|
|
|
function useOrientation() { // fn#61736, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7895:3414, offset: 0x01b49c10, size: 21 bytes, params: 1, frame: 9
|
|
return env0_6().orientation;
|
|
}
|
|
|
|
function useOrientationListener(a0) { // fn#61737, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7895:3489, offset: 0x01b49c25, size: 44 bytes, params: 2, frame: 14
|
|
const env0_0 = a0;
|
|
ReactModule.useEffect(_fun61738, [a0]);
|
|
function _fun61738() { // fn#61738, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7895:3537, offset: 0x01b49c51, size: 27 bytes, params: 1, frame: 11
|
|
return env1_6.subscribe(env0_0);
|
|
}
|
|
|
|
}
|
|
|
|
function restoreDefaultOrientation() { // fn#61739, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7895:3591, offset: 0x01b49c6c, size: 129 bytes, params: 1, frame: 13
|
|
var moduleValue2;
|
|
var binding;
|
|
if (PlatformUtilsModule.isIOS()) {
|
|
moduleValue2 = require(4092) /* metro dependency 4092: DeviceUtils */;
|
|
if (moduleValue2.isIpadOS()) {
|
|
unlockOrientation({unlockAfterRotatingToPreviousLock: false});
|
|
lockOrientationForiOS();
|
|
return undefined;
|
|
}
|
|
binding = env0_6;
|
|
if (binding.getState().orientationLock !== 'PORTRAIT') {
|
|
unlockOrientation({unlockAfterRotatingToPreviousLock: false});
|
|
lockOrientationForiOS();
|
|
return undefined;
|
|
}
|
|
} else {
|
|
unlockOrientation({unlockAfterRotatingToPreviousLock: false});
|
|
lockOrientationForiOS();
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun61716, 7717, [31, 27, 629, 477, 690, 4092, 7718,
|
|
2]) /* metro module 7717, dependencies: [31, 27, 629, 477, 690, 4092, 7718, 2] */;
|