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

442 lines
23 KiB
TypeScript

/* Metro module 8513; source: modules/user_profile/native/UserProfileCustomStatusBubble.tsx; dependencies: [57, 31, 27, 6816, 1881, 33, 4501, 697, 3829, 5475, 1423, 477, 4573, 6739, 8514, 8518, 4080, 8520, 6789, 1244, 5278, 10504, 2] */
function _fun67460(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#67460, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8698:6, offset: 0x01c23929, size: 415 bytes, params: 8, frame: 21
var object2;
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importDefault(57) /* metro dependency 57 */;
let value = importAll(31) /* metro dependency 31 */;
const value2 = require(27) /* metro dependency 27 */;
const env0_5 = value2.PixelRatio;
const env0_6 = value2.View;
const UserProfileThemeTypes = (require(6816) /* metro dependency 6816: Constants */).UserProfileThemeTypes;
const env0_7 = (require(1881) /* metro dependency 1881: EmojiConstants */).EMOJI_URL_BASE_SIZE;
const value3 = require(33) /* metro dependency 33 */;
const env0_8 = value3.jsx;
const env0_9 = value3.Fragment;
const env0_10 = value3.jsxs;
const env0_11 = (require(4501) /* metro dependency 4501: createStyles */).createStyles(_fun67465);
const env0_12 = {'textVariant': 'text-md/normal', 'emojiOnlyEmojiSize': 32, 'textMinWidth': 42,
'statusBubblePaddingHorizontal': 12, 'statusBubblePaddingVertical': 7};
object2 = {};
const PREVIEW = UserProfileThemeTypes.PREVIEW;
object2[PREVIEW] = {'textVariant': 'text-sm/normal', 'emojiOnlyEmojiSize': 26, 'textMinWidth': 53,
'statusBubblePaddingHorizontal': 10, 'statusBubblePaddingVertical': 6};
const env0_14 = (require(4501) /* metro dependency 4501: createStyles */).createStyles(function() {
return {container: {alignItems: 'center'}};
});
value = value.forwardRef(_fun67467);
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/user_profile/native/UserProfileCustomStatusBubble.tsx');
exports.default = value;
}
function getClampedMaxLines() { // fn#67461, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8698:254, offset: 0x01c23ac8, size: 45 bytes, params: 1, frame: 12
const fontScale = PixelRatio.getFontScale();
const Math = global.Math;
return Math.ceil(2 * fontScale);
}
function EmojiImage({emojiId, size, animated, style}) { // fn#67462, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8698:1594, offset: 0x01c23af5, size: 207 bytes, params: 2, frame: 23
animated = !(animated === undefined) && animated;
const AnimateEmoji = (require(3829) /* metro dependency 3829: UserSettings */).AnimateEmoji;
const value2 = AnimateEmoji.useSetting();
const FastImage = importDefault(5475) /* metro dependency 5475: FastImage */;
const items2 = [{height: size, width: size}, style];
const defaultImport2 = importDefault(1423) /* metro dependency 1423: AvatarUtils */;
const getEmojiURL = defaultImport2.getEmojiURL;
const object = {id: emojiId};
const Boolean = global.Boolean;
object.animated = Boolean(animated) && value2;
object.size = EMOJI_URL_BASE_SIZE;
return (
<FastImage
style={items2}
source={{uri: Reflect.apply(getEmojiURL, defaultImport2, [object])}}
resizeMode="contain"
/>
);
}
function TextStatusContent({text, emoji, textVariant, lineClamp, onTextLayout, lineHeight, isPlaceholderText}) { // fn#67463, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8698:1838, offset: 0x01c23bc4, size: 529 bytes, params: 2, frame: 28
var r0;
var r6;
var isAndroid2;
var object3;
var jsxRuntimeEnv0_9Binding;
var items2;
isPlaceholderText = !(isPlaceholderText === undefined) && isPlaceholderText;
const object4 = {paddingVertical: lineHeight / 10};
if (isPlaceholderText) {
isAndroid2 = (require(477) /* metro dependency 477: PlatformUtils */).isAndroid();
object3 = {};
if (isAndroid2) {
object3.fontFamily = 'ggsans-NormalItalic, NotoSans-NormalItalic';
r0 = object3;
} else {
object3.fontStyle = 'italic';
r0 = object3;
}
} else {
r0 = isPlaceholderText;
}
copyDataProperties(object4, r0, undefined);
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
if (emoji?.id != null) {
r6 = <><View><EmojiImage emojiId={emoji.id} size={0.9 * lineHeight} animated={emoji.animated} style={{marginBottom: 0.1 * -lineHeight}} /></View><View style={{width: 0.5 * lineHeight}} /></>;
} else if (emoji?.name != null) {
jsxRuntimeEnv0_9Binding = jsxRuntimeEnv0_9;
items2 = [emoji.name];
items2[1] = <View style={{width: 0.4 * lineHeight}} />;
r6 = <>{items2}</>;
} else {
r6 = null;
}
return (
<Text
variant={textVariant}
color="text-default"
lineClamp={lineClamp}
onTextLayout={onTextLayout}
style={object4}
>
{r6}
{text}
</Text>
);
}
function EmojiOnlyStatusContent({emoji, size}) { // fn#67464, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8698:2532, offset: 0x01c23dd5, size: 304 bytes, params: 2, frame: 23
var r8;
var defaultImport;
var getEmojiURL;
var object2;
const styles = useStyles();
const AnimateEmoji = (require(3829) /* metro dependency 3829: UserSettings */).AnimateEmoji;
if (emoji?.id != null) {
defaultImport = importDefault(1423) /* metro dependency 1423: AvatarUtils */;
getEmojiURL = defaultImport.getEmojiURL;
object2 = {};
object2.id = emoji.id;
object2.animated = global.Boolean(emoji?.animated) && AnimateEmoji.useSetting();
object2.size = EMOJI_URL_BASE_SIZE;
r8 = Reflect.apply(getEmojiURL, defaultImport, [object2]);
} else {
r8 = undefined;
}
return (
<View style={styles.container}>
{((Component) => <Component textEmojiStyle={{fontSize: size}} fastImageStyle={{width: size,
height: size}} src={r8} name={emoji?.name ?? ''} />)(importDefault(6739) /* metro dependency 6739: Emoji */)}
</View>
);
}
function _fun67465(a0) { // fn#67465, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8698:357, offset: 0x01c23f05, size: 482 bytes, params: 2, frame: 18
const object2 = {};
object2.container = {position: 'relative'};
const object8 = {};
let colors = (importDefault(697) /* metro dependency 697: native */).colors;
object8.backgroundColor = a0 ? colors.CUSTOM_STATUS_BUBBLE_BG : colors.BACKGROUND_SURFACE_HIGH;
colors = (importDefault(697) /* metro dependency 697: native */).colors;
object8.borderColor = a0 ? colors.BORDER_MUTED : colors.BORDER_SUBTLE;
object8.borderWidth = 1;
object2.bubble = object8;
const object9 = {'alignSelf': 'flex-start', 'alignItems': 'center', 'justifyContent': 'center'};
object9.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.lg;
let SHADOW_LOW = (importDefault(697) /* metro dependency 697: native */).shadows.SHADOW_LOW;
copyDataProperties(object9, SHADOW_LOW, undefined);
object9['top'] = -14;
object2.statusBubble = object9;
object2.statusBubbleMeasureable = {'position': 'absolute', 'top': 0, 'left': 0, 'opacity': 0};
const object10 = {'position': 'absolute', 'top': -30, 'width': 12, 'height': 12};
object10.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.round;
SHADOW_LOW = (importDefault(697) /* metro dependency 697: native */).shadows.SHADOW_LOW;
copyDataProperties(object10, SHADOW_LOW, -14);
object2.smallCircle = object10;
const object11 = {'position': 'absolute', 'top': -8, 'left': 12, 'width': 20, 'height': 20};
object11.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.round;
SHADOW_LOW = (importDefault(697) /* metro dependency 697: native */).shadows.SHADOW_LOW;
copyDataProperties(object11, SHADOW_LOW, -14);
object2.largeCircle = object11;
const object12 = {'position': 'absolute', 'top': -7.5, 'left': 13, 'width': 16, 'height': 16, 'borderWidth': 0};
object12.borderTopLeftRadius = (importDefault(697) /* metro dependency 697: native */).radii.round;
object12.borderTopRightRadius = (importDefault(697) /* metro dependency 697: native */).radii.round;
object2.largeCircleInner = object12;
object2.addStatusIconSpacer = {width: 6};
object2.statusBubbleLeftAligned = {alignItems: 'flex-start'};
return object2;
}
function _fun67467({customStatusActivity, themeType, hasCustomProfileTheme, editEnabled, showFullStatus, onPressTruncatedStatus, style, emojiOnlyStyle, previewEmoji, previewText, placeholderText, prompt}, a1) { // fn#67467, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8698:2938, offset: 0x01c240f9, size: 1935 bytes, params: 3, frame: 41
var name;
var r9;
var r17;
var closure;
var closure2;
var object5;
var bubble;
var items4;
var object6;
const PressableOpacity = (require(5278) /* metro dependency 5278: Pressables */).PressableOpacity;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
var formatToPlainString;
var UpF5Qa;
var value27;
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
var object8;
var isAndroid2;
var object9;
const CirclePlusIcon = (require(10504) /* metro dependency 10504: CirclePlusIcon */).CirclePlusIcon;
var moduleValue4;
const r10 = editEnabled !== undefined && editEnabled;
const env0_0 = showFullStatus !== undefined && showFullStatus;
const styles = useStyles(hasCustomProfileTheme);
const env0_3 = styles;
let r0 = themeType != null ? env0_13[themeType] : undefined;
r0 = r0 ?? env0_12;
const textVariant = r0.textVariant;
const env0_4 = textVariant;
const emojiOnlyEmojiSize = r0.emojiOnlyEmojiSize;
const textMinWidth = r0.textMinWidth;
const statusBubblePaddingHorizontal = r0.statusBubblePaddingHorizontal;
const statusBubblePaddingVertical = r0.statusBubblePaddingVertical;
const userProfileAnalyticsContextModule = require(8514) /* metro dependency 8514: UserProfileAnalyticsContext */;
const useUserProfileAnalyticsContext = userProfileAnalyticsContextModule.useUserProfileAnalyticsContext;
const env0_6 = Reflect.apply(useUserProfileAnalyticsContext, userProfileAnalyticsContextModule,
[]).trackUserProfileAction;
let r27 = previewText === undefined ? customStatusActivity?.state : previewText !== '' ? previewText : customStatusActivity?.state;
r0 = r27 != null && r27 !== '';
let r25 = previewEmoji !== undefined ? previewEmoji : customStatusActivity?.emoji;
const value7 = r25 != null;
const r22 = value7 && !r0;
let r19 = !r0 && !value7 && placeholderText !== undefined && placeholderText !== '';
r27 = r19 ? placeholderText : r27;
const r13 = r27 != null && r27 !== '';
r0 = !r0 ? value7 : r0;
r0 = !r0 ? !r10 && r19 : r0;
const r11 = !r0 && r10;
var [property, env0_12] = env0_3(env0_4.useState(false), 2);
let object = {};
object.minWidth = r13 ? textMinWidth : 0;
object.minHeight = r22 ? emojiOnlyEmojiSize + 2 * statusBubblePaddingVertical : 0;
object.paddingVertical = r13 || r11 ? statusBubblePaddingVertical : 0;
object.paddingHorizontal = statusBubblePaddingHorizontal;
const object10 = {top: statusBubblePaddingVertical, bottom: statusBubblePaddingVertical,
left: statusBubblePaddingHorizontal, right: statusBubblePaddingHorizontal};
const binding = env0_4;
const value21 = binding.useRef(null);
binding.useImperativeHandle(a1, _fun67468);
const value22 = (require(8518) /* metro dependency 8518: useScaledTextLineHeightAndroid */).useScaledTextLineHeight(textVariant);
if (r0) {
closure = onPress_67469;
closure2 = renderStatusContent;
object5 = {};
name = r25?.name;
object5.text = [name, r27].filter(function(a0) {
return a0 != null;
}).join(' ');
var viewProps = {style: [style, r22 ? emojiOnlyStyle : undefined]};
bubble = styles.bubble;
items4 = [<View style={[bubble, styles.smallCircle]} />];
bubble = styles.bubble;
items4[1] = <View style={[bubble, styles.largeCircle]} />;
items4[2] = _fun67472();
object6 = {};
bubble = styles.bubble;
object6.style = [bubble, styles.statusBubble, object, !r22 && styles.statusBubbleLeftAligned];
object6.ref = value21;
bubble = styles.bubble;
object = [<View style={[bubble, styles.largeCircleInner]} />];
if (r11) {
r17 = r19 ? placeholderText : intl.string((require(1244) /* metro dependency 1244: indexNative */).t.Vq4UmS);
var pressableOpacityProps = {accessibilityRole: 'button',
accessibilityLabel: intl.string((require(1244) /* metro dependency 1244: indexNative */).t['zrpF/b']),
accessibilityHint: r19 ? intl.formatToPlainString((require(1244) /* metro dependency 1244: indexNative */).t.ioWOMP,
{prompt: placeholderText}) : undefined, onPress: closure, hitSlop: object10};
var textProps = {variant: r19 ? 'text-md/normal' : 'text-md/medium',
color: 'control-secondary-text-default',
lineClamp: getClampedMaxLines()};
object8 = {paddingVertical: value22 / 10};
if (r19) {
isAndroid2 = (require(477) /* metro dependency 477: PlatformUtils */).isAndroid();
object9 = {};
if (isAndroid2) {
object9.fontFamily = 'ggsans-NormalItalic, NotoSans-NormalItalic';
r19 = object9;
} else {
object9.fontStyle = 'italic';
r19 = object9;
}
}
copyDataProperties(object8, r19, undefined);
textProps.style = object8;
var circlePlusIconProps = {color: (importDefault(697) /* metro dependency 697: native */).colors.CONTROL_SECONDARY_TEXT_DEFAULT,
size: 'xs'};
moduleValue4 = require(477) /* metro dependency 477: PlatformUtils */;
circlePlusIconProps.style = moduleValue4.isAndroid() ? {marginBottom: 0.1 * -value22} : undefined;
r9 = <PressableOpacity {...pressableOpacityProps}><Text {...textProps}><View><CirclePlusIcon {...circlePlusIconProps} /></View><View style={styles.addStatusIconSpacer} />{r17}</Text></PressableOpacity>;
} else if (r10) {
r9 = <PressableOpacity accessibilityRole="button" accessibilityLabel={intl.string((require(1244) /* metro dependency 1244: indexNative */).t.QdHxos)} accessibilityValue={object5} onPress={closure} hitSlop={object10}>{closure2()}</PressableOpacity>;
} else if (onPressTruncatedStatus == null) {
r9 = closure2();
} else if (property) {
if (r19) {
r9 = closure2();
} else {
formatToPlainString = intl.formatToPlainString;
UpF5Qa = (require(1244) /* metro dependency 1244: indexNative */).t.UpF5Qa;
name = r25?.name;
value27 = '';
r25 = r27 ?? value27;
r9 = <PressableOpacity accessibilityRole="button" accessibilityLabel={Reflect.apply(formatToPlainString,
intl,
[UpF5Qa, {emoji: name ?? value27,
status: r25}])} onPress={onPressTruncatedStatus} hitSlop={object10}>{closure2()}</PressableOpacity>;
}
} else {
r9 = closure2();
}
object[1] = r9;
items4[3] = <View {...object6}>{object}</View>;
return (
<View {...viewProps}>
{items4}
</View>
);
}
if (r11) {
closure = onPress_67469;
closure2 = renderStatusContent;
object5 = {};
name = r25?.name;
object5.text = [name, r27].filter(function(a0) {
return a0 != null;
}).join(' ');
var viewProps = {style: [style, r22 ? emojiOnlyStyle : undefined]};
bubble = styles.bubble;
items4 = [<View style={[bubble, styles.smallCircle]} />];
bubble = styles.bubble;
items4[1] = <View style={[bubble, styles.largeCircle]} />;
items4[2] = _fun67472();
object6 = {};
bubble = styles.bubble;
object6.style = [bubble, styles.statusBubble, object, !r22 && styles.statusBubbleLeftAligned];
object6.ref = value21;
bubble = styles.bubble;
object = [<View style={[bubble, styles.largeCircleInner]} />];
if (r11) {
r17 = r19 ? placeholderText : intl.string((require(1244) /* metro dependency 1244: indexNative */).t.Vq4UmS);
var pressableOpacityProps = {accessibilityRole: 'button',
accessibilityLabel: intl.string((require(1244) /* metro dependency 1244: indexNative */).t['zrpF/b']),
accessibilityHint: r19 ? intl.formatToPlainString((require(1244) /* metro dependency 1244: indexNative */).t.ioWOMP,
{prompt: placeholderText}) : undefined, onPress: closure, hitSlop: object10};
var textProps = {variant: r19 ? 'text-md/normal' : 'text-md/medium',
color: 'control-secondary-text-default',
lineClamp: getClampedMaxLines()};
object8 = {paddingVertical: value22 / 10};
if (r19) {
isAndroid2 = (require(477) /* metro dependency 477: PlatformUtils */).isAndroid();
object9 = {};
if (isAndroid2) {
object9.fontFamily = 'ggsans-NormalItalic, NotoSans-NormalItalic';
r19 = object9;
} else {
object9.fontStyle = 'italic';
r19 = object9;
}
}
copyDataProperties(object8, r19, undefined);
textProps.style = object8;
var circlePlusIconProps = {color: (importDefault(697) /* metro dependency 697: native */).colors.CONTROL_SECONDARY_TEXT_DEFAULT,
size: 'xs'};
moduleValue4 = require(477) /* metro dependency 477: PlatformUtils */;
circlePlusIconProps.style = moduleValue4.isAndroid() ? {marginBottom: 0.1 * -value22} : undefined;
r9 = <PressableOpacity {...pressableOpacityProps}><Text {...textProps}><View><CirclePlusIcon {...circlePlusIconProps} /></View><View style={styles.addStatusIconSpacer} />{r17}</Text></PressableOpacity>;
} else if (r10) {
r9 = <PressableOpacity accessibilityRole="button" accessibilityLabel={intl.string((require(1244) /* metro dependency 1244: indexNative */).t.QdHxos)} accessibilityValue={object5} onPress={closure} hitSlop={object10}>{closure2()}</PressableOpacity>;
} else if (onPressTruncatedStatus == null) {
r9 = closure2();
} else if (property) {
if (r19) {
r9 = closure2();
} else {
formatToPlainString = intl.formatToPlainString;
UpF5Qa = (require(1244) /* metro dependency 1244: indexNative */).t.UpF5Qa;
name = r25?.name;
value27 = '';
r25 = r27 ?? value27;
r9 = <PressableOpacity accessibilityRole="button" accessibilityLabel={Reflect.apply(formatToPlainString,
intl,
[UpF5Qa, {emoji: name ?? value27,
status: r25}])} onPress={onPressTruncatedStatus} hitSlop={object10}>{closure2()}</PressableOpacity>;
}
} else {
r9 = closure2();
}
object[1] = r9;
items4[3] = <View {...object6}>{object}</View>;
return (
<View {...viewProps}>
{items4}
</View>
);
}
return null;
}
function _fun67468() { // fn#67468, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8698:3859, offset: 0x01c24888, size: 14 bytes, params: 1, frame: 1
return env0_14.current;
}
function onPress_67469() { // fn#67469, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8698:3972, offset: 0x01c24896, size: 130 bytes, params: 1, frame: 16
trackUserProfileAction({action: 'PRESS_EDIT_CUSTOM_STATUS'});
(importDefault(4080) /* metro dependency 4080: ActionSheetActionCreators */).hideActionSheet();
const customStatusUtilsModule = require(8520) /* metro dependency 8520: CustomStatusUtils */;
const openEditCustomStatusModal = customStatusUtilsModule.openEditCustomStatusModal;
const USER_PROFILE_CUSTOM_STATUS_BUBBLE = (importDefault(6789) /* metro dependency 6789: AnalyticsLocation */).USER_PROFILE_CUSTOM_STATUS_BUBBLE;
Reflect.apply(openEditCustomStatusModal, customStatusUtilsModule,
[{analyticsLocations: [USER_PROFILE_CUSTOM_STATUS_BUBBLE], prompt: prompt}]);
}
function renderStatusContent() { // fn#67470, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8698:4175, offset: 0x01c24918, size: 148 bytes, params: 1, frame: 18
return env0_11 ? <TextStatusContent text={env0_10} isPlaceholderText={env0_9} emoji={env0_7} textVariant={textVariant} lineClamp={env0_0 ? undefined : getClampedMaxLines()} lineHeight={env0_15} /> : env0_8 ? <EmojiOnlyStatusContent emoji={env0_7} size={emojiOnlyEmojiSize} /> : undefined;
}
function _fun67472() { // fn#67472, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8698:4546, offset: 0x01c249ac, size: 199 bytes, params: 1, frame: 17
var environment;
var value2;
if (onPressTruncatedStatus != null) {
if (env0_0) {
return undefined;
}
if (env0_11) {
value2 = environment.__proto__;
return (
<View style={[styles.bubble, styles.statusBubble, env0_13, styles.statusBubbleMeasureable]}>
<TextStatusContent
text={env0_10}
isPlaceholderText={env0_9}
emoji={env0_7}
textVariant={textVariant}
onTextLayout={onTextLayout}
lineHeight={env0_15}
/>
</View>
);
}
}
}
function onTextLayout({nativeEvent}) { // fn#67473, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8698:4733, offset: 0x01c24a73, size: 51 bytes, params: 2, frame: 12
env1_12(nativeEvent.lines.length > getClampedMaxLines());
}