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

377 lines
21 KiB
TypeScript

/* Metro module 10490; source: modules/user_profile/native/UserProfileContactButtons.tsx; dependencies: [31, 27, 3793, 661, 33, 4501, 697, 4578, 6771, 8514, 10341, 566, 3995, 10491, 4050, 1244, 8796, 8783, 8776, 4080, 5080, 4603, 10493, 8341, 6682, 8850, 9708, 2] */
function _fun81166(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#81166, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10676:6, offset: 0x01e9c624, size: 352 bytes, params: 8, frame: 24
var object2;
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
importAll(31) /* metro dependency 31 */;
const env0_3 = (require(27) /* metro dependency 27 */).View;
const relationshipStore = importDefault(3793) /* metro dependency 3793: RelationshipStore */;
const env0_5 = (require(661) /* metro dependency 661: Constants */).RelationshipTypes;
let value = require(33) /* metro dependency 33 */;
const env0_6 = value.jsx;
const env0_7 = value.jsxs;
value = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = value.createStyles;
object2 = {};
let PX_12 = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
object2.threeButtonLayout = {'flexDirection': 'row', 'alignItems': 'center', gap: PX_12};
object2.flexGrow = {flex: 1};
PX_12 = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
object2.iconButtonGroup = {flexDirection: 'row', gap: PX_12};
const env0_8 = Reflect.apply(createStyles, value, [object2]);
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/user_profile/native/UserProfileContactButtons.tsx');
exports.default = UserProfileContactButtons;
}
function FlatFriendButton(a0) { // fn#81167, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10676:374, offset: 0x01e9c784, size: 268 bytes, params: 2, frame: 21
var r10;
const icon = a0.icon;
const label = a0.label;
const hasCustomProfileTheme = a0.hasCustomProfileTheme;
const isPending = a0.isPending;
const object2 = {'icon': 0, 'label': 0, 'hasCustomProfileTheme': 0, 'isPending': 0};
silentSetPrototypeOf(object2, null, undefined);
const value = copyDataProperties({}, a0, object2, r10);
const r5 = isPending === false || hasCustomProfileTheme ? 'primary' : 'secondary';
r10 = r5 === 'primary' ? (importDefault(697) /* metro dependency 697: native */).colors.WHITE : (importDefault(697) /* metro dependency 697: native */).colors.CONTROL_SECONDARY_TEXT_DEFAULT;
const Button = (require(4578) /* metro dependency 4578: ButtonNative */).Button;
return (
<Button
text={label}
icon={((Component) => <Component color={r10} size="xs" />)(icon)}
accessibilityLabel={label}
variant={r5}
size="md"
grow
{...value}
/>
);
}
function FriendRequestButton({user, hasCustomProfileTheme, location, ButtonComponent}) { // fn#81168, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10676:698, offset: 0x01e9c890, size: 575 bytes, params: 2, frame: 23
const newestAnalyticsLocation = (importDefault(6771) /* metro dependency 6771: useAnalyticsLocations */)().newestAnalyticsLocation;
const userProfileAnalyticsContextModule = require(8514) /* metro dependency 8514: UserProfileAnalyticsContext */;
const useUserProfileAnalyticsContext = userProfileAnalyticsContextModule.useUserProfileAnalyticsContext;
const env0_1 = Reflect.apply(useUserProfileAnalyticsContext, userProfileAnalyticsContextModule,
[]).trackUserProfileAction;
({}).location = location ?? newestAnalyticsLocation;
const value2 = (require(10341) /* metro dependency 10341: GameRelationshipStoreHooks */).useGameFriendsForUser(user.id);
const relationshipType = (require(566) /* metro dependency 566: flux */).useStateFromStores([RelationshipStore],
function() {
return RelationshipStore.getRelationshipType(user.id);
});
const env0_4 = (importDefault(3995) /* metro dependency 3995: UserUtils */).useName(user);
const FRIEND = RelationshipTypes.FRIEND;
if (relationshipType === FRIEND) {
return null;
}
const BLOCKED = RelationshipTypes.BLOCKED;
if (relationshipType === BLOCKED) {
return null;
}
if (value2.length > 0) {
return null;
}
const PENDING_INCOMING = RelationshipTypes.PENDING_INCOMING;
if (relationshipType === PENDING_INCOMING) {
return null;
}
const PENDING_OUTGOING = RelationshipTypes.PENDING_OUTGOING;
const value3 = relationshipType === PENDING_OUTGOING;
const r10 = value3 ? (require(10491) /* metro dependency 10491: UserClockIcon */).UserClockIcon : (require(4050) /* metro dependency 4050: UserPlusIcon */).UserPlusIcon;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
let string = intl.string;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
const r9 = value3 ? Reflect.apply(string, intl, [t['fMm5q/']]) : Reflect.apply(string, intl, [t['7815ae']]);
string = intl.string;
return (
<ButtonComponent
icon={r10}
label={r9}
accessibilityHint={value3 ? Reflect.apply(string, intl, [t.H0Ql7N]) : Reflect.apply(string, intl,
[t.gc9aSx])}
onPress={onPress_81170}
hasCustomProfileTheme={hasCustomProfileTheme}
isPending={value3}
/>
);
}
function UserProfileContactButtons({user, disableMessage, disableCalls, location, hasCustomProfileTheme, style}) { // fn#81172, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10676:1866, offset: 0x01e9cbe0, size: 1683 bytes, params: 2, frame: 47
var r24;
var view;
var object3;
const Button = (require(4578) /* metro dependency 4578: ButtonNative */).Button;
var object4;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
var string;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
var zROXEV;
var formatToPlainString;
var zFfSFQ;
var object6;
var items2;
var object8;
var JJogjm;
var items4;
const IconButton = (require(8341) /* metro dependency 8341: IconButtonNative */).IconButton;
var object9;
var items5;
const userProfileAnalyticsContextModule = require(8514) /* metro dependency 8514: UserProfileAnalyticsContext */;
const useUserProfileAnalyticsContext = userProfileAnalyticsContextModule.useUserProfileAnalyticsContext;
const env0_1 = Reflect.apply(useUserProfileAnalyticsContext, userProfileAnalyticsContextModule,
[]).trackUserProfileAction;
const styles = useStyles();
const fluxModule = require(566) /* metro dependency 566: flux */;
const useStateFromStores = fluxModule.useStateFromStores;
let object = [RelationshipStore];
const relationshipType = Reflect.apply(useStateFromStores, fluxModule, [object, function() {
return RelationshipStore.getRelationshipType(user.id);
}]);
const value2 = (require(10341) /* metro dependency 10341: GameRelationshipStoreHooks */).useGameFriendsForUser(user.id);
const closure = function() {
trackUserProfileAction({action: 'SEND_MESSAGE'});
if (closeUserProfile != null) {
closeUserProfile();
}
importDefault(dependencyMap[20]).popAll();
importDefault(dependencyMap[21]).openPrivateChannel({recipientIds: user.id});
};
const {handlePress, text, inCall,
accessibilityHint} = (importDefault(10493) /* metro dependency 10493: usePrivateChannelCall */)(user.id, false,
function() {
trackUserProfileAction({action: 'VOICE_CALL'});
if (closeUserProfile != null) {
closeUserProfile();
}
});
const r18 = hasCustomProfileTheme ? 'primary' : 'secondary';
const colors = (importDefault(697) /* metro dependency 697: native */).colors;
const r27 = hasCustomProfileTheme ? colors.WHITE : colors.CONTROL_SECONDARY_TEXT_DEFAULT;
const FRIEND = RelationshipTypes.FRIEND;
if (relationshipType === FRIEND) {
object = {};
object3 = {flexDirection: 'row'};
object3.gap = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
object.style = [object3, style];
object4 = {};
string = intl.string;
zROXEV = t.zROXEV;
object4.text = Reflect.apply(string, intl, [zROXEV]);
object4.icon = ((ChatIcon) => <ChatIcon color={r27} size="xs" />)((require(6682) /* metro dependency 6682: ChatIcon */).ChatIcon);
string = intl.string;
zROXEV = t.zROXEV;
object4.accessibilityLabel = Reflect.apply(string, intl, [zROXEV]);
formatToPlainString = intl.formatToPlainString;
zFfSFQ = t.zFfSFQ;
object6 = {};
object6.name = (importDefault(3995) /* metro dependency 3995: UserUtils */).getName(user);
object4.accessibilityHint = Reflect.apply(formatToPlainString, intl, [zFfSFQ, object6]);
object4.variant = r18;
object4.size = 'md';
object4.grow = true;
object4.onPress = closure;
object4.disabled = disableMessage;
items2 = [<View style={{flex: 1}}><Button {...object4} /></View>];
object8 = {};
string = intl.string;
JJogjm = t.JJogjm;
object8.text = Reflect.apply(string, intl, [JJogjm]);
object8.icon = ((PhoneCallIcon) => <PhoneCallIcon color={r27} size="xs" />)((require(8850) /* metro dependency 8850: PhoneCallIcon */).PhoneCallIcon);
string = intl.string;
JJogjm = t.JJogjm;
object8.accessibilityLabel = Reflect.apply(string, intl, [JJogjm]);
object8.accessibilityHint = accessibilityHint ?? intl.string((require(1244) /* metro dependency 1244: indexNative */).t.focH1t);
object8.variant = r18;
object8.size = 'md';
object8.grow = true;
r24 = inCall ? handlePress : _fun81178;
object8.onPress = r24;
r24 = disableCalls || text == null;
object8.disabled = r24;
items2[1] = <View style={{flex: 1}}><Button {...object8} /></View>;
view = <View {...object} key="two-button-group">{items2}</View>;
} else if (relationshipType === RelationshipTypes.BLOCKED) {
object = {};
object3 = {flexDirection: 'row'};
object3.gap = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
object.style = [object3, style];
object4 = {};
string = intl.string;
zROXEV = t.zROXEV;
object4.text = Reflect.apply(string, intl, [zROXEV]);
object4.icon = ((ChatIcon) => <ChatIcon color={r27} size="xs" />)((require(6682) /* metro dependency 6682: ChatIcon */).ChatIcon);
string = intl.string;
zROXEV = t.zROXEV;
object4.accessibilityLabel = Reflect.apply(string, intl, [zROXEV]);
formatToPlainString = intl.formatToPlainString;
zFfSFQ = t.zFfSFQ;
object6 = {};
object6.name = (importDefault(3995) /* metro dependency 3995: UserUtils */).getName(user);
object4.accessibilityHint = Reflect.apply(formatToPlainString, intl, [zFfSFQ, object6]);
object4.variant = r18;
object4.size = 'md';
object4.grow = true;
object4.onPress = closure;
object4.disabled = disableMessage;
items2 = [<View style={{flex: 1}}><Button {...object4} /></View>];
object8 = {};
string = intl.string;
JJogjm = t.JJogjm;
object8.text = Reflect.apply(string, intl, [JJogjm]);
object8.icon = ((PhoneCallIcon) => <PhoneCallIcon color={r27} size="xs" />)((require(8850) /* metro dependency 8850: PhoneCallIcon */).PhoneCallIcon);
string = intl.string;
JJogjm = t.JJogjm;
object8.accessibilityLabel = Reflect.apply(string, intl, [JJogjm]);
object8.accessibilityHint = accessibilityHint ?? intl.string((require(1244) /* metro dependency 1244: indexNative */).t.focH1t);
object8.variant = r18;
object8.size = 'md';
object8.grow = true;
r24 = inCall ? handlePress : _fun81178;
object8.onPress = r24;
r24 = disableCalls || text == null;
object8.disabled = r24;
items2[1] = <View style={{flex: 1}}><Button {...object8} /></View>;
view = <View {...object} key="two-button-group">{items2}</View>;
} else if (relationshipType === RelationshipTypes.PENDING_INCOMING) {
object = {};
object3 = {flexDirection: 'row'};
object3.gap = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
object.style = [object3, style];
object4 = {};
string = intl.string;
zROXEV = t.zROXEV;
object4.text = Reflect.apply(string, intl, [zROXEV]);
object4.icon = ((ChatIcon) => <ChatIcon color={r27} size="xs" />)((require(6682) /* metro dependency 6682: ChatIcon */).ChatIcon);
string = intl.string;
zROXEV = t.zROXEV;
object4.accessibilityLabel = Reflect.apply(string, intl, [zROXEV]);
formatToPlainString = intl.formatToPlainString;
zFfSFQ = t.zFfSFQ;
object6 = {};
object6.name = (importDefault(3995) /* metro dependency 3995: UserUtils */).getName(user);
object4.accessibilityHint = Reflect.apply(formatToPlainString, intl, [zFfSFQ, object6]);
object4.variant = r18;
object4.size = 'md';
object4.grow = true;
object4.onPress = closure;
object4.disabled = disableMessage;
items2 = [<View style={{flex: 1}}><Button {...object4} /></View>];
object8 = {};
string = intl.string;
JJogjm = t.JJogjm;
object8.text = Reflect.apply(string, intl, [JJogjm]);
object8.icon = ((PhoneCallIcon) => <PhoneCallIcon color={r27} size="xs" />)((require(8850) /* metro dependency 8850: PhoneCallIcon */).PhoneCallIcon);
string = intl.string;
JJogjm = t.JJogjm;
object8.accessibilityLabel = Reflect.apply(string, intl, [JJogjm]);
object8.accessibilityHint = accessibilityHint ?? intl.string((require(1244) /* metro dependency 1244: indexNative */).t.focH1t);
object8.variant = r18;
object8.size = 'md';
object8.grow = true;
r24 = inCall ? handlePress : _fun81178;
object8.onPress = r24;
r24 = disableCalls || text == null;
object8.disabled = r24;
items2[1] = <View style={{flex: 1}}><Button {...object8} /></View>;
view = <View {...object} key="two-button-group">{items2}</View>;
} else if (value2.length === 0) {
var viewBindingProps = {style: [styles.threeButtonLayout, style]};
items4 = [<View style={styles.flexGrow}><FriendRequestButton user={user} location={location} hasCustomProfileTheme={hasCustomProfileTheme} ButtonComponent={FlatFriendButton} /></View>];
var viewBindingProps2 = {style: styles.iconButtonGroup};
var iconButtonProps3 = {icon: ((ChatIcon) => <ChatIcon color={r27} size="xs" />)((require(6682) /* metro dependency 6682: ChatIcon */).ChatIcon),
accessibilityLabel: intl.string(t.zROXEV)};
formatToPlainString = intl.formatToPlainString;
zFfSFQ = t.zFfSFQ;
object9 = {};
object9.name = (importDefault(3995) /* metro dependency 3995: UserUtils */).getName(user);
iconButtonProps3.accessibilityHint = Reflect.apply(formatToPlainString, intl, [zFfSFQ, object9]);
iconButtonProps3.variant = r18;
iconButtonProps3.size = 'md';
iconButtonProps3.onPress = closure;
iconButtonProps3.disabled = disableMessage;
items5 = [<IconButton {...iconButtonProps3} />];
items5[1] = <IconButton icon={((PhoneCallIcon) => <PhoneCallIcon color={r27} size="xs" />)((require(8850) /* metro dependency 8850: PhoneCallIcon */).PhoneCallIcon)} accessibilityLabel={intl.string(t.JJogjm)} accessibilityHint={accessibilityHint ?? intl.string((require(1244) /* metro dependency 1244: indexNative */).t.focH1t)} variant={r18} size="md" onPress={inCall ? handlePress : _fun81177} disabled={disableCalls || text == null} />;
items4[1] = <View {...viewBindingProps2}>{items5}</View>;
view = <View {...viewBindingProps} key="three-button-group">{items4}</View>;
} else {
object = {};
object3 = {flexDirection: 'row'};
object3.gap = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
object.style = [object3, style];
object4 = {};
string = intl.string;
zROXEV = t.zROXEV;
object4.text = Reflect.apply(string, intl, [zROXEV]);
object4.icon = ((ChatIcon) => <ChatIcon color={r27} size="xs" />)((require(6682) /* metro dependency 6682: ChatIcon */).ChatIcon);
string = intl.string;
zROXEV = t.zROXEV;
object4.accessibilityLabel = Reflect.apply(string, intl, [zROXEV]);
formatToPlainString = intl.formatToPlainString;
zFfSFQ = t.zFfSFQ;
object6 = {};
object6.name = (importDefault(3995) /* metro dependency 3995: UserUtils */).getName(user);
object4.accessibilityHint = Reflect.apply(formatToPlainString, intl, [zFfSFQ, object6]);
object4.variant = r18;
object4.size = 'md';
object4.grow = true;
object4.onPress = closure;
object4.disabled = disableMessage;
items2 = [<View style={{flex: 1}}><Button {...object4} /></View>];
object8 = {};
string = intl.string;
JJogjm = t.JJogjm;
object8.text = Reflect.apply(string, intl, [JJogjm]);
object8.icon = ((PhoneCallIcon) => <PhoneCallIcon color={r27} size="xs" />)((require(8850) /* metro dependency 8850: PhoneCallIcon */).PhoneCallIcon);
string = intl.string;
JJogjm = t.JJogjm;
object8.accessibilityLabel = Reflect.apply(string, intl, [JJogjm]);
object8.accessibilityHint = accessibilityHint ?? intl.string((require(1244) /* metro dependency 1244: indexNative */).t.focH1t);
object8.variant = r18;
object8.size = 'md';
object8.grow = true;
r24 = inCall ? handlePress : _fun81178;
object8.onPress = r24;
r24 = disableCalls || text == null;
object8.disabled = r24;
items2[1] = <View style={{flex: 1}}><Button {...object8} /></View>;
view = <View {...object} key="two-button-group">{items2}</View>;
}
return view;
}
function FriendRequestButtonOnPress() { // fn#81170, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10676:1465, owner: FriendRequestButton.onPress, offset: 0x01e9caef, size: 165 bytes, params: 1, frame: 14
var moduleValue;
const relationshipTypeBinding = relationshipType;
const PENDING_OUTGOING = RelationshipTypes.PENDING_OUTGOING;
if (relationshipTypeBinding === PENDING_OUTGOING) {
moduleValue = require(8796) /* metro dependency 8796: UserProfileAlertUtils */;
moduleValue.confirmCancelFriendRequest({userDisplayName: env0_4, onConfirm: onConfirm_81171});
} else {
trackUserProfileAction({action: 'SEND_FRIEND_REQUEST'});
(importDefault(8783) /* metro dependency 8783: RelationshipActionCreators */).addRelationship({userId: user.id,
context: env0_2});
}
}
function closeUserProfile() { // fn#81174, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10676:2187, owner: UserProfileContactButtons.closeUserProfile, offset: 0x01e9d273, size: 53 bytes, params: 1, frame: 12
const value = environment.__proto__;
(importDefault(8776) /* metro dependency 8776: navigateToLastChannel */)();
(importDefault(4080) /* metro dependency 4080: ActionSheetActionCreators */).hideActionSheet();
}
function _fun81177() { // fn#81177, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10676:3443, offset: 0x01e9d348, size: 45 bytes, params: 1, frame: 11
let value = environment.__proto__;
value = require(9708) /* metro dependency 9708: ConfirmStartCall */;
return value.confirmStartCall(handlePress);
}
function onPressOnConfirm_81171() { // fn#81171, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10676:1558, owner: FriendRequestButton.onPress.onConfirm, offset: 0x01e9cb94, size: 76 bytes, params: 1, frame: 14
trackUserProfileAction({action: 'CANCEL_FRIEND_REQUEST'});
const defaultImport = importDefault(8783) /* metro dependency 8783: RelationshipActionCreators */;
defaultImport.cancelFriendRequest(user.id, env1_2);
}