36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
// Metro module 12023 (f12024).
|
|
import UserStore from "../../stores/UserStore";
|
|
import { ChannelTypes } from "../../Constants";
|
|
import { isNotNullish } from "../../utils/GlobalUtils";
|
|
import AvatarUtils from "../../utils/AvatarUtils";
|
|
export function getChannelIconURL(a0, size = 32) {
|
|
const type = a0.type;
|
|
if (ChannelTypes.DM === type) {
|
|
const [r35] = a0.recipients.map(UserStore.getUser).filter(isNotNullish);
|
|
return r35 != null ? r35.getAvatarURL(void 0, size, arguments[2]) : null;
|
|
}
|
|
if (ChannelTypes.GROUP_DM === type) {
|
|
return AvatarUtils.getChannelIconURL({
|
|
id: a0.id,
|
|
icon: a0.icon,
|
|
applicationId: a0.getApplicationId(),
|
|
size
|
|
});
|
|
}
|
|
}
|
|
export function getChannelIconSource(a0) {
|
|
const type = a0.type;
|
|
if (ChannelTypes.DM === type) {
|
|
const [r36] = a0.recipients.map(UserStore.getUser).filter(isNotNullish);
|
|
return r36 != null ? r36.getAvatarSource(void 0) : null;
|
|
}
|
|
if (ChannelTypes.GROUP_DM === type) {
|
|
return AvatarUtils.getChannelIconSource({
|
|
id: a0.id,
|
|
icon: a0.icon,
|
|
applicationId: a0.getApplicationId(),
|
|
size: 128
|
|
});
|
|
}
|
|
}
|