decord/source/modules/guilds_bar/native/GuildsBarDirectMessage.tsx

133 lines
5.4 KiB
TypeScript
Raw Normal View History

// Module ID: 16437
// Function ID: 16438
// Name: GuildsBarDirectMessage
// Dependencies: [19, 502, 5359, 1957, 7738, 4285, 1371, 1074, 21, 4636, 576, 16389, 504, 9900, 1114, 16392, 4647, 11044, 16438, 11041, 1178, 5668, 2]
2026-07-20 16:05:17 +00:00
// Module 16437 (GuildsBarDirectMessage)
import nativeDefault from "native" /* 576 */;
import util from "util" /* 1114 */;
import getChannelA11yLabelDefault from "getChannelA11yLabel" /* 9900 */;
import noop from "module_19" /* 19 */;
import AuthenticationStore from "AuthenticationStore" /* 502 */;
import CallStore from "CallStore" /* 5359 */;
import ChannelStore from "ChannelStore" /* 1957 */;
import GuildReadStateStore from "GuildReadStateStore" /* 7738 */;
import RelationshipStore from "RelationshipStore" /* 4285 */;
import UserStore from "UserStore" /* 1371 */;
2026-07-23 10:11:24 +00:00
require = fn;
const ChannelTypes = fn(1074).ChannelTypes;
const jsx = fn(21).jsx;
const createStyles = fn(4636);
2026-07-29 08:29:29 +00:00
let obj = { dm: null };
let size = { width: nativeDefault.modules.mobile.GUILD_BAR_ITEM_SIZE, height: nativeDefault.modules.mobile.GUILD_BAR_ITEM_SIZE };
obj.dm = size;
let closure_12 = createStyles.createStyles(obj);
size = fn(2);
let result = size.fileFinishedImporting("modules/guilds_bar/native/GuildsBarDirectMessage.tsx");
export default noop.memo(function GuildsBarDirectMessage(channelId) {
2026-07-23 10:11:24 +00:00
channelId = channelId.channelId;
2026-07-29 08:29:29 +00:00
let channel;
const tmp = closure_12();
2026-07-23 10:11:24 +00:00
let obj = channelId(channel[11]);
const guildsBarAnimatedWrapperStyles = channelId(channel[11]).useGuildsBarAnimatedWrapperStyles({ disableSelectedColor: true, disableBGColor: true });
const items = [GuildReadStateStore];
const stateFromStores = channelId(channel[12]).useStateFromStores(items, () => GuildReadStateStore.getMentionCountForPrivateChannel(channelId).count);
2026-07-23 10:11:24 +00:00
let obj2 = channelId(channel[12]);
const items1 = [ChannelStore, UserStore, RelationshipStore, CallStore, AuthenticationStore];
const stateFromStoresObject = channelId(channel[12]).useStateFromStoresObject(items1, () => {
channel = ChannelStore.getChannel(channelId);
2026-07-20 16:05:17 +00:00
let type;
2026-07-29 08:29:29 +00:00
if (channel != null) {
2026-07-20 16:05:17 +00:00
type = channel.type;
}
let user;
if (type === ChannelTypes.DM) {
user = UserStore.getUser(channel.getRecipientId());
2026-07-20 16:05:17 +00:00
}
const call = CallStore.getCall(tmp);
const id = AuthenticationStore.getId();
2026-07-20 16:05:17 +00:00
let hasItem = null != call && null != id;
if (hasItem) {
const ringing = call.ringing;
hasItem = ringing.includes(id);
}
const obj = { channel, dmRecipient: user, label: null };
2026-07-20 16:05:17 +00:00
if (null != channel) {
const obj3 = { channel, unread: stateFromStores > 0, mentionCount: stateFromStores, isIncomingCall: hasItem, isOngoingCall: tmp8 };
let stringResult = getChannelA11yLabelDefault(obj3);
2026-07-20 16:05:17 +00:00
} else {
const intl = util.intl;
stringResult = intl.string(util.t.zLZPmk);
2026-07-20 16:05:17 +00:00
}
obj.label = stringResult;
2026-07-20 16:05:17 +00:00
return obj;
});
2026-07-23 10:11:24 +00:00
channel = stateFromStoresObject.channel;
const dmRecipient = stateFromStoresObject.dmRecipient;
let obj3 = channelId(channel[12]);
2026-07-20 16:05:17 +00:00
const items2 = [channel, dmRecipient];
2026-07-23 10:11:24 +00:00
({ badge, cutouts } = stateFromStores(channel[15])({ mentionCount: stateFromStores }));
const memo = dmRecipient.useMemo(() => {
2026-07-29 08:29:29 +00:00
let isDMResult;
if (channel != null) {
isDMResult = channel.isDM();
}
let tmp2;
if (isDMResult) {
let avatarSource;
if (dmRecipient != null) {
avatarSource = obj2.getAvatarSource(undefined);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp2 = avatarSource;
obj2 = dmRecipient;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp2;
2026-07-20 16:05:17 +00:00
}, items2);
const items3 = [channel];
2026-07-23 10:11:24 +00:00
const memo1 = dmRecipient.useMemo(() => ({
2026-07-20 16:05:17 +00:00
onPress() {
if (null != closure_1_2) {
channelId(channel[16]).transitionToChannel(tmp.id);
const obj = channelId(channel[16]);
2026-07-20 16:05:17 +00:00
}
},
onLongPress() {
if (null != closure_1_2) {
const result = channelId(channel[17]).openChannelLongPressActionSheet(tmp.id);
const obj = channelId(channel[17]);
2026-07-20 16:05:17 +00:00
}
}
}), items3);
2026-07-29 08:29:29 +00:00
let isMultiUserDMResult;
const tmp8 = stateFromStores(channel[15])({ mentionCount: stateFromStores });
if (channel != null) {
2026-07-20 16:05:17 +00:00
isMultiUserDMResult = channel.isMultiUserDM();
}
const obj4 = { selected: false, circle: !isMultiUserDMResult, unread: true, styles: guildsBarAnimatedWrapperStyles, label: stateFromStoresObject.label, overState: "Boolean", config: memo1, cutouts, externalChildren: badge, expandedChildren: "flowing", children: "hourglass" };
2026-07-29 08:29:29 +00:00
let tmp11Result = null;
2026-07-20 16:05:17 +00:00
if (null != channel) {
const obj5 = { channel };
tmp11Result = tmp11(tmp7(tmp3[18]), obj5);
2026-07-20 16:05:17 +00:00
}
obj4.expandedChildren = tmp11Result;
2026-07-29 08:29:29 +00:00
let isMultiUserDMResult1;
if (channel != null) {
isMultiUserDMResult1 = channel.isMultiUserDM();
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (isMultiUserDMResult1) {
const obj6 = { channel, size: tmp2(tmp3[20]).AvatarSizes.LARGE_48, pileSizeOverride: tmp2(tmp3[20]).AvatarSizes.REFRESH_MEDIUM_32, animate: true };
let tmp11Result2 = tmp11(tmp7(tmp3[19]), obj6);
2026-07-29 08:29:29 +00:00
const tmp7Result = tmp7(tmp3[19]);
} else {
tmp11Result2 = null;
2026-07-29 08:29:29 +00:00
if (null != memo) {
const obj7 = { style: tmp.dm, source: memo };
tmp11Result2 = tmp11(tmp7(tmp3[21]), obj7);
2026-07-29 08:29:29 +00:00
}
2026-07-20 16:05:17 +00:00
}
obj4.children = tmp11Result2;
return jsx(stateFromStores(channel[11]), { selected: false, circle: !isMultiUserDMResult, unread: true, styles: guildsBarAnimatedWrapperStyles, label: stateFromStoresObject.label, overState: "Boolean", config: memo1, cutouts, externalChildren: badge, expandedChildren: "flowing", children: "hourglass" });
2026-07-20 16:05:17 +00:00
});