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

279 lines
22 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] */
import Native from '../../../external/discord_common/js/packages/tokens/native.tsx'; /* Metro dependency 697 */
import ReanimatedRexport from '../../reanimated/ReanimatedRexport.tsx'; /* Metro dependency 4017 */
import UseWindowDimensionsSharedValueNative from '../../screen/useWindowDimensionsSharedValue.native.tsx'; /* Metro dependency 14283 */
import UseAnimatedKeyboardHeight from '../../keyboard/native/useAnimatedKeyboardHeight.tsx'; /* Metro dependency 15319 */
import UseLaunchPadPullTabMinimized from './useLaunchPadPullTabMinimized.tsx'; /* Metro dependency 15321 */
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 JsxRuntimeModule from '../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
import * as ReanimatedRexportModule from '../../reanimated/ReanimatedRexport.tsx'; /* Metro dependency 4017 */
import * as CreateStylesModule from '../../../design/components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */
import * as SpringModule from '../../../design/animation/reanimated/spring/spring.tsx'; /* Metro dependency 4577 */
import * as LaunchPadConstantsModule from './LaunchPadConstants.tsx'; /* Metro dependency 11324 */
import * as ChatInputConstantsModule from '../../chat_input/native/ChatInputConstants.tsx'; /* Metro dependency 11529 */
import * as ChannelListMagnifyingGlassIconModule from '../../../design/components/Icon/native/redesign/generated/ChannelListMagnifyingGlassIcon.tsx'; /* Metro dependency 12376 */
import * as UseWindowDimensionsSharedValueNativeModule from '../../screen/useWindowDimensionsSharedValue.native.tsx'; /* Metro dependency 14283 */
import * as UseTabBarStylesModule from '../../main_tabs_v2/native/shared_components/tab_bar/useTabBarStyles.tsx'; /* Metro dependency 14937 */
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
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ReactModule;
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 LAUNCH_PAD_PULL_TAB_WIDTH = LaunchPadConstantsModule.LAUNCH_PAD_PULL_TAB_WIDTH;
const createStyles = CreateStylesModule.createStyles;
object = {};
const object2 = {'position': 'absolute', 'right': 0};
object2.width = LAUNCH_PAD_PULL_TAB_WIDTH;
object2.height = LAUNCH_PAD_PULL_TAB_HEIGHT;
object2.borderTopLeftRadius = LAUNCH_PAD_PULL_TAB_BORDER_RADIUS;
object2.borderBottomLeftRadius = LAUNCH_PAD_PULL_TAB_BORDER_RADIUS;
object2.borderWidth = 1;
object2.borderTopWidth = 1;
object2.borderColor = 'rgba(0, 0, 0, 0.08)';
const SHADOW_MOBILE_NAVIGATOR_X = (Native).shadows.SHADOW_MOBILE_NAVIGATOR_X;
copyDataProperties(object2, SHADOW_MOBILE_NAVIGATOR_X, undefined);
object.pullTab = object2;
object.pullTabButton = {width: LAUNCH_PAD_PULL_TAB_WIDTH, height: LAUNCH_PAD_PULL_TAB_HEIGHT,
justifyContent: 'center', alignItems: 'center'};
const BACKGROUND_BASE_LOW = (Native).colors.BACKGROUND_BASE_LOW;
object.launchPad = {color: BACKGROUND_BASE_LOW};
const env0_14 = Reflect.apply(createStyles, CreateStylesModule, [object]);
object = {code: 'function LaunchPadPullTabTsx1(){const{keyboardHeight}=this.__closure;return keyboardHeight.get();}'};
object = {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);}}}'};
object = {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);
(FileImportTrackerModule).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 object2;
const styles = useStyles();
const value2 = (UseTabBarStylesModule).useTabBarStyles();
const value3 = (UseWindowDimensionsSharedValueNative)();
const color = styles.launchPad.color;
const backgroundColor = value2.tabBar.backgroundColor;
const value4 = (UseLaunchPadPullTabMinimized)({launchPadSharedState: launchPadSharedState,
launchPadPullTabState: launchPadPullTabState});
const useAnimatedStyle = ReanimatedRexportModule.useAnimatedStyle;
const LaunchPadPullTabF2 = LaunchPadPullTabF;
object2 = {isMinimized: value4, gestureState: gestureState};
object2.LAUNCH_PAD_PULL_TAB_MINIMIZED_OFFSET = LAUNCH_PAD_PULL_TAB_MINIMIZED_OFFSET;
object2.interpolate = ReanimatedRexportModule.interpolate;
object2.launchPadSharedState = launchPadSharedState;
object2.windowDimensions = value3;
object2.launchPadPullTabState = launchPadPullTabState;
object2.LAUNCH_PAD_PULL_TAB_BORDER_RADIUS = LAUNCH_PAD_PULL_TAB_BORDER_RADIUS;
object2.interpolateColor = ReanimatedRexportModule.interpolateColor;
object2.LAUNCH_PAD_MARGIN = LAUNCH_PAD_MARGIN;
object2.backgroundColorTabBar = backgroundColor;
object2.backgroundColorLaunchPad = color;
object2.withSpring = (require(4577) /* metro dependency 4577: spring */).withSpring;
object2.LAUNCH_PAD_SPRING_CONFIG = LAUNCH_PAD_SPRING_CONFIG;
LaunchPadPullTabF2.__closure = object2;
LaunchPadPullTabF2.__workletHash = 17461120174889;
LaunchPadPullTabF2.__initData = env0_17;
const value5 = Reflect.apply(useAnimatedStyle, ReanimatedRexportModule, [LaunchPadPullTabF2]);
useLaunchPadPullTabKeyboardListener({launchPadSharedState: launchPadSharedState,
launchPadPullTabState: launchPadPullTabState, updaters: updaters});
const View = (ReanimatedRexport).View;
const items2 = [styles.pullTab, value5];
const object = {accessibilityRole: 'button'};
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
object.accessibilityLabel = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.yTnIfb);
object.hitSlop = LAUNCH_PAD_PULL_TAB_HIT_SLOP;
object.style = styles.pullTabButton;
object.onTouchStart = function() {
updaters.setLaunchPadPullTabScale(LAUNCH_PAD_PULL_TAB_SCALE_FACTOR);
};
object.onPress = importDefault(15264) /* metro dependency 15264: showLaunchPad */;
const ChannelListMagnifyingGlassIcon = (ChannelListMagnifyingGlassIconModule).ChannelListMagnifyingGlassIcon;
return (
<View style={items2}>
<Pressable {...object}>
<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 = LaunchPadConstantsModule.LAUNCH_PAD_PULL_TAB_HIT_SLOP;
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 = LaunchPadConstantsModule.LAUNCH_PAD_MARGIN;
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 = LaunchPadConstantsModule.LAUNCH_PAD_MARGIN;
r2 = Reflect.apply(interpolate, moduleValue, [value4, [0, 1], [0, -(binding.get().width - 16)]]);
}
const r12 = launchPadSharedState.get() > 0.9 ? -LaunchPadConstantsModule.LAUNCH_PAD_MARGIN.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 = LaunchPadConstantsModule.LAUNCH_PAD_MARGIN;
get = binding.get;
const value17 = Reflect.apply(interpolateColor, reanimatedRexportModule, [value15 * Reflect.apply(get, binding,
[]).width, [0, LAUNCH_PAD_MARGIN], [backgroundColor, color]]);
const object = {};
let withSpring = SpringModule.withSpring;
const items2 = [{translateX: Reflect.apply(withSpring, SpringModule, [r12, LAUNCH_PAD_SPRING_CONFIG])}];
const object3 = {};
object3.translateY = SpringModule.withSpring(position, LAUNCH_PAD_SPRING_CONFIG);
items2[1] = object3;
withSpring = SpringModule.withSpring;
launchPadPullTabStateBinding = launchPadPullTabState;
get = launchPadPullTabStateBinding.get;
items2[2] = {scale: Reflect.apply(withSpring, SpringModule, [Reflect.apply(get, launchPadPullTabStateBinding,
[]).scale, LAUNCH_PAD_SPRING_CONFIG])};
object.transform = items2;
object.borderTopRightRadius = SpringModule.withSpring(LAUNCH_PAD_PULL_TAB_BORDER_RADIUS2, LAUNCH_PAD_SPRING_CONFIG);
object.borderBottomRightRadius = SpringModule.withSpring(LAUNCH_PAD_PULL_TAB_BORDER_RADIUS2,
LAUNCH_PAD_SPRING_CONFIG);
object.backgroundColor = value17;
return object;
}
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
const value2 = (UseAnimatedKeyboardHeight)();
const value3 = (ReanimatedRexportModule).useSharedValue(undefined);
const useAnimatedReaction = ReanimatedRexportModule.useAnimatedReaction;
const useLaunchPadPullTabKeyboardListener_2 = useLaunchPadPullTabKeyboardListener_;
useLaunchPadPullTabKeyboardListener_2.__closure = {keyboardHeight: value2};
useLaunchPadPullTabKeyboardListener_2.__workletHash = 14545769097570;
useLaunchPadPullTabKeyboardListener_2.__initData = env1_15;
const useLaunchPadPullTabKeyboardListenerS2 = useLaunchPadPullTabKeyboardListenerS;
object = {launchPadSharedState: launchPadSharedState, updaters: updaters, keyboardHeightOpened: value3,
launchPadPullTabState: launchPadPullTabState};
object.CHAT_INPUT_HEIGHT = CHAT_INPUT_HEIGHT;
object.LAUNCH_PAD_MARGIN = LAUNCH_PAD_MARGIN;
const getWindowDimensionsWorklet = (UseWindowDimensionsSharedValueNativeModule).getWindowDimensionsWorklet;
object.getWindowDimensionsWorklet = getWindowDimensionsWorklet;
object.LAUNCH_PAD_PULL_TAB_HEIGHT = LAUNCH_PAD_PULL_TAB_HEIGHT;
object.LAUNCH_PAD_PULL_TAB_SCALE_OFFSET = LAUNCH_PAD_PULL_TAB_SCALE_OFFSET;
useLaunchPadPullTabKeyboardListenerS2.__closure = object;
useLaunchPadPullTabKeyboardListenerS2.__workletHash = 8060927175361;
useLaunchPadPullTabKeyboardListenerS2.__initData = env1_16;
Reflect.apply(useAnimatedReaction, ReanimatedRexportModule, [useLaunchPadPullTabKeyboardListener_2,
useLaunchPadPullTabKeyboardListenerS2]);
function useLaunchPadPullTabKeyboardListener_() { // fn#117118, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15517:5700, owner: LaunchPadPullTab.useLaunchPadPullTabKeyboardListener._, offset: 0x010bf756, size: 18 bytes, params: 1, frame: 9
return ReactNativeModule.Pressable.get();
}
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 = LaunchPadConstantsModule.LAUNCH_PAD_MARGIN;
get = binding.get;
if (Reflect.apply(get, binding, []) == null) {
LaunchPadConstantsModule.LAUNCH_PAD_MARGIN.set(value);
}
binding = LaunchPadConstantsModule.LAUNCH_PAD_MARGIN;
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 = LaunchPadConstantsModule.LAUNCH_PAD_MARGIN;
get = binding.get;
if (Reflect.apply(get, binding, []) != null) {
LaunchPadConstantsModule.LAUNCH_PAD_MARGIN.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);
}
}
}
}
}
global.__d(_fun117114, 15320, [31, 27, 11324, 11529, 33, 4501, 697, 15319, 4017, 14283, 14937, 15321, 4577, 1244,
15264, 12376,
2]) /* metro module 15320, dependencies: [31, 27, 11324, 11529, 33, 4501, 697, 15319, 4017, 14283, 14937, 15321, 4577, 1244, 15264, 12376, 2] */;