Files
2026-07-28 01:06:53 +03:00

474 lines
25 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] */
import RelationshipStore from '../../../stores/RelationshipStore.tsx'; /* Metro dependency 3793 */
import UserUtils from '../../../utils/UserUtils.tsx'; /* Metro dependency 3995 */
import ActionSheetActionCreators from '../../action_sheet/native/ActionSheetActionCreators.tsx'; /* Metro dependency 4080 */
import UseAnalyticsLocations from '../../app_analytics/useAnalyticsLocations.tsx'; /* Metro dependency 6771 */
import NavigateToLastChannel from '../../main_tabs_v2/native/navigateToLastChannel.tsx'; /* Metro dependency 8776 */
import RelationshipActionCreators from '../../../actions/RelationshipActionCreators.tsx'; /* Metro dependency 8783 */
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 FluxModule from '../../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
import * as IndexNativeModule from '../../../intl/index.native.tsx'; /* Metro dependency 1244 */
import * as ButtonNativeModule from '../../../design/components/Button/native/Button.native.tsx'; /* Metro dependency 4578 */
import * as IconButtonNativeModule from '../../../design/components/Button/native/IconButton.native.tsx'; /* Metro dependency 8341 */
import * as UserProfileAnalyticsContextModule from '../UserProfileAnalyticsContext.tsx'; /* Metro dependency 8514 */
import * as GameRelationshipStoreHooksModule from '../../game_relationships/GameRelationshipStoreHooks.tsx'; /* Metro dependency 10341 */
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
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
ReactModule;
let value = JsxRuntimeModule;
const env0_6 = value.jsx;
const env0_7 = value.jsxs;
value = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = value.createStyles;
object = {};
let PX_12 = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
object.threeButtonLayout = {'flexDirection': 'row', 'alignItems': 'center', gap: PX_12};
object.flexGrow = {flex: 1};
PX_12 = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
object.iconButtonGroup = {flexDirection: 'row', gap: PX_12};
const env0_8 = Reflect.apply(createStyles, value, [object]);
(FileImportTrackerModule).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 object = {'icon': 0, 'label': 0, 'hasCustomProfileTheme': 0, 'isPending': 0};
silentSetPrototypeOf(object, null, undefined);
const value = copyDataProperties({}, a0, object, 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 = (ButtonNativeModule).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 = (UseAnalyticsLocations)().newestAnalyticsLocation;
const useUserProfileAnalyticsContext = UserProfileAnalyticsContextModule.useUserProfileAnalyticsContext;
const env0_1 = Reflect.apply(useUserProfileAnalyticsContext, UserProfileAnalyticsContextModule,
[]).trackUserProfileAction;
({}).location = location ?? newestAnalyticsLocation;
const value2 = (GameRelationshipStoreHooksModule).useGameFriendsForUser(user.id);
const relationshipType = (require(566) /* metro dependency 566: flux */).useStateFromStores([RelationshipStore],
function() {
return RelationshipStore.getRelationshipType(user.id);
});
const env0_4 = (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 = (IndexNativeModule).intl;
let string = intl.string;
const t = (IndexNativeModule).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 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 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 = RelationshipActionCreators;
defaultImport.cancelFriendRequest(user.id, env1_2);
}
}
}
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 object2;
const Button = (ButtonNativeModule).Button;
var object5;
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 object7;
var items2;
var object10;
var JJogjm;
var items4;
const IconButton = (IconButtonNativeModule).IconButton;
var object11;
var items5;
const useUserProfileAnalyticsContext = UserProfileAnalyticsContextModule.useUserProfileAnalyticsContext;
const env0_1 = Reflect.apply(useUserProfileAnalyticsContext, UserProfileAnalyticsContextModule,
[]).trackUserProfileAction;
const styles = useStyles();
const useStateFromStores = FluxModule.useStateFromStores;
let object = [RelationshipStore];
const relationshipType = Reflect.apply(useStateFromStores, FluxModule, [object, function() {
return RelationshipStore.getRelationshipType(user.id);
}]);
const value2 = (GameRelationshipStoreHooksModule).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 = {};
object2 = {flexDirection: 'row'};
object2.gap = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
object.style = [object2, style];
object5 = {};
string = intl.string;
zROXEV = t.zROXEV;
object5.text = Reflect.apply(string, intl, [zROXEV]);
object5.icon = ((ChatIcon) => <ChatIcon color={r27} size="xs" />)((require(6682) /* metro dependency 6682: ChatIcon */).ChatIcon);
string = intl.string;
zROXEV = t.zROXEV;
object5.accessibilityLabel = Reflect.apply(string, intl, [zROXEV]);
formatToPlainString = intl.formatToPlainString;
zFfSFQ = t.zFfSFQ;
object7 = {};
object7.name = (importDefault(3995) /* metro dependency 3995: UserUtils */).getName(user);
object5.accessibilityHint = Reflect.apply(formatToPlainString, intl, [zFfSFQ, object7]);
object5.variant = r18;
object5.size = 'md';
object5.grow = true;
object5.onPress = closure;
object5.disabled = disableMessage;
items2 = [
<View style={{flex: 1}}>
<Button {...object5} />
</View>,
];
object10 = {};
string = intl.string;
JJogjm = t.JJogjm;
object10.text = Reflect.apply(string, intl, [JJogjm]);
object10.icon = ((PhoneCallIcon) => <PhoneCallIcon color={r27} size="xs" />)((require(8850) /* metro dependency 8850: PhoneCallIcon */).PhoneCallIcon);
string = intl.string;
JJogjm = t.JJogjm;
object10.accessibilityLabel = Reflect.apply(string, intl, [JJogjm]);
object10.accessibilityHint = accessibilityHint ?? intl.string((require(1244) /* metro dependency 1244: indexNative */).t.focH1t);
object10.variant = r18;
object10.size = 'md';
object10.grow = true;
r24 = inCall ? handlePress : _fun81178;
object10.onPress = r24;
r24 = disableCalls || text == null;
object10.disabled = r24;
items2[1] = (
<View style={{flex: 1}}>
<Button {...object10} />
</View>
);
view = (
<View {...object} key="two-button-group">
{items2}
</View>
);
} else if (relationshipType === RelationshipTypes.BLOCKED) {
object = {};
object2 = {flexDirection: 'row'};
object2.gap = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
object.style = [object2, style];
object5 = {};
string = intl.string;
zROXEV = t.zROXEV;
object5.text = Reflect.apply(string, intl, [zROXEV]);
object5.icon = ((ChatIcon) => <ChatIcon color={r27} size="xs" />)((require(6682) /* metro dependency 6682: ChatIcon */).ChatIcon);
string = intl.string;
zROXEV = t.zROXEV;
object5.accessibilityLabel = Reflect.apply(string, intl, [zROXEV]);
formatToPlainString = intl.formatToPlainString;
zFfSFQ = t.zFfSFQ;
object7 = {};
object7.name = (importDefault(3995) /* metro dependency 3995: UserUtils */).getName(user);
object5.accessibilityHint = Reflect.apply(formatToPlainString, intl, [zFfSFQ, object7]);
object5.variant = r18;
object5.size = 'md';
object5.grow = true;
object5.onPress = closure;
object5.disabled = disableMessage;
items2 = [
<View style={{flex: 1}}>
<Button {...object5} />
</View>,
];
object10 = {};
string = intl.string;
JJogjm = t.JJogjm;
object10.text = Reflect.apply(string, intl, [JJogjm]);
object10.icon = ((PhoneCallIcon) => <PhoneCallIcon color={r27} size="xs" />)((require(8850) /* metro dependency 8850: PhoneCallIcon */).PhoneCallIcon);
string = intl.string;
JJogjm = t.JJogjm;
object10.accessibilityLabel = Reflect.apply(string, intl, [JJogjm]);
object10.accessibilityHint = accessibilityHint ?? intl.string((require(1244) /* metro dependency 1244: indexNative */).t.focH1t);
object10.variant = r18;
object10.size = 'md';
object10.grow = true;
r24 = inCall ? handlePress : _fun81178;
object10.onPress = r24;
r24 = disableCalls || text == null;
object10.disabled = r24;
items2[1] = (
<View style={{flex: 1}}>
<Button {...object10} />
</View>
);
view = (
<View {...object} key="two-button-group">
{items2}
</View>
);
} else if (relationshipType === RelationshipTypes.PENDING_INCOMING) {
object = {};
object2 = {flexDirection: 'row'};
object2.gap = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
object.style = [object2, style];
object5 = {};
string = intl.string;
zROXEV = t.zROXEV;
object5.text = Reflect.apply(string, intl, [zROXEV]);
object5.icon = ((ChatIcon) => <ChatIcon color={r27} size="xs" />)((require(6682) /* metro dependency 6682: ChatIcon */).ChatIcon);
string = intl.string;
zROXEV = t.zROXEV;
object5.accessibilityLabel = Reflect.apply(string, intl, [zROXEV]);
formatToPlainString = intl.formatToPlainString;
zFfSFQ = t.zFfSFQ;
object7 = {};
object7.name = (importDefault(3995) /* metro dependency 3995: UserUtils */).getName(user);
object5.accessibilityHint = Reflect.apply(formatToPlainString, intl, [zFfSFQ, object7]);
object5.variant = r18;
object5.size = 'md';
object5.grow = true;
object5.onPress = closure;
object5.disabled = disableMessage;
items2 = [
<View style={{flex: 1}}>
<Button {...object5} />
</View>,
];
object10 = {};
string = intl.string;
JJogjm = t.JJogjm;
object10.text = Reflect.apply(string, intl, [JJogjm]);
object10.icon = ((PhoneCallIcon) => <PhoneCallIcon color={r27} size="xs" />)((require(8850) /* metro dependency 8850: PhoneCallIcon */).PhoneCallIcon);
string = intl.string;
JJogjm = t.JJogjm;
object10.accessibilityLabel = Reflect.apply(string, intl, [JJogjm]);
object10.accessibilityHint = accessibilityHint ?? intl.string((require(1244) /* metro dependency 1244: indexNative */).t.focH1t);
object10.variant = r18;
object10.size = 'md';
object10.grow = true;
r24 = inCall ? handlePress : _fun81178;
object10.onPress = r24;
r24 = disableCalls || text == null;
object10.disabled = r24;
items2[1] = (
<View style={{flex: 1}}>
<Button {...object10} />
</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;
object11 = {};
object11.name = (importDefault(3995) /* metro dependency 3995: UserUtils */).getName(user);
iconButtonProps3.accessibilityHint = Reflect.apply(formatToPlainString, intl, [zFfSFQ, object11]);
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 = {};
object2 = {flexDirection: 'row'};
object2.gap = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
object.style = [object2, style];
object5 = {};
string = intl.string;
zROXEV = t.zROXEV;
object5.text = Reflect.apply(string, intl, [zROXEV]);
object5.icon = ((ChatIcon) => <ChatIcon color={r27} size="xs" />)((require(6682) /* metro dependency 6682: ChatIcon */).ChatIcon);
string = intl.string;
zROXEV = t.zROXEV;
object5.accessibilityLabel = Reflect.apply(string, intl, [zROXEV]);
formatToPlainString = intl.formatToPlainString;
zFfSFQ = t.zFfSFQ;
object7 = {};
object7.name = (importDefault(3995) /* metro dependency 3995: UserUtils */).getName(user);
object5.accessibilityHint = Reflect.apply(formatToPlainString, intl, [zFfSFQ, object7]);
object5.variant = r18;
object5.size = 'md';
object5.grow = true;
object5.onPress = closure;
object5.disabled = disableMessage;
items2 = [
<View style={{flex: 1}}>
<Button {...object5} />
</View>,
];
object10 = {};
string = intl.string;
JJogjm = t.JJogjm;
object10.text = Reflect.apply(string, intl, [JJogjm]);
object10.icon = ((PhoneCallIcon) => <PhoneCallIcon color={r27} size="xs" />)((require(8850) /* metro dependency 8850: PhoneCallIcon */).PhoneCallIcon);
string = intl.string;
JJogjm = t.JJogjm;
object10.accessibilityLabel = Reflect.apply(string, intl, [JJogjm]);
object10.accessibilityHint = accessibilityHint ?? intl.string((require(1244) /* metro dependency 1244: indexNative */).t.focH1t);
object10.variant = r18;
object10.size = 'md';
object10.grow = true;
r24 = inCall ? handlePress : _fun81178;
object10.onPress = r24;
r24 = disableCalls || text == null;
object10.disabled = r24;
items2[1] = (
<View style={{flex: 1}}>
<Button {...object10} />
</View>
);
view = (
<View {...object} key="two-button-group">
{items2}
</View>
);
}
return view;
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__;
(NavigateToLastChannel)();
(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 _fun81178() { // fn#81178, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10676:4266, offset: 0x01e9d348, size: 45 bytes, params: 1, frame: 11
let value = environment.__proto__;
value = require(9708) /* metro dependency 9708: ConfirmStartCall */;
return value.confirmStartCall(handlePress);
}
}
}
global.__d(_fun81166, 10490, [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]) /* metro module 10490, 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] */;