195 lines
11 KiB
TypeScript
195 lines
11 KiB
TypeScript
/* Metro module 14536; source: modules/guild_sidebar/native/ChannelItem.tsx; dependencies: [29, 31, 27, 4396, 3793, 1878, 661, 1386, 4865, 33, 4501, 697, 6235, 11846, 1423, 5475, 14537, 6686, 6647, 566, 1305, 6632, 14538, 4805, 1230, 2] */
|
|
function _fun109989(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#109989, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14733:6, offset: 0x023647d1, size: 594 bytes, params: 8, frame: 26
|
|
var object2;
|
|
const env0_0 = require;
|
|
const closure = getChannelMode;
|
|
const env0_3 = ['channel', 'subtitle', 'hideIcon', 'children', 'textStyle', 'channelInfo', 'onPress'];
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_4 = importDefault(29) /* metro dependency 29 */;
|
|
let value = importAll(31) /* metro dependency 31 */;
|
|
const env0_5 = (require(27) /* metro dependency 27 */).View;
|
|
const presenceStore = importDefault(4396) /* metro dependency 4396: PresenceStore */;
|
|
const relationshipStore = importDefault(3793) /* metro dependency 3793: RelationshipStore */;
|
|
const userStore = importDefault(1878) /* metro dependency 1878: UserStore */;
|
|
const constantsModule = require(661) /* metro dependency 661: Constants */;
|
|
const ChannelTypes = constantsModule.ChannelTypes;
|
|
const env0_10 = constantsModule.Routes;
|
|
const env0_11 = (require(1386) /* metro dependency 1386: ChannelConstants */).StaticChannelRoute;
|
|
const env0_12 = (require(4865) /* metro dependency 4865: ReadStateConstants */).UnreadSetting;
|
|
const value3 = require(33) /* metro dependency 33 */;
|
|
const env0_13 = value3.jsx;
|
|
const env0_14 = value3.jsxs;
|
|
const Set = global.Set;
|
|
const GUILD_VOICE = ChannelTypes.GUILD_VOICE;
|
|
const GUILD_STAGE_VOICE = ChannelTypes.GUILD_STAGE_VOICE;
|
|
const set = new Set([GUILD_VOICE, GUILD_STAGE_VOICE]);
|
|
const createStylesModule = require(4501) /* metro dependency 4501: createStyles */;
|
|
const createStyles = createStylesModule.createStyles;
|
|
object2 = {};
|
|
const GREEN_360 = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.GREEN_360;
|
|
object2.channelIconLive = {tintColor: GREEN_360};
|
|
object2.dmAvatar = {marginRight: 8};
|
|
const BACKGROUND_BASE_LOW = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOW;
|
|
object2.avatarStatus = {backgroundColor: BACKGROUND_BASE_LOW};
|
|
object2.groupDmAvatar = {'width': 20, 'height': 20, 'borderRadius': 10, 'marginRight': 8};
|
|
object2.channelInfoContainer = {paddingStart: 4};
|
|
const DARK_393C42_LIGHT_DEE0E4 = (require(6235) /* metro dependency 6235: LegacyTokens */).DARK_393C42_LIGHT_DEE0E4;
|
|
object2.avatarStatusSelected = {backgroundColor: DARK_393C42_LIGHT_DEE0E4};
|
|
const env0_16 = Reflect.apply(createStyles, createStylesModule, [object2]);
|
|
value = value.memo(_fun109995);
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/guild_sidebar/native/ChannelItem.tsx');
|
|
exports.default = value;
|
|
exports.getChannelMode = closure;
|
|
}
|
|
|
|
function getChannelMode(a0) { // fn#109990, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14733:772, offset: 0x02364a23, size: 333 bytes, params: 2, frame: 16
|
|
const ChannelModes = (require(11846) /* metro dependency 11846: BaseChannelItem */).ChannelModes;
|
|
const muted = a0.muted;
|
|
const selected = a0.selected;
|
|
const unread = a0.unread;
|
|
return selected ? a0.channel.isGuildVocal() ? unread ? ChannelModes.UNREAD_IMPORTANT : ChannelModes.RELEVANT : ChannelModes.SELECTED : a0.locked ? ChannelModes.LOCKED : muted ? ChannelModes.MUTED : unread ? a0.resolvedUnreadSetting === UnreadSetting.ALL_MESSAGES ? ChannelModes.UNREAD_IMPORTANT : ChannelModes.UNREAD_LESS_IMPORTANT : ChannelModes.DEFAULT;
|
|
}
|
|
|
|
function ChannelIcon_109991({channel, locked, isRulesChannel, isChannelLive, selected, mode}) { // fn#109991, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14733:1206, offset: 0x02364b70, size: 495 bytes, params: 2, frame: 26
|
|
var r9;
|
|
var r11;
|
|
var object2;
|
|
var channelIcon;
|
|
var channelIconComponent;
|
|
var defaultImport2;
|
|
var BookCheckIcon;
|
|
const styles = useStyles();
|
|
let type = channel.type;
|
|
const DM = ChannelTypes.DM;
|
|
if (type === DM) {
|
|
return <DMChannelIcon userId={channel.getRecipientId()} selected={selected != null && selected} />;
|
|
}
|
|
type = channel.type;
|
|
const GROUP_DM = ChannelTypes.GROUP_DM;
|
|
if (type === GROUP_DM) {
|
|
var defaultImport = importDefault(1423) /* metro dependency 1423: AvatarUtils */;
|
|
var getChannelIconSource = defaultImport.getChannelIconSource;
|
|
object2 = {};
|
|
object2.id = channel.id;
|
|
object2.icon = channel.icon;
|
|
object2.applicationId = channel.getApplicationId();
|
|
object2.size = 20;
|
|
var value3 = Reflect.apply(getChannelIconSource, defaultImport, [object2]);
|
|
if (value3 != null) {
|
|
return ((Component) => <Component style={styles.groupDmAvatar} source={value3} />)(importDefault(5475) /* metro dependency 5475: FastImage */);
|
|
}
|
|
}
|
|
if (isRulesChannel) {
|
|
defaultImport2 = importDefault(14537) /* metro dependency 14537 */;
|
|
BookCheckIcon = (require(6686) /* metro dependency 6686: BookCheckIcon */).BookCheckIcon;
|
|
r9 = defaultImport2;
|
|
r11 = BookCheckIcon;
|
|
} else {
|
|
channelIcon = (require(6647) /* metro dependency 6647: ChannelUtils */).getChannelIcon(channel,
|
|
{isRulesChannel: false, locked: locked});
|
|
channelIconComponent = (require(6647) /* metro dependency 6647: ChannelUtils */).getChannelIconComponent(channel,
|
|
|
|
{isRulesChannel: false, locked: locked});
|
|
r9 = channelIcon;
|
|
r11 = channelIconComponent;
|
|
}
|
|
const BaseChannelIcon = (require(11846) /* metro dependency 11846: BaseChannelItem */).BaseChannelIcon;
|
|
return (
|
|
<BaseChannelIcon
|
|
mode={mode}
|
|
source={r9}
|
|
isChannelLive={isChannelLive}
|
|
style={isChannelLive ? styles.channelIconLive : undefined}
|
|
{...r11 != null ? {IconComponent: r11} : {}}
|
|
/>
|
|
);
|
|
}
|
|
|
|
function DMChannelIcon({userId, selected}) { // fn#109992, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14733:1905, offset: 0x02364d5f, size: 279 bytes, params: 2, frame: 24
|
|
const styles = useStyles();
|
|
const value2 = (require(566) /* metro dependency 566: flux */).useStateFromStores([UserStore], function() {
|
|
return UserStore.getUser(userId);
|
|
}, [userId]);
|
|
const {status, isMobileOnline,
|
|
isVROnline} = (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([PresenceStore],
|
|
function() {
|
|
var object = {};
|
|
var userIdBinding = userId;
|
|
object.status = PresenceStore.getStatus(userIdBinding);
|
|
object.isMobileOnline = PresenceStore.isMobileOnline(userIdBinding);
|
|
object.isVROnline = PresenceStore.isVROnline(userIdBinding);
|
|
return object;
|
|
}, [userId]);
|
|
const Avatar = (require(1305) /* metro dependency 1305: native */).Avatar;
|
|
const AvatarSizes = (require(1305) /* metro dependency 1305: native */).AvatarSizes;
|
|
const XSMALL_20 = AvatarSizes.XSMALL_20;
|
|
return (
|
|
<Avatar
|
|
user={value2}
|
|
guildId={undefined}
|
|
size={XSMALL_20}
|
|
style={styles.dmAvatar}
|
|
status={status}
|
|
isMobileOnline={isMobileOnline}
|
|
isVROnline={isVROnline}
|
|
statusStyle={[styles.avatarStatus, selected && styles.avatarStatusSelected]}
|
|
/>
|
|
);
|
|
}
|
|
|
|
function _fun109995(a0) { // fn#109995, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14733:2414, offset: 0x02364ebf, size: 506 bytes, params: 2, frame: 32
|
|
const styles = useStyles();
|
|
const channel = a0.channel;
|
|
const subtitle = a0.subtitle;
|
|
const hideIcon = a0.hideIcon;
|
|
const children = a0.children;
|
|
const textStyle = a0.textStyle;
|
|
const channelInfo = a0.channelInfo;
|
|
const env0_1 = a0.onPress;
|
|
const value2 = env0_4(a0, env0_3);
|
|
const {isSubscriptionGated,
|
|
needSubscriptionToAccess} = (importDefault(6632) /* metro dependency 6632: useChannelRoleSubscriptionStatus */)(channel.id);
|
|
const channelMode = getChannelMode(a0);
|
|
const value5 = null;
|
|
const r7 = value5 != channelInfo || isSubscriptionGated ? <View style={styles.channelInfoContainer}>{channelInfo}{isSubscriptionGated ? ((Component) => <Component locked={needSubscriptionToAccess} />)(importDefault(14538) /* metro dependency 14538: GuildRoleSubscriptionGatedChannelIcon */) : value5}</View> : value5;
|
|
const BaseChannelItem = importDefault(11846) /* metro dependency 11846: BaseChannelItem */;
|
|
const object2 = {mode: channelMode};
|
|
const ChannelModes = (require(11846) /* metro dependency 11846: BaseChannelItem */).ChannelModes;
|
|
const UNREAD_IMPORTANT = ChannelModes.UNREAD_IMPORTANT;
|
|
object2.unread = channelMode === UNREAD_IMPORTANT || channelMode === (require(11846) /* metro dependency 11846: BaseChannelItem */).ChannelModes.UNREAD_LESS_IMPORTANT;
|
|
object2.hideIcon = hideIcon;
|
|
const BaseChannelName = (require(11846) /* metro dependency 11846: BaseChannelItem */).BaseChannelName;
|
|
const useChannelNameModule = require(4805) /* metro dependency 4805: useChannelName */;
|
|
object2.name = <BaseChannelName mode={channelMode} name={useChannelNameModule.computeChannelName(channel, UserStore,
|
|
RelationshipStore)} subtitle={subtitle} textStyle={textStyle} />;
|
|
object2.icon = <ChannelIcon_109991 {...a0} {...{['mode']: channelMode}} />;
|
|
object2.channelInfo = r7;
|
|
object2.onPress = onPress_109996;
|
|
copyDataProperties(object2, value2, undefined);
|
|
return (
|
|
<BaseChannelItem {...object2}>
|
|
{children}
|
|
</BaseChannelItem>
|
|
);
|
|
}
|
|
|
|
function onPress_109996(a0) { // fn#109996, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14733:3022, offset: 0x023650b9, size: 137 bytes, params: 2, frame: 15
|
|
var value2;
|
|
var binding;
|
|
var moduleValue;
|
|
if (needSubscriptionToAccess) {
|
|
value2 = environment.__proto__;
|
|
binding = env1_15;
|
|
if (binding.has(channel.type)) {
|
|
moduleValue = require(1230) /* metro dependency 1230: router_utils */;
|
|
moduleValue.transitionTo(Routes.CHANNEL(channel.guild_id, StaticChannelRoute.ROLE_SUBSCRIPTIONS));
|
|
} else if (onPress != null) {
|
|
onPress(a0);
|
|
}
|
|
} else if (onPress != null) {
|
|
onPress(a0);
|
|
}
|
|
}
|
|
|