Files
discord-decomp/sources/modules/screen/native/DimensionsStore.android.tsx
T
2026-07-27 16:20:00 +03:00

238 lines
10 KiB
TypeScript

/* Metro module 1479; source: modules/screen/native/DimensionsStore.android.tsx; dependencies: [27, 1480, 1850, 1585, 1851, 1598, 690, 629, 1586, 2] */
function _fun16944(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#16944, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1606:6, offset: 0x00e5f8d7, size: 269 bytes, params: 8, frame: 21
const env0_0 = require;
const _arrayLikeToArray_16947 = function(a0, a1) {
var r0;
var r1;
var r2;
var value3;
var length;
var value5;
var value = undefined;
var value2 = value == null;
reducibleJoin2: while (true) {
if (value2) {
r0 = value2;
break reducibleJoin2;
}
value3 = value > a0.length;
r0 = value3;
break reducibleJoin2;
}
reducibleJoin4: while (true) {
if (r0) {
length = a0.length;
r1 = length;
break reducibleJoin4;
}
r1 = value;
break reducibleJoin4;
}
value = (0, global.Array)(r1);
var value4 = 0;
if (value4 < r1) {
r2 = value4;
reducibleLoop5: while (true) {
value[r2] = a0[r2];
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
if (value5 < r1) {
r2 = value5;
continue reducibleLoop5;
}
break reducibleLoop5;
}
}
return value;
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const Dimensions = (require(27) /* metro dependency 27 */).Dimensions;
const subscribeToKeyboardUIStore = importDefault(1480) /* metro dependency 1480: subscribeToKeyboardUIStore */;
let value3 = (require(629) /* metro dependency 629 */).create(function() {
return getDimensionsStoreState(undefined);
});
(importDefault(1586) /* metro dependency 1586: SafeAreaStoreNative */).subscribe(function() {
updateDimensionsStoreState();
});
subscribeToKeyboardUIStore(function() {
updateDimensionsStoreState();
});
Dimensions.addEventListener('change', function() {
updateDimensionsStoreState();
});
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/screen/native/DimensionsStore.android.tsx');
exports.default = value3;
}
function _createForOfIteratorHelperLoose_16945(a0, a1) { // fn#16945, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1606:132, offset: 0x00e5f9e4, size: 370 bytes, params: 3, frame: 20
var r6;
var r9;
var r5;
var value3;
var regexp;
const env0_0 = a0;
const Symbol = global.Symbol;
let value = typeof Symbol !== 'undefined';
let r1 = value && a0[global.Symbol.iterator];
r1 = !r1 ? a0['@@iterator'] : r1;
if (r1) {
value = r1.call(a0);
return value.next.bind(value);
}
const Array = global.Array;
if (Array.isArray(a0)) {
if (r1) {
}
return _fun16946;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_16947(a0, value);
r5 = value;
} else {
value3 = ({}).toString.call(a0).slice(8, -1);
r6 = value3 === 'Object' && a0.constructor;
r9 = r6 ? a0.constructor.name : value3;
if (r9 === 'Map') {
r6 = global.Array.from(a0);
} else if (r9 === 'Set') {
r6 = global.Array.from(a0);
} else if (r9 === 'Arguments') {
value = _arrayLikeToArray_16947(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_16947(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun16946;
}
const TypeError = global.TypeError;
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
}
function computeWindowDimensions(a0, a1, {width, height}, {width, height}, a4) { // fn#16948, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1606:1042, offset: 0x00e5fb56, size: 250 bytes, params: 6, frame: 22
var r6;
var r10;
const value = a0;
const safeAreaInsets = (require(1585) /* metro dependency 1585: useSafeAreaInsetsNative */).getSafeAreaInsets(a4);
if (height !== width) {
r6 = height;
r10 = width;
} else {
r6 = width;
r10 = height;
}
let Math = global.Math;
const value6 = Math.min(width + safeAreaInsets.left + safeAreaInsets.right, r10);
Math = global.Math;
const value11 = Math.min(height + safeAreaInsets.top + safeAreaInsets.bottom - (a1 ? 0 : (require(1851) /* metro dependency 1851: useSystemKeyboardHeightNative */).getSystemKeyboardHeight({appEntryKey: a4})),
r6);
return value?.width !== value6 ? {width: value6,
height: value11} : value.height === value11 ? value : {width: value6, height: value11};
}
function getDimensionsStoreStateForEntry(a0, a1) { // fn#16949, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1606:1374, offset: 0x00e5fc50, size: 288 bytes, params: 3, frame: 24
const value = a1;
const object2 = {};
const get = Dimensions.get;
copyDataProperties(object2, Reflect.apply(get, Dimensions, ['window']), undefined);
const value3 = undefined;
const readAppEntryWindowMetricsAndroidModule = require(1850) /* metro dependency 1850: readAppEntryWindowMetricsAndroid */;
copyDataProperties(object2, readAppEntryWindowMetricsAndroidModule.readWindowSizeForAppEntry(a0), undefined);
const r9 = readAppEntryWindowMetricsAndroidModule.readScreenSizeForAppEntry(a0) ?? Dimensions.get('screen');
const fontScale = object2.fontScale;
const value6 = r9.width > r9.height;
const windowDimensions = value == null ? value3 : value.windowDimensions;
const windowDimensionsIgnoringKeyboard = value == null ? value3 : value.windowDimensionsIgnoringKeyboard;
const computeWindowDimensionsBinding = computeWindowDimensions;
const windowDimensions2 = computeWindowDimensionsBinding(windowDimensions, false, object2, r9, a0);
const windowDimensions3 = computeWindowDimensionsBinding(windowDimensionsIgnoringKeyboard, true, object2, r9, a0);
return (value == null ? value3 : value.windowDimensions) !== windowDimensions2 || value.windowDimensionsIgnoringKeyboard !== windowDimensions3 || value.fontScale !== fontScale ? {fontScale: fontScale,
screenIsLandscape: value6, windowDimensions: windowDimensions2,
windowDimensionsIgnoringKeyboard: windowDimensions3} : value.screenIsLandscape === value6 ? value : {fontScale: fontScale,
screenIsLandscape: value6, windowDimensions: windowDimensions2,
windowDimensionsIgnoringKeyboard: windowDimensions3};
}
function getDimensionsStoreState(a0) { // fn#16950, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1606:2072, offset: 0x00e5fd70, size: 172 bytes, params: 2, frame: 23
var r5;
var r6;
var r4;
var r3;
var value7;
var getDimensionsStoreStateForEntryBinding;
var byAppEntry;
var property;
var dimensionsStoreStateForEntryBinding;
var value9;
var value10;
const value = a0;
const object2 = {};
const value2 = value != null;
const _createForOfIteratorHelperLoose_16945Binding = _createForOfIteratorHelperLoose_16945;
const value4 = undefined;
const APP_ENTRY_KEYS = (require(1598) /* metro dependency 1598: AppEntryKey */).APP_ENTRY_KEYS;
const value5 = _createForOfIteratorHelperLoose_16945Binding(APP_ENTRY_KEYS);
const value6 = value5();
let done = value6.done;
if (done) {
r3 = value2;
} else {
r5 = value2;
r6 = value6;
while (true) {
value7 = r6.value;
getDimensionsStoreStateForEntryBinding = getDimensionsStoreStateForEntry;
r4 = value == null ? value4 : value.byAppEntry[value7];
dimensionsStoreStateForEntryBinding = getDimensionsStoreStateForEntryBinding(value7, r4);
object2[value7] = dimensionsStoreStateForEntryBinding;
if (value == null) {
r4 = value4;
continue;
}
byAppEntry = value.byAppEntry;
property = byAppEntry[value7];
r4 = property;
if (r4 === dimensionsStoreStateForEntryBinding) {
continue;
}
value9 = false;
r5 = value9;
value10 = value5();
done = value10.done;
if (done) {
r3 = r5;
break;
}
r6 = value10;
continue;
}
}
return r3 && value != null ? value : {byAppEntry: object2};
}
function updateDimensionsStoreState() { // fn#16951, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1606:2377, offset: 0x00e5fe1c, size: 45 bytes, params: 1, frame: 12
(require(690) /* metro dependency 690: ReactBatchUpdatesNative */).batchUpdates(_fun16952);
}
function _fun16952() { // fn#16952, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1606:2438, offset: 0x00e5fe49, size: 27 bytes, params: 1, frame: 11
return env1_3.setState(function(a0) {
return getDimensionsStoreState(a0);
});
}