decord/source/modules/home_drawer/native/useHomeDrawerPeekHint.tsx

253 lines
8.2 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 15355
// Function ID: 15356
2026-07-20 16:05:17 +00:00
// Name: items
2026-08-24 06:08:38 +00:00
// Dependencies: [32, 19, 4669, 15353, 676, 1388, 4119, 1377, 1501, 15356, 589, 15346, 4200, 7404, 4671, 4749, 15352, 2]
2026-07-20 16:05:17 +00:00
// Exports: useHomeDrawerPeekHint
2026-08-24 06:08:38 +00:00
// Module 15355 (items)
import closure_2 from "_slicedToArray" /* 32 */;
import closure_3 from "noop" /* 19 */;
import closure_4 from "maybeApplyNoTextColorForLightCustomTheme" /* 4669 */;
import closure_5 from "withEqualityFn" /* 15353 */;
import { ME } from "ME" /* 676 */;
import { ContentDismissActionType } from "ContentDismissActionType" /* 1388 */;
import { Easing } from "module_4119" /* 4119 */;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-29 08:29:29 +00:00
let c8 = 2000;
2026-08-24 06:08:38 +00:00
let closure_9 = Easing.inOut(require("module_4119").Easing.cubic);
2026-07-29 08:29:29 +00:00
let closure_10 = [];
2026-07-23 10:11:24 +00:00
let items = [require("DismissibleContent").DismissibleContent.HOME_DRAWER_SWIPE_PEEK_NUX];
2026-07-29 08:29:29 +00:00
let closure_12 = { code: "function useHomeDrawerPeekHintTsx1(){const{gestureState,panelX,PEEK_HINT_DRAWER_DRAG_THRESHOLD}=this.__closure;return gestureState.get().active&&panelX.get()>PEEK_HINT_DRAWER_DRAG_THRESHOLD;}" };
let closure_13 = { code: "function useHomeDrawerPeekHintTsx2(isDragged,wasDragged){const{isPeekGranted,runOnJS,handleDrawerDragged}=this.__closure;if(!isPeekGranted||wasDragged==null)return;if(isDragged&&!wasDragged){runOnJS(handleDrawerDragged)();}}" };
2026-08-24 06:08:38 +00:00
let result = require("set").fileFinishedImporting("modules/home_drawer/native/useHomeDrawerPeekHint.tsx");
2026-07-20 16:05:17 +00:00
export const PEEK_HINT_DISTANCE = 40;
2026-07-29 08:29:29 +00:00
export const useHomeDrawerPeekHint = function useHomeDrawerPeekHint(enableHome, sharedValue2) {
let tmp = enableHome;
2026-07-23 10:11:24 +00:00
const _require = sharedValue2;
const tmp2 = noteInteraction();
2026-07-20 16:05:17 +00:00
const panelX = tmp2.panelX;
const gestureState = tmp2.gestureState;
const lastInteractionAt = tmp2.lastInteractionAt;
const isPanelTouchActive = tmp2.isPanelTouchActive;
2026-07-23 10:11:24 +00:00
noteInteraction = tmp2.noteInteraction;
let obj = _require(panelX[8]);
2026-07-20 16:05:17 +00:00
const isFocused = obj.useIsFocused();
2026-07-29 08:29:29 +00:00
const drawerOpen = _require(panelX[9]).useDrawerOpen(enableHome);
2026-07-23 10:11:24 +00:00
const obj2 = _require(panelX[9]);
2026-08-24 06:08:38 +00:00
items = [isPanelTouchActive];
2026-07-23 10:11:24 +00:00
const stateFromStores = _require(panelX[10]).useStateFromStores(items, () => isPanelTouchActive.useReducedMotion);
const obj3 = _require(panelX[10]);
const first = gestureState(_require(panelX[11]).useGuildsRouteGuildAndChannelId(), 1)[0];
const obj4 = _require(panelX[11]);
const obj5 = _require(panelX[12]);
2026-07-29 08:29:29 +00:00
if (enableHome) {
2026-07-20 16:05:17 +00:00
tmp = isFocused;
}
if (tmp) {
tmp = null != first;
}
if (tmp) {
2026-07-23 10:11:24 +00:00
tmp = first !== drawerOpen;
2026-07-20 16:05:17 +00:00
}
if (tmp) {
tmp = !drawerOpen;
}
if (tmp) {
tmp = !stateFromStores;
}
if (tmp) {
2026-07-29 08:29:29 +00:00
tmp = tmp10;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
closure_7 = tmp;
closure_8 = lastInteractionAt.useRef(false);
2026-07-29 08:29:29 +00:00
let tmp8Result = tmp8(lastInteractionAt.useState(false), 2);
const first1 = tmp8Result[0];
2026-08-24 06:08:38 +00:00
closure_10 = tmp15;
2026-07-29 08:29:29 +00:00
let tmp16 = first1;
2026-07-20 16:05:17 +00:00
if (first1) {
2026-07-29 08:29:29 +00:00
tmp16 = !tmp;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (tmp16) {
tmp15(false);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let tmp3Result = tmp3(tmp4[13]);
2026-07-20 16:05:17 +00:00
if (first1) {
if (tmp) {
2026-08-24 06:08:38 +00:00
let tmp20 = closure_11;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp8Result = tmp8(tmp19(tmp20, undefined, true), 2);
2026-08-24 06:08:38 +00:00
closure_11 = tmp22;
closure_12 = obj6.useRef(null);
closure_13 = obj6.useRef(null);
closure_14 = obj6.useRef(false);
closure_15 = obj6.useRef(null);
2026-07-20 16:05:17 +00:00
const items1 = [sharedValue2];
2026-07-29 08:29:29 +00:00
const callback = obj6.useCallback(() => {
if (null != ref2.current) {
2026-07-20 16:05:17 +00:00
const _clearTimeout = clearTimeout;
2026-07-29 08:29:29 +00:00
clearTimeout(tmp.current);
tmp.current = null;
2026-07-20 16:05:17 +00:00
}
closure_14.current = true;
2026-07-23 10:11:24 +00:00
let obj = sharedValue2(panelX[14]);
2026-07-29 08:29:29 +00:00
obj = { duration: 1500, easing: first1 };
2026-07-23 10:11:24 +00:00
let result = sharedValue2.set(obj.withTiming(40, obj));
2026-07-20 16:05:17 +00:00
closure_13.current = setTimeout(() => {
2026-07-29 08:29:29 +00:00
closure_13.current = null;
closure_14.current = false;
2026-08-24 06:08:38 +00:00
const result = closure_0.set(closure_1_0(closure_1_1[15]).withSpring(0, closure_1_0(closure_1_1[16]).HOME_DRAWER_FLING_PHYSICS));
2026-07-29 08:29:29 +00:00
const current = ref.current;
if (current != null) {
2026-08-24 06:08:38 +00:00
current(closure_1_7.AUTO_DISMISS);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
callback(false);
2026-07-20 16:05:17 +00:00
}, 2500);
}, items1);
2026-07-29 08:29:29 +00:00
const tmp25 = tmp8Result[0] === tmp3(tmp4[7]).DismissibleContent.HOME_DRAWER_SWIPE_PEEK_NUX;
2026-08-24 06:08:38 +00:00
closure_17 = tmp25;
2026-07-29 08:29:29 +00:00
const items2 = [tmp25, callback, tmp8Result[1]];
const effect = obj6.useEffect(() => {
2026-07-23 10:11:24 +00:00
let tmp = closure_17;
if (closure_17) {
2026-07-29 08:29:29 +00:00
tmp = !ref4.current;
2026-07-20 16:05:17 +00:00
}
if (tmp) {
2026-07-23 10:11:24 +00:00
closure_15.current = closure_11;
2026-07-20 16:05:17 +00:00
callback();
}
}, items2);
const items3 = [sharedValue2];
2026-07-29 08:29:29 +00:00
const callback1 = obj6.useCallback(() => {
if (null != ref2.current) {
2026-07-20 16:05:17 +00:00
const _clearTimeout = clearTimeout;
2026-07-29 08:29:29 +00:00
clearTimeout(tmp.current);
tmp.current = null;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (null != ref3.current) {
2026-07-20 16:05:17 +00:00
const _clearTimeout2 = clearTimeout;
2026-07-29 08:29:29 +00:00
clearTimeout(tmp4.current);
tmp4.current = null;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (ref4.current) {
tmp7.current = false;
2026-07-23 10:11:24 +00:00
const result = sharedValue2.set(sharedValue2(panelX[15]).withSpring(0, sharedValue2(panelX[16]).HOME_DRAWER_FLING_PHYSICS));
const obj = sharedValue2(panelX[15]);
2026-07-20 16:05:17 +00:00
}
}, items3);
const items4 = [tmp, first1, noteInteraction, lastInteractionAt, isPanelTouchActive];
2026-07-29 08:29:29 +00:00
const effect1 = obj6.useEffect(() => {
2026-07-23 10:11:24 +00:00
if (closure_7) {
2026-07-20 16:05:17 +00:00
if (!first1) {
if (!ref.current) {
noteInteraction();
const _setTimeout = setTimeout;
function checkIdle() {
2026-08-24 06:08:38 +00:00
closure_1_12.current = null;
let diff = closure_8 - (Date.now() - closure_1_3.current);
if (!closure_1_4.get()) {
2026-07-29 08:29:29 +00:00
if (0 >= diff) {
2026-08-24 06:08:38 +00:00
closure_1_10(true);
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
if (0 >= diff) {
diff = closure_8;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
closure_1_12.current = setTimeout(checkIdle, diff);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
closure_12.current = setTimeout(checkIdle, ref);
2026-07-20 16:05:17 +00:00
return () => {
2026-07-29 08:29:29 +00:00
if (null != ref.current) {
2026-07-20 16:05:17 +00:00
const _clearTimeout = clearTimeout;
2026-07-29 08:29:29 +00:00
clearTimeout(tmp.current);
tmp.current = null;
2026-07-20 16:05:17 +00:00
}
};
}
}
}
}, items4);
const items5 = [drawerOpen, callback1];
2026-07-29 08:29:29 +00:00
const effect2 = obj6.useEffect(() => {
2026-07-20 16:05:17 +00:00
if (drawerOpen) {
closure_8.current = true;
callback1();
}
}, items5);
const items6 = [tmp, callback1];
2026-07-29 08:29:29 +00:00
const effect3 = obj6.useEffect(() => {
2026-08-24 06:08:38 +00:00
let current = !constants;
if (!constants) {
2026-07-29 08:29:29 +00:00
current = ref4.current;
2026-07-20 16:05:17 +00:00
}
if (current) {
callback1();
2026-07-29 08:29:29 +00:00
const current2 = ref5.current;
if (current2 != null) {
2026-08-24 06:08:38 +00:00
current2(constants.AUTO_DISMISS);
2026-07-20 16:05:17 +00:00
}
}
}, items6);
const items7 = [callback1];
2026-07-29 08:29:29 +00:00
const callback2 = obj6.useCallback(() => {
2026-08-24 06:08:38 +00:00
callback1();
2026-07-29 08:29:29 +00:00
const current = ref5.current;
if (current != null) {
2026-08-24 06:08:38 +00:00
current(constants.INDIRECT_ACTION);
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
callback(false);
2026-07-20 16:05:17 +00:00
}, items7);
2026-07-29 08:29:29 +00:00
tmp3Result = tmp3(tmp4[6]);
2026-07-20 16:05:17 +00:00
class V {
constructor() {
active = gestureState.get().active;
if (active) {
tmp = panelX;
num = 8;
active = panelX.get() > 8;
}
return active;
}
}
2026-07-29 08:29:29 +00:00
obj = { gestureState: null, panelX: null, PEEK_HINT_DRAWER_DRAG_THRESHOLD: 8 };
obj[0] = gestureState;
obj[1] = panelX;
2026-07-20 16:05:17 +00:00
V.__closure = obj;
V.__workletHash = 15765003051494;
2026-07-29 08:29:29 +00:00
V.__initData = closure_12;
2026-07-20 16:05:17 +00:00
class Q {
constructor(arg0, arg1) {
2026-08-24 06:08:38 +00:00
tmp = closure_17;
if (closure_17) {
2026-07-20 16:05:17 +00:00
tmp2 = null;
tmp = null != sharedValue2;
}
if (tmp) {
2026-07-29 08:29:29 +00:00
tmp = enableHome;
2026-07-20 16:05:17 +00:00
}
if (tmp) {
tmp = !sharedValue2;
}
if (tmp) {
2026-07-23 10:11:24 +00:00
tmp3 = closure_0;
2026-07-20 16:05:17 +00:00
tmp4 = panelX;
2026-07-23 10:11:24 +00:00
obj = closure_0(panelX[6]);
2026-08-24 06:08:38 +00:00
tmp5 = closure_19;
tmp6 = obj.runOnJS(closure_19)();
2026-07-20 16:05:17 +00:00
}
return;
}
}
2026-07-29 08:29:29 +00:00
obj = { isPeekGranted: null, runOnJS: null, handleDrawerDragged: null };
obj[0] = tmp25;
obj[1] = tmp3(tmp4[6]).runOnJS;
obj[2] = callback2;
2026-07-20 16:05:17 +00:00
Q.__closure = obj;
Q.__workletHash = 10054961085184;
2026-07-29 08:29:29 +00:00
Q.__initData = closure_13;
const animatedReaction = tmp3Result.useAnimatedReaction(V, Q);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp20 = closure_10;
2026-07-20 16:05:17 +00:00
};