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

270 lines
19 KiB
TypeScript

/* Metro module 15320; source: modules/launchpad/native/LaunchPadPullTab.tsx; dependencies: [31, 27, 11324, 11529, 33, 4501, 697, 15319, 4017, 14283, 14937, 15321, 4577, 1244, 15264, 12376, 2] */
function _fun117114(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#117114, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15517:6, offset: 0x024a4713, size: 513 bytes, params: 8, frame: 26
var object3;
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = importAll(31) /* metro dependency 31 */;
const env0_3 = (require(27) /* metro dependency 27 */).Pressable;
const launchPadConstantsModule = require(11324) /* metro dependency 11324: LaunchPadConstants */;
const env0_4 = launchPadConstantsModule.LAUNCH_PAD_MARGIN;
const LAUNCH_PAD_PULL_TAB_BORDER_RADIUS = launchPadConstantsModule.LAUNCH_PAD_PULL_TAB_BORDER_RADIUS;
const LAUNCH_PAD_PULL_TAB_HEIGHT = launchPadConstantsModule.LAUNCH_PAD_PULL_TAB_HEIGHT;
const env0_7 = launchPadConstantsModule.LAUNCH_PAD_PULL_TAB_HIT_SLOP;
const env0_8 = launchPadConstantsModule.LAUNCH_PAD_PULL_TAB_MINIMIZED_OFFSET;
const env0_9 = launchPadConstantsModule.LAUNCH_PAD_PULL_TAB_SCALE_FACTOR;
const env0_10 = launchPadConstantsModule.LAUNCH_PAD_PULL_TAB_SCALE_OFFSET;
const LAUNCH_PAD_PULL_TAB_WIDTH = launchPadConstantsModule.LAUNCH_PAD_PULL_TAB_WIDTH;
const env0_11 = launchPadConstantsModule.LAUNCH_PAD_SPRING_CONFIG;
const env0_12 = (require(11529) /* metro dependency 11529: ChatInputConstants */).CHAT_INPUT_HEIGHT;
const env0_13 = (require(33) /* metro dependency 33 */).jsx;
const createStylesModule = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = createStylesModule.createStyles;
object3 = {};
const object4 = {'position': 'absolute', 'right': 0};
object4.width = LAUNCH_PAD_PULL_TAB_WIDTH;
object4.height = LAUNCH_PAD_PULL_TAB_HEIGHT;
object4.borderTopLeftRadius = LAUNCH_PAD_PULL_TAB_BORDER_RADIUS;
object4.borderBottomLeftRadius = LAUNCH_PAD_PULL_TAB_BORDER_RADIUS;
object4.borderWidth = 1;
object4.borderTopWidth = 1;
object4.borderColor = 'rgba(0, 0, 0, 0.08)';
const SHADOW_MOBILE_NAVIGATOR_X = (importDefault(697) /* metro dependency 697: native */).shadows.SHADOW_MOBILE_NAVIGATOR_X;
copyDataProperties(object4, SHADOW_MOBILE_NAVIGATOR_X, undefined);
object3.pullTab = object4;
object3.pullTabButton = {width: LAUNCH_PAD_PULL_TAB_WIDTH, height: LAUNCH_PAD_PULL_TAB_HEIGHT,
justifyContent: 'center', alignItems: 'center'};
const BACKGROUND_BASE_LOW = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOW;
object3.launchPad = {color: BACKGROUND_BASE_LOW};
const env0_14 = Reflect.apply(createStyles, createStylesModule, [object3]);
object3 = {code: 'function LaunchPadPullTabTsx1(){const{keyboardHeight}=this.__closure;return keyboardHeight.get();}'};
object3 = {code: 'function LaunchPadPullTabTsx2(keyboardHeight,keyboardHeightPrev){const{launchPadSharedState,updaters,keyboardHeightOpened,launchPadPullTabState,CHAT_INPUT_HEIGHT,LAUNCH_PAD_MARGIN,getWindowDimensionsWorklet,LAUNCH_PAD_PULL_TAB_HEIGHT,LAUNCH_PAD_PULL_TAB_SCALE_OFFSET}=this.__closure;if(launchPadSharedState.get()!==0){updaters.setLaunchPadPullTabMinimized(false);return;}if(keyboardHeightPrev==null||keyboardHeight===keyboardHeightPrev){return;}if(keyboardHeight<keyboardHeightPrev){var _keyboardHeightOpened;if(keyboardHeight===0){updaters.setLaunchPadPullTabMinimized(false);}if(keyboardHeightOpened.get()==null){keyboardHeightOpened.set(keyboardHeightPrev);}const keyboardClosePercent=1-keyboardHeight/((_keyboardHeightOpened=keyboardHeightOpened.get())!==null&&_keyboardHeightOpened!==void 0?_keyboardHeightOpened:keyboardHeightPrev);const keyboardOffsetRetractionAmount=launchPadPullTabState.get().offset*keyboardClosePercent;updaters.setLaunchPadPullTabPosition(launchPadPullTabState.get().position+keyboardOffsetRetractionAmount,launchPadPullTabState.get().offset-keyboardOffsetRetractionAmount);}else{updaters.setLaunchPadPullTabMinimized(true);if(keyboardHeightOpened.get()!=null){keyboardHeightOpened.set(undefined);}const keyboardWithChatInput=keyboardHeight+CHAT_INPUT_HEIGHT+LAUNCH_PAD_MARGIN*2;const spaceUnderPullTab=getWindowDimensionsWorklet({ignoreKeyboard:true}).height-(launchPadPullTabState.get().position+LAUNCH_PAD_PULL_TAB_HEIGHT+LAUNCH_PAD_PULL_TAB_SCALE_OFFSET);const offset=spaceUnderPullTab>keyboardWithChatInput?0:keyboardWithChatInput-spaceUnderPullTab;if(offset>0){updaters.setLaunchPadPullTabPosition(launchPadPullTabState.get().position-offset,launchPadPullTabState.get().offset+offset);}}}'};
object3 = {code: 'function LaunchPadPullTabTsx3(){const{isMinimized,gestureState,LAUNCH_PAD_PULL_TAB_MINIMIZED_OFFSET,interpolate,launchPadSharedState,windowDimensions,launchPadPullTabState,LAUNCH_PAD_PULL_TAB_BORDER_RADIUS,interpolateColor,LAUNCH_PAD_MARGIN,backgroundColorTabBar,backgroundColorLaunchPad,withSpring,LAUNCH_PAD_SPRING_CONFIG}=this.__closure;let translateX=isMinimized.get()&&!gestureState.get().active?LAUNCH_PAD_PULL_TAB_MINIMIZED_OFFSET:interpolate(launchPadSharedState.get(),[0,1],[0,-(windowDimensions.get().width-16)]);if(launchPadSharedState.get()>0.9){translateX=-windowDimensions.get().width;}else if(gestureState.get().active){if(gestureState.get().requiresPop){translateX+=gestureState.get().positionOffsetX*0.3;}else{translateX-=4;}}const translateY=launchPadPullTabState.get().position;const borderRadius=launchPadSharedState.get()<=0&&!gestureState.get().active?0:LAUNCH_PAD_PULL_TAB_BORDER_RADIUS;const backgroundColor=interpolateColor(launchPadSharedState.get()*windowDimensions.get().width,[0,LAUNCH_PAD_MARGIN],[backgroundColorTabBar,backgroundColorLaunchPad]);return{transform:[{translateX:withSpring(translateX,LAUNCH_PAD_SPRING_CONFIG)},{translateY:withSpring(translateY,LAUNCH_PAD_SPRING_CONFIG)},{scale:withSpring(launchPadPullTabState.get().scale,LAUNCH_PAD_SPRING_CONFIG)}],borderTopRightRadius:withSpring(borderRadius,LAUNCH_PAD_SPRING_CONFIG),borderBottomRightRadius:withSpring(borderRadius,LAUNCH_PAD_SPRING_CONFIG),backgroundColor:backgroundColor};}'};
value = value.memo(LaunchPadPullTab);
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/launchpad/native/LaunchPadPullTab.tsx');
exports.default = value;
}
function LaunchPadPullTab({launchPadSharedState, launchPadPullTabState, gestureState, updaters}) { // fn#117115, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15517:4195, offset: 0x024a4914, size: 618 bytes, params: 2, frame: 29
var object4;
const styles = useStyles();
const value2 = (require(14937) /* metro dependency 14937: useTabBarStyles */).useTabBarStyles();
const value3 = (importDefault(14283) /* metro dependency 14283: useWindowDimensionsSharedValueNative */)();
const color = styles.launchPad.color;
const backgroundColor = value2.tabBar.backgroundColor;
const value4 = (importDefault(15321) /* metro dependency 15321: useLaunchPadPullTabMinimized */)({launchPadSharedState: launchPadSharedState,
launchPadPullTabState: launchPadPullTabState});
const reanimatedRexportModule = require(4017) /* metro dependency 4017: ReanimatedRexport */;
const useAnimatedStyle = reanimatedRexportModule.useAnimatedStyle;
const closure = LaunchPadPullTabF;
object4 = {isMinimized: value4, gestureState: gestureState};
object4.LAUNCH_PAD_PULL_TAB_MINIMIZED_OFFSET = LAUNCH_PAD_PULL_TAB_MINIMIZED_OFFSET;
object4.interpolate = reanimatedRexportModule.interpolate;
object4.launchPadSharedState = launchPadSharedState;
object4.windowDimensions = value3;
object4.launchPadPullTabState = launchPadPullTabState;
object4.LAUNCH_PAD_PULL_TAB_BORDER_RADIUS = LAUNCH_PAD_PULL_TAB_BORDER_RADIUS;
object4.interpolateColor = reanimatedRexportModule.interpolateColor;
object4.LAUNCH_PAD_MARGIN = LAUNCH_PAD_MARGIN;
object4.backgroundColorTabBar = backgroundColor;
object4.backgroundColorLaunchPad = color;
object4.withSpring = (require(4577) /* metro dependency 4577: spring */).withSpring;
object4.LAUNCH_PAD_SPRING_CONFIG = LAUNCH_PAD_SPRING_CONFIG;
closure.__closure = object4;
closure.__workletHash = 17461120174889;
closure.__initData = env0_17;
const value5 = Reflect.apply(useAnimatedStyle, reanimatedRexportModule, [closure]);
useLaunchPadPullTabKeyboardListener({launchPadSharedState: launchPadSharedState,
launchPadPullTabState: launchPadPullTabState, updaters: updaters});
const View = (importDefault(4017) /* metro dependency 4017: ReanimatedRexport */).View;
const items2 = [styles.pullTab, value5];
const object3 = {accessibilityRole: 'button'};
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
object3.accessibilityLabel = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.yTnIfb);
object3.hitSlop = LAUNCH_PAD_PULL_TAB_HIT_SLOP;
object3.style = styles.pullTabButton;
object3.onTouchStart = function() {
updaters.setLaunchPadPullTabScale(LAUNCH_PAD_PULL_TAB_SCALE_FACTOR);
};
object3.onPress = importDefault(15264) /* metro dependency 15264: showLaunchPad */;
const ChannelListMagnifyingGlassIcon = (require(12376) /* metro dependency 12376: ChannelListMagnifyingGlassIcon */).ChannelListMagnifyingGlassIcon;
return (
<View style={items2}>
<Pressable {...object3}>
<ChannelListMagnifyingGlassIcon size="xs" />
</Pressable>
</View>
);
}
function LaunchPadPullTabF() { // fn#117116, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15517:4489, owner: LaunchPadPullTab.f, offset: 0x024a4b7e, size: 663 bytes, params: 1, frame: 24
var r2;
var gestureStateBinding;
var value2;
var value3;
var moduleValue;
var interpolate;
var value4;
let binding = env0_7;
let get = binding.get;
if (Reflect.apply(get, binding, [])) {
gestureStateBinding = gestureState;
if (gestureStateBinding.get().active) {
value3 = environment.__proto__;
moduleValue = require(4017) /* metro dependency 4017: ReanimatedRexport */;
interpolate = moduleValue.interpolate;
value4 = launchPadSharedState.get();
binding = env0_4;
r2 = Reflect.apply(interpolate, moduleValue, [value4, [0, 1], [0, -(binding.get().width - 16)]]);
} else {
value2 = environment.__proto__;
r2 = LAUNCH_PAD_PULL_TAB_MINIMIZED_OFFSET;
}
} else {
value3 = environment.__proto__;
moduleValue = require(4017) /* metro dependency 4017: ReanimatedRexport */;
interpolate = moduleValue.interpolate;
value4 = launchPadSharedState.get();
binding = env0_4;
r2 = Reflect.apply(interpolate, moduleValue, [value4, [0, 1], [0, -(binding.get().width - 16)]]);
}
const r12 = launchPadSharedState.get() > 0.9 ? -env0_4.get().width : gestureState.get().active ? gestureState.get().requiresPop ? r2 + 0.3 * gestureState.get().positionOffsetX : r2 - 4 : r2;
let launchPadPullTabStateBinding = launchPadPullTabState;
get = launchPadPullTabStateBinding.get;
const position = Reflect.apply(get, launchPadPullTabStateBinding, []).position;
const value11 = launchPadSharedState.get();
const value12 = 0;
const LAUNCH_PAD_PULL_TAB_BORDER_RADIUS2 = value11 <= value12 ? gestureState.get().active ? LAUNCH_PAD_PULL_TAB_BORDER_RADIUS : value12 : LAUNCH_PAD_PULL_TAB_BORDER_RADIUS;
const reanimatedRexportModule = require(4017) /* metro dependency 4017: ReanimatedRexport */;
const interpolateColor = reanimatedRexportModule.interpolateColor;
const value15 = launchPadSharedState.get();
binding = env0_4;
get = binding.get;
const value17 = Reflect.apply(interpolateColor, reanimatedRexportModule, [value15 * Reflect.apply(get, binding,
[]).width, [0, LAUNCH_PAD_MARGIN], [backgroundColor, color]]);
const object2 = {};
const springModule = require(4577) /* metro dependency 4577: spring */;
let withSpring = springModule.withSpring;
const items2 = [{translateX: Reflect.apply(withSpring, springModule, [r12, LAUNCH_PAD_SPRING_CONFIG])}];
const object4 = {};
object4.translateY = springModule.withSpring(position, LAUNCH_PAD_SPRING_CONFIG);
items2[1] = object4;
const moduleValue5 = springModule;
withSpring = moduleValue5.withSpring;
launchPadPullTabStateBinding = launchPadPullTabState;
get = launchPadPullTabStateBinding.get;
items2[2] = {scale: Reflect.apply(withSpring, moduleValue5, [Reflect.apply(get, launchPadPullTabStateBinding,
[]).scale, LAUNCH_PAD_SPRING_CONFIG])};
object2.transform = items2;
object2.borderTopRightRadius = springModule.withSpring(LAUNCH_PAD_PULL_TAB_BORDER_RADIUS2, LAUNCH_PAD_SPRING_CONFIG);
object2.borderBottomRightRadius = springModule.withSpring(LAUNCH_PAD_PULL_TAB_BORDER_RADIUS2,
LAUNCH_PAD_SPRING_CONFIG);
object2.backgroundColor = value17;
return object2;
}
function useLaunchPadPullTabKeyboardListener({launchPadSharedState, launchPadPullTabState, updaters}) { // fn#117117, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15517:5509, owner: LaunchPadPullTab.useLaunchPadPullTabKeyboardListener, offset: 0x024a4e15, size: 290 bytes, params: 2, frame: 23
var object2;
const value2 = (importDefault(15319) /* metro dependency 15319: useAnimatedKeyboardHeight */)();
const value3 = (require(4017) /* metro dependency 4017: ReanimatedRexport */).useSharedValue(undefined);
const reanimatedRexportModule = require(4017) /* metro dependency 4017: ReanimatedRexport */;
const useAnimatedReaction = reanimatedRexportModule.useAnimatedReaction;
const closure = useLaunchPadPullTabKeyboardListener_;
closure.__closure = {keyboardHeight: value2};
closure.__workletHash = 14545769097570;
closure.__initData = env1_15;
const closure2 = useLaunchPadPullTabKeyboardListenerS;
object2 = {launchPadSharedState: launchPadSharedState, updaters: updaters, keyboardHeightOpened: value3,
launchPadPullTabState: launchPadPullTabState};
object2.CHAT_INPUT_HEIGHT = CHAT_INPUT_HEIGHT;
object2.LAUNCH_PAD_MARGIN = LAUNCH_PAD_MARGIN;
const getWindowDimensionsWorklet = (require(14283) /* metro dependency 14283: useWindowDimensionsSharedValueNative */).getWindowDimensionsWorklet;
object2.getWindowDimensionsWorklet = getWindowDimensionsWorklet;
object2.LAUNCH_PAD_PULL_TAB_HEIGHT = LAUNCH_PAD_PULL_TAB_HEIGHT;
object2.LAUNCH_PAD_PULL_TAB_SCALE_OFFSET = LAUNCH_PAD_PULL_TAB_SCALE_OFFSET;
closure2.__closure = object2;
closure2.__workletHash = 8060927175361;
closure2.__initData = env1_16;
Reflect.apply(useAnimatedReaction, reanimatedRexportModule, [closure, closure2]);
}
function useLaunchPadPullTabKeyboardListenerS(a0, a1) { // fn#117119, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15517:5793, owner: LaunchPadPullTab.useLaunchPadPullTabKeyboardListener.s, offset: 0x024a4f37, size: 474 bytes, params: 3, frame: 20
var r9;
var updatersBinding;
var binding;
var value6;
var moduleValue;
var height;
var launchPadPullTabStateBinding;
var setLaunchPadPullTabPosition;
var offset;
var value9;
let value = a1;
const value3 = launchPadSharedState.get();
const value4 = 0;
if (value4 === value3) {
if (value != null) {
if (a0 !== value) {
if (a0 < value) {
if (value4 === a0) {
updaters.setLaunchPadPullTabMinimized(false);
}
binding = env0_4;
get = binding.get;
if (Reflect.apply(get, binding, []) == null) {
env0_4.set(value);
}
binding = env0_4;
value = 1 - a0 / (binding.get() ?? value);
launchPadPullTabStateBinding = launchPadPullTabState;
get = launchPadPullTabStateBinding.get;
offset = Reflect.apply(get, launchPadPullTabStateBinding, []).offset;
value = offset * value;
updatersBinding = updaters;
setLaunchPadPullTabPosition = updatersBinding.setLaunchPadPullTabPosition;
get = launchPadPullTabStateBinding.get;
value9 = Reflect.apply(get, launchPadPullTabStateBinding, []).position + value;
get = launchPadPullTabStateBinding.get;
offset = Reflect.apply(get, launchPadPullTabStateBinding, []).offset;
Reflect.apply(setLaunchPadPullTabPosition, updatersBinding, [value9, offset - value]);
} else {
updaters.setLaunchPadPullTabMinimized(true);
binding = env0_4;
get = binding.get;
if (Reflect.apply(get, binding, []) != null) {
env0_4.set(undefined);
}
value = environment.__proto__.__proto__;
value6 = a0 + CHAT_INPUT_HEIGHT + 2 * LAUNCH_PAD_MARGIN;
moduleValue = require(14283) /* metro dependency 14283: useWindowDimensionsSharedValueNative */;
height = moduleValue.getWindowDimensionsWorklet({ignoreKeyboard: true}).height;
launchPadPullTabStateBinding = launchPadPullTabState;
get = launchPadPullTabStateBinding.get;
value = height - (Reflect.apply(get, launchPadPullTabStateBinding,
[]).position + LAUNCH_PAD_PULL_TAB_HEIGHT + LAUNCH_PAD_PULL_TAB_SCALE_OFFSET);
if (value > value6) {
r9 = value4;
} else {
value = value6 - value;
r9 = value;
}
if (r9 > value4) {
updatersBinding = updaters;
setLaunchPadPullTabPosition = updatersBinding.setLaunchPadPullTabPosition;
launchPadPullTabStateBinding = launchPadPullTabState;
get = launchPadPullTabStateBinding.get;
value = Reflect.apply(get, launchPadPullTabStateBinding, []).position - r9;
get = launchPadPullTabStateBinding.get;
Reflect.apply(setLaunchPadPullTabPosition, updatersBinding, [value, Reflect.apply(get,
launchPadPullTabStateBinding,
[]).offset + r9]);
}
}
}
}
} else {
updaters.setLaunchPadPullTabMinimized(false);
}
}