Files
discord-decomp/sources/modules/launchpad/native/useLaunchPadState.native.tsx
T
2026-07-28 01:06:53 +03:00

167 lines
14 KiB
TypeScript

/* Metro module 15314; source: modules/launchpad/native/useLaunchPadState.native.tsx; dependencies: [31, 11324, 15315, 4017, 14283, 11281, 11282, 2] */
import UpdateSharedValueIfChangedNative from '../../reanimated/utils/updateSharedValueIfChanged.native.tsx'; /* Metro dependency 11282 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as ReanimatedRexportModule from '../../reanimated/ReanimatedRexport.tsx'; /* Metro dependency 4017 */
import * as UseSafeAreaInsetsSharedValueNativeModule from '../../safe_area/useSafeAreaInsetsSharedValue.native.tsx'; /* Metro dependency 11281 */
import * as LaunchPadConstantsModule from './LaunchPadConstants.tsx'; /* Metro dependency 11324 */
import * as UseWindowDimensionsSharedValueNativeModule from '../../screen/useWindowDimensionsSharedValue.native.tsx'; /* Metro dependency 14283 */
import * as LaunchPadPullTabCacheModule from './LaunchPadPullTabCache.tsx'; /* Metro dependency 15315 */
function _fun117064(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#117064, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15511:6, offset: 0x024a2250, size: 345 bytes, params: 8, frame: 18
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_6 = {'active': false, 'initialLaunchPadPosition': 0, 'initialPullTabPosition': 0, 'initialTouchX': 0,
'initialTouchY': 0, 'positionOffsetX': 0, 'positionOffsetY': 0, 'startTime': -1, 'requiresPop': false,
'startShown': false};
({'position': null, 'scale': 1, 'offset': 0,
'minimized': false}).position = (require(15315) /* metro dependency 15315: LaunchPadPullTabCache */).getLaunchPadPullTabPositionCached();
object = {code: 'function useLaunchPadStateNativeTsx1(shown){const{launchPadShown}=this.__closure;launchPadShown.set(shown);}'};
object = {code: 'function useLaunchPadStateNativeTsx2(value){const{launchPadSharedState}=this.__closure;launchPadSharedState.set(Math.max(Math.min(value,1),0));}'};
object = {code: 'function useLaunchPadStateNativeTsx3(positionY){const{getWindowDimensionsWorklet,launchPadPullTabState,LAUNCH_PAD_PULL_TAB_MAX_POSITION,getSafeAreaInsetsWorklet,LAUNCH_PAD_PULL_TAB_SCALE_OFFSET,updateSharedValueIfChanged,runOnJS,persistLaunchPadPullTabPosition}=this.__closure;const positionYMax=getWindowDimensionsWorklet().height-launchPadPullTabState.get().offset-LAUNCH_PAD_PULL_TAB_MAX_POSITION;const positionYMin=getSafeAreaInsetsWorklet().top+LAUNCH_PAD_PULL_TAB_SCALE_OFFSET;const position=Math.max(Math.min(positionY,positionYMax),positionYMin);updateSharedValueIfChanged(launchPadPullTabState,{position:position});runOnJS(persistLaunchPadPullTabPosition)(position);}'};
object = {code: 'function useLaunchPadStateNativeTsx4(translationY){const{gestureState,setLaunchPadPullTabBoundedPosition}=this.__closure;const positionY=gestureState.get().initialPullTabPosition+translationY;setLaunchPadPullTabBoundedPosition(positionY);}'};
object = {code: 'function useLaunchPadStateNativeTsx5(position,offset){const{updateSharedValueIfChanged,launchPadPullTabState}=this.__closure;updateSharedValueIfChanged(launchPadPullTabState,{position:position,offset:offset});}'};
object = {code: 'function useLaunchPadStateNativeTsx6(scale){const{updateSharedValueIfChanged,launchPadPullTabState}=this.__closure;updateSharedValueIfChanged(launchPadPullTabState,{scale:scale});}'};
object = {code: 'function useLaunchPadStateNativeTsx7(minimized){const{updateSharedValueIfChanged,launchPadPullTabState}=this.__closure;updateSharedValueIfChanged(launchPadPullTabState,{minimized:minimized});}'};
object = {code: 'function useLaunchPadStateNativeTsx8(){const{launchPadPullTabState,setLaunchPadPullTabBoundedPosition}=this.__closure;const positionY=launchPadPullTabState.get().position;setLaunchPadPullTabBoundedPosition(positionY);}'};
(FileImportTrackerModule).fileFinishedImporting('modules/launchpad/native/useLaunchPadState.native.tsx');
exports.default = useLaunchPadState;
function useLaunchPadState() { // fn#117065, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15511:2613, offset: 0x024a23a9, size: 197 bytes, params: 1, frame: 20
const value2 = (ReanimatedRexportModule).useSharedValue(env0_6);
const value3 = (ReanimatedRexportModule).useSharedValue(env0_7);
const value4 = (ReanimatedRexportModule).useSharedValue(0);
const value5 = (ReanimatedRexportModule).useSharedValue(false);
const binding = value5;
const useMemo = binding.useMemo;
let object = [value2, value3, value4, value5];
object = {launchPadSharedState: value4, launchPadPullTabState: value3, launchPadShown: value5, gestureState: value2,
updaters: Reflect.apply(useMemo, binding, [_fun117066, object])};
return object;
function _fun117066() { // fn#117066, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15511:2772, offset: 0x024a246e, size: 626 bytes, params: 1, frame: 22
let closure = setLaunchPadShown;
closure.__closure = {launchPadShown: ReactModule};
closure.__workletHash = 17051366113851;
closure.__initData = env1_8;
const setLaunchPadPosition2 = setLaunchPadPosition;
setLaunchPadPosition2.__closure = {launchPadSharedState: env0_2};
setLaunchPadPosition2.__workletHash = 128574367175;
setLaunchPadPosition2.__initData = env1_9;
const setLaunchPadPullTabBoundedPosition2 = setLaunchPadPullTabBoundedPosition;
object = {};
const getWindowDimensionsWorklet = (UseWindowDimensionsSharedValueNativeModule).getWindowDimensionsWorklet;
object.getWindowDimensionsWorklet = getWindowDimensionsWorklet;
const binding = env0_1;
object.launchPadPullTabState = binding;
object.LAUNCH_PAD_PULL_TAB_MAX_POSITION = LAUNCH_PAD_PULL_TAB_MAX_POSITION;
const getSafeAreaInsetsWorklet = (UseSafeAreaInsetsSharedValueNativeModule).getSafeAreaInsetsWorklet;
object.getSafeAreaInsetsWorklet = getSafeAreaInsetsWorklet;
object.LAUNCH_PAD_PULL_TAB_SCALE_OFFSET = LAUNCH_PAD_PULL_TAB_SCALE_OFFSET;
object.updateSharedValueIfChanged = importDefault(11282) /* metro dependency 11282: updateSharedValueIfChangedNative */;
object.runOnJS = (require(4017) /* metro dependency 4017: ReanimatedRexport */).runOnJS;
object.persistLaunchPadPullTabPosition = (require(15315) /* metro dependency 15315: LaunchPadPullTabCache */).persistLaunchPadPullTabPosition;
setLaunchPadPullTabBoundedPosition2.__closure = object;
setLaunchPadPullTabBoundedPosition2.__workletHash = 10962658404039;
setLaunchPadPullTabBoundedPosition2.__initData = env1_10;
object = {setLaunchPadShown: closure, setLaunchPadPosition: setLaunchPadPosition2};
closure = setLaunchPadPullTabTranslation;
closure.__closure = {gestureState: env0_0, setLaunchPadPullTabBoundedPosition: setLaunchPadPullTabBoundedPosition2};
closure.__workletHash = 14133148345236;
closure.__initData = env1_11;
object.setLaunchPadPullTabTranslation = closure;
closure = setLaunchPadPullTabPosition;
closure.__closure = {updateSharedValueIfChanged: importDefault(11282) /* metro dependency 11282: updateSharedValueIfChangedNative */,
launchPadPullTabState: binding};
closure.__workletHash = 2910499659585;
closure.__initData = env1_12;
object.setLaunchPadPullTabPosition = closure;
closure = setLaunchPadPullTabScale;
closure.__closure = {updateSharedValueIfChanged: importDefault(11282) /* metro dependency 11282: updateSharedValueIfChangedNative */,
launchPadPullTabState: binding};
closure.__workletHash = 2074690206772;
closure.__initData = env1_13;
object.setLaunchPadPullTabScale = closure;
closure = setLaunchPadPullTabMinimized;
closure.__closure = {updateSharedValueIfChanged: importDefault(11282) /* metro dependency 11282: updateSharedValueIfChangedNative */,
launchPadPullTabState: binding};
closure.__workletHash = 6903049267633;
closure.__initData = env1_14;
object.setLaunchPadPullTabMinimized = closure;
closure = onWindowHeightChange;
closure.__closure = {launchPadPullTabState: binding,
setLaunchPadPullTabBoundedPosition: setLaunchPadPullTabBoundedPosition2};
closure.__workletHash = 11005162001151;
closure.__initData = env1_15;
object.onWindowHeightChange = closure;
return object;
function setLaunchPadShown(a0) { // fn#117067, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15511:2803, offset: 0x024a26e0, size: 24 bytes, params: 2, frame: 11
env1_3.set(a0);
}
function setLaunchPadPosition(a0) { // fn#117068, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15511:2909, offset: 0x024a26f8, size: 65 bytes, params: 2, frame: 17
const value = environment.__proto__;
const binding = env1_2;
const set = binding.set;
const Math = global.Math;
const max = Math.max;
const Math2 = global.Math;
Reflect.apply(set, binding, [Reflect.apply(max, Math, [Math2.min(a0, 1), 0])]);
}
function setLaunchPadPullTabBoundedPosition(a0) { // fn#117069, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15511:3044, offset: 0x024a2739, size: 223 bytes, params: 2, frame: 21
let value = environment.__proto__.__proto__;
const getWindowDimensionsWorklet = UseWindowDimensionsSharedValueNativeModule.getWindowDimensionsWorklet;
const height = Reflect.apply(getWindowDimensionsWorklet, UseWindowDimensionsSharedValueNativeModule, []).height;
const binding = env1_1;
const get = binding.get;
const value4 = height - Reflect.apply(get, binding, []).offset - LAUNCH_PAD_PULL_TAB_MAX_POSITION;
const getSafeAreaInsetsWorklet = UseSafeAreaInsetsSharedValueNativeModule.getSafeAreaInsetsWorklet;
const value5 = Reflect.apply(getSafeAreaInsetsWorklet, UseSafeAreaInsetsSharedValueNativeModule,
[]).top + LAUNCH_PAD_PULL_TAB_SCALE_OFFSET;
const Math = global.Math;
const max = Math.max;
const Math2 = global.Math;
const value6 = Reflect.apply(max, Math, [Math2.min(a0, value4), value5]);
(UpdateSharedValueIfChangedNative)(binding, {position: value6});
value = require(4017) /* metro dependency 4017: ReanimatedRexport */;
value.runOnJS((LaunchPadPullTabCacheModule).persistLaunchPadPullTabPosition)(value6);
}
function setLaunchPadPullTabTranslation(a0) { // fn#117070, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15511:3770, offset: 0x024a2818, size: 45 bytes, params: 2, frame: 11
const value = environment.__proto__;
const binding = env1_0;
const get = binding.get;
setLaunchPadPullTabBoundedPosition(Reflect.apply(get, binding, []).initialPullTabPosition + a0);
}
function setLaunchPadPullTabPosition(a0, a1) { // fn#117071, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15511:3972, offset: 0x024a2845, size: 57 bytes, params: 3, frame: 14
const value = environment.__proto__.__proto__;
(UpdateSharedValueIfChangedNative)(env1_1, {position: a0,
offset: a1});
}
function setLaunchPadPullTabScale(a0) { // fn#117072, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15511:4169, offset: 0x024a287e, size: 50 bytes, params: 2, frame: 14
const value = environment.__proto__.__proto__;
(UpdateSharedValueIfChangedNative)(env1_1, {scale: a0});
}
function setLaunchPadPullTabMinimized(a0) { // fn#117073, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15511:4356, offset: 0x024a28b0, size: 50 bytes, params: 2, frame: 14
const value = environment.__proto__.__proto__;
(UpdateSharedValueIfChangedNative)(env1_1, {minimized: a0});
}
function onWindowHeightChange() { // fn#117074, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15511:4539, offset: 0x024a28e2, size: 37 bytes, params: 1, frame: 11
const binding = env1_1;
const get = binding.get;
setLaunchPadPullTabBoundedPosition(Reflect.apply(get, binding, []).position);
}
}
}
}
global.__d(_fun117064, 15314, [31, 11324, 15315, 4017, 14283, 11281, 11282,
2]) /* metro module 15314, dependencies: [31, 11324, 15315, 4017, 14283, 11281, 11282, 2] */;