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

326 lines
18 KiB
TypeScript

/* Metro module 11974; source: modules/welcome_screen/native/GuildWelcomeActionSheet.tsx; dependencies: [31, 27, 6540, 1379, 1867, 3784, 11971, 11975, 661, 1881, 482, 33, 4501, 697, 6597, 566, 4805, 1230, 4080, 5475, 1423, 3797, 4573, 1305, 11427, 7972, 694, 11973, 683, 6805, 11976, 1244, 2] */
function _fun91915(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#91915, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12160:6, offset: 0x02076517, size: 835 bytes, params: 8, frame: 31
var object2;
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importAll(31) /* metro dependency 31 */;
let value = require(27) /* metro dependency 27 */;
const env0_4 = value.View;
const env0_5 = value.ScrollView;
const emojiStore = importDefault(6540) /* metro dependency 6540: EmojiStore */;
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
const guildStore = importDefault(1867) /* metro dependency 1867: GuildStore */;
const permissionStore = importDefault(3784) /* metro dependency 3784: PermissionStore */;
const welcomeScreenStore = importDefault(11971) /* metro dependency 11971: WelcomeScreenStore */;
const env0_11 = (require(11971) /* metro dependency 11971: WelcomeScreenStore */).NO_WELCOME_SCREEN;
const env0_12 = (require(11975) /* metro dependency 11975: WelcomeScreenConstants */).WELCOME_SCREEN_TYPE;
value = require(661) /* metro dependency 661: Constants */;
const env0_13 = value.AnalyticEvents;
const Fonts = value.Fonts;
const env0_14 = value.Routes;
const env0_15 = (require(1881) /* metro dependency 1881: EmojiConstants */).EMOJI_URL_BASE_SIZE;
const env0_16 = (require(482) /* metro dependency 482: Constants */).Permissions;
value = require(33) /* metro dependency 33 */;
const env0_17 = value.jsx;
const env0_18 = value.jsxs;
value = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = value.createStyles;
object2 = {};
const BACKGROUND_BASE_LOW = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOW;
object2.container = {'alignItems': 'center', 'justifyContent': 'center', 'paddingHorizontal': 16, 'width': '100%',
'paddingVertical': 32, backgroundColor: BACKGROUND_BASE_LOW};
const object7 = {'borderRadius': null, 'width': 64, 'height': 64, 'marginBottom': 16};
object7.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.sm;
object2.guildIcon = object7;
const object9 = {};
const textStyles = importDefault(6597) /* metro dependency 6597: TextStyles */;
let DISPLAY_EXTRABOLD = Fonts.DISPLAY_EXTRABOLD;
const TEXT_SUBTLE = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_SUBTLE;
copyDataProperties(object9, textStyles(DISPLAY_EXTRABOLD, TEXT_SUBTLE, 24), undefined);
object9['marginBottom'] = 8;
object9['textAlign'] = 'center';
object2.header = object9;
const object10 = {};
const value3 = textStyles;
DISPLAY_EXTRABOLD = Fonts.DISPLAY_EXTRABOLD;
const MOBILE_TEXT_HEADING_PRIMARY = (importDefault(697) /* metro dependency 697: native */).colors.MOBILE_TEXT_HEADING_PRIMARY;
copyDataProperties(object10, value3(DISPLAY_EXTRABOLD, MOBILE_TEXT_HEADING_PRIMARY, 24), undefined);
object2.headerGuildName = object10;
object2.guildDescription = {'textAlign': 'center', 'marginBottom': 30};
const object11 = {};
const BACKGROUND_SURFACE_HIGH = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_SURFACE_HIGH;
object11.backgroundColor = BACKGROUND_SURFACE_HIGH;
object11.marginTop = 8;
object11.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.sm;
object2.welcomeChannel = object11;
object2.channelsTitle = {alignSelf: 'flex-start'};
object2.emoji = {'width': 24, 'height': 24};
const object12 = {padding: 4};
const BACKGROUND_BASE_LOWEST = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOWEST;
object12.backgroundColor = BACKGROUND_BASE_LOWEST;
object12.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.xs;
object2.placeholderEmojiWrapper = object12;
const env0_19 = Reflect.apply(createStyles, value, [object2]);
const closure = WelcomeChannelRow;
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/welcome_screen/native/GuildWelcomeActionSheet.tsx');
exports.default = GuildWelcomeActionSheet;
exports.WelcomeChannelRow = closure;
}
function WelcomeChannelRow({welcomeChannel, trackOptionSelect}) { // fn#91916, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12160:1226, offset: 0x0207685a, size: 863 bytes, params: 2, frame: 29
var r13;
var r0;
var defaultImport2;
var getByName;
var defaultImport3;
var FastImage;
var defaultImport5;
const styles = useStyles();
const channel = (require(566) /* metro dependency 566: flux */).useStateFromStores([ChannelStore], function() {
return ChannelStore.getChannel(welcomeChannel.channel_id);
});
const value2 = (importDefault(4805) /* metro dependency 4805: useChannelName */)(channel, true);
const value3 = (require(566) /* metro dependency 566: flux */).useStateFromStores([PermissionStore], _fun91918);
const value4 = (require(566) /* metro dependency 566: flux */).useStateFromStores([EmojiStore], _fun91919,
[welcomeChannel.emoji_id]);
if (channel != null) {
if (value3) {
if (value4 != null) {
FastImage = importDefault(5475) /* metro dependency 5475: FastImage */;
var defaultImport4Props = {style: styles.emoji};
defaultImport5 = importDefault(1423) /* metro dependency 1423: AvatarUtils */;
defaultImport4Props.source = {uri: defaultImport5.getEmojiURL({id: value4.id, animated: value4.animated,
size: EMOJI_URL_BASE_SIZE})};
defaultImport4Props.resizeMode = 'contain';
r13 = <FastImage {...defaultImport4Props} />;
} else if (welcomeChannel.emoji_name == null) {
r13 = <View style={styles.placeholderEmojiWrapper}>{((Icon) => <Icon size={(require(1305) /* metro dependency 1305: native */).Icon.Sizes.REFRESH_SMALL_16} source={importDefault(11427) /* metro dependency 11427 */} />)((require(1305) /* metro dependency 1305: native */).Icon)}</View>;
} else {
defaultImport2 = importDefault(3797) /* metro dependency 3797: UnicodeEmojis */;
getByName = defaultImport2.getByName;
defaultImport3 = importDefault(3797) /* metro dependency 3797: UnicodeEmojis */;
if (Reflect.apply(getByName, defaultImport2,
[defaultImport3.convertSurrogateToName(welcomeChannel.emoji_name,
false)]) != null) {
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
r13 = <Text style={styles.emoji} variant="text-sm/medium">{welcomeChannel.emoji_name}</Text>;
} else {
r13 = <View style={styles.placeholderEmojiWrapper}>{((Icon) => <Icon size={(require(1305) /* metro dependency 1305: native */).Icon.Sizes.REFRESH_SMALL_16} source={importDefault(11427) /* metro dependency 11427 */} />)((require(1305) /* metro dependency 1305: native */).Icon)}</View>;
}
}
const FormRow = (require(7972) /* metro dependency 7972: native */).FormRow;
r0 = <FormRow DEPRECATED_style={styles.welcomeChannel} leading={r13} label={((Text) => <Text variant="text-sm/semibold" color="interactive-text-active">{welcomeChannel.description}</Text>)((require(4573) /* metro dependency 4573: Text */).Text)} subLabel={channel != null ? ((Text) => <Text variant="text-sm/medium" color="text-default">{value2}</Text>)((require(4573) /* metro dependency 4573: Text */).Text) : null} onPress={env0_3.useCallback(_fun91920,
[channel,
trackOptionSelect])} trailing={((Arrow) => <Arrow />)((require(7972) /* metro dependency 7972: native */).FormRow.Arrow)} />;
} else {
r0 = null;
}
} else {
r0 = null;
}
return r0;
}
function GuildWelcomeActionSheet({guildId, onHide}) { // fn#91921, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12160:2550, offset: 0x02076c95, size: 881 bytes, params: 2, frame: 32
var r0;
var ActionSheet;
var items2;
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
var welcome_channels;
var value;
const styles = useStyles();
const guild = (require(566) /* metro dependency 566: flux */).useStateFromStores([GuildStore], function() {
return GuildStore.getGuild(guildId);
});
const value2 = (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([WelcomeScreenStore],
function() {
var object = {};
object.welcomeScreen = WelcomeScreenStore.get(guildId);
object.fetching = WelcomeScreenStore.isFetching();
object.hasError = WelcomeScreenStore.hasError();
return object;
});
const welcomeScreen = value2.welcomeScreen;
const env0_3 = welcomeScreen;
const fetching = value2.fetching;
const hasError = value2.hasError;
const binding = env0_3;
binding.useEffect(_fun91924, [guildId, welcomeScreen]);
binding.useEffect(_fun91926, [fetching, hasError]);
binding.useEffect(_fun91927, [guildId, welcomeScreen]);
binding.useEffect(_fun91929, [welcomeScreen]);
binding.useEffect(function() {
var defaultImport = importDefault(dependencyMap[28]);
var OPEN_MODAL = AnalyticEvents.OPEN_MODAL;
defaultImport.track(OPEN_MODAL, {type: WELCOME_SCREEN_TYPE, guild_id: guildId});
}, [guildId]);
binding.useEffect(function() {
return _fun91932;
}, [onHide]);
const env0_6 = binding.useCallback(_fun91933, [guildId, welcomeScreen]);
if (guild == null) {
r0 = null;
} else if (welcomeScreen == null) {
r0 = null;
} else {
ActionSheet = (require(6805) /* metro dependency 6805: ActionSheetNative */).ActionSheet;
var scrollViewBindingProps = {contentContainerStyle: styles.container};
value = importDefault(11976) /* metro dependency 11976: GuildInviteIcon */;
value = ((Component) => <Component style={styles.guildIcon} guild={guild} size={(importDefault(11976) /* metro dependency 11976: GuildInviteIcon */).Sizes.MEDIUM} textScale={2} />)(value);
items2 = [value];
items2[1] = <Text style={styles.header} variant="heading-xl/extrabold" color="text-default">{intl.format(t['0aydCN'],
{guildName: guild.name, guildNameHook: guildNameHook})}</Text>;
items2[2] = <Text style={styles.guildDescription} variant="text-sm/medium" color="text-default">{welcomeScreen.description}</Text>;
var textProps2 = {'style': null, 'variant': 'eyebrow', 'color': 'text-default', style: styles.channelsTitle};
value = intl.string(t['haj5+i']);
items2[3] = <Text {...textProps2}>{value.toUpperCase()}</Text>;
welcome_channels = welcomeScreen.welcome_channels;
items2[4] = welcome_channels.map(_fun91936);
value = <ActionSheet startExpanded><ScrollView {...scrollViewBindingProps}>{items2}</ScrollView></ActionSheet>;
r0 = value;
}
return r0;
}
function _fun91918() { // fn#91918, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12160:1401, offset: 0x02076bb9, size: 51 bytes, params: 1, frame: 14
return channel != null && PermissionStore.can(Permissions.VIEW_CHANNEL, channel);
}
function _fun91919() { // fn#91919, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12160:1475, offset: 0x02076bec, size: 52 bytes, params: 1, frame: 12
const emoji_id = welcomeChannel.emoji_id;
const value2 = null;
return value2 != emoji_id ? EmojiStore.getCustomEmojiById(welcomeChannel.emoji_id) : value2;
}
function _fun91920() { // fn#91920, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12160:1566, offset: 0x02076c20, size: 117 bytes, params: 1, frame: 18
var value2;
var moduleValue;
var transitionTo;
var CHANNEL;
let channelBinding = channel;
if (channelBinding != null) {
trackOptionSelect();
value2 = environment.__proto__;
moduleValue = require(1230) /* metro dependency 1230: router_utils */;
transitionTo = moduleValue.transitionTo;
CHANNEL = Routes.CHANNEL;
channelBinding = channel;
Reflect.apply(transitionTo, moduleValue, [Reflect.apply(CHANNEL, Routes, [channelBinding.guild_id,
channelBinding.id])]);
(importDefault(4080) /* metro dependency 4080: ActionSheetActionCreators */).hideActionSheet();
}
}
function _fun91924() { // fn#91924, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12160:2847, offset: 0x02077045, size: 62 bytes, params: 1, frame: 11
var environment;
var value;
if (welcomeScreen == null) {
value = environment.__proto__;
value = importDefault(694) /* metro dependency 694: Dispatcher */;
value.wait(_fun91925);
}
}
function _fun91926() { // fn#91926, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12160:2935, offset: 0x020770b0, size: 68 bytes, params: 1, frame: 11
var value;
if (fetching === false && hasError === true) {
value = environment.__proto__;
value = importDefault(4080) /* metro dependency 4080: ActionSheetActionCreators */;
value.hideActionSheet();
}
}
function _fun91927() { // fn#91927, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12160:3005, offset: 0x020770f4, size: 62 bytes, params: 1, frame: 11
var environment;
var value;
if (welcomeScreen != null) {
value = environment.__proto__;
value = importDefault(694) /* metro dependency 694: Dispatcher */;
value.wait(_fun91928);
}
}
function _fun91929() { // fn#91929, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12160:3094, offset: 0x0207715f, size: 54 bytes, params: 1, frame: 11
const welcomeScreenBinding = welcomeScreen;
const value = environment.__proto__;
if (welcomeScreenBinding === NO_WELCOME_SCREEN) {
(importDefault(4080) /* metro dependency 4080: ActionSheetActionCreators */).hideActionSheet();
}
}
function _fun91931() { // fn#91931, offset: 0x020771da, size: 11 bytes, params: 1, frame: 1
return function() {
if (onHide != null) {
onHide();
}
};
}
function _fun91933(a0) { // fn#91933, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12160:3277, offset: 0x02077200, size: 168 bytes, params: 2, frame: 19
var environment;
var value2;
var defaultImport;
let welcomeScreenBinding = welcomeScreen;
if (welcomeScreenBinding != null) {
var env0_2 = false;
welcomeScreenBinding = welcomeScreen;
welcomeScreenBinding.welcome_channels.forEach(_fun91934);
value2 = environment.__proto__;
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
defaultImport.track(AnalyticEvents.GUILD_WELCOME_SCREEN_OPTION_SELECTED, {index: a0, guild_id: guildId,
options: [],
options_channel_ids: [], guild_description: welcomeScreenBinding.description, has_custom_emojis: env0_2});
}
}
function guildNameHook(a0, a1) { // fn#91935, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12160:3959, owner: GuildWelcomeActionSheet.guildNameHook, offset: 0x020772ea, size: 86 bytes, params: 3, frame: 15
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
return (
<Text
style={styles.headerGuildName}
variant="heading-xl/extrabold"
color="mobile-text-heading-primary"
key={a1}
>
{a0}
</Text>
);
}
function _fun91936(a0, a1) { // fn#91936, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12160:4376, offset: 0x02077340, size: 53 bytes, params: 3, frame: 16
const env0_0 = a1;
return (
<WelcomeChannelRow
welcomeChannel={a0}
trackOptionSelect={trackOptionSelect}
key={a1}
/>
);
}
function _fun91925() { // fn#91925, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12160:2876, offset: 0x02077083, size: 45 bytes, params: 1, frame: 11
let value = environment.__proto__.__proto__;
value = require(11973) /* metro dependency 11973: WelcomeScreenActionCreators */;
return value.fetchWelcomeScreen(guildId);
}
function _fun91928() { // fn#91928, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12160:3034, offset: 0x02077132, size: 45 bytes, params: 1, frame: 11
let value = environment.__proto__.__proto__;
value = require(11973) /* metro dependency 11973: WelcomeScreenActionCreators */;
return value.welcomeScreenViewed(guildId);
}
function _fun91934({description, channel_id, emoji_id}) { // fn#91934, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12160:3340, offset: 0x020772a8, size: 66 bytes, params: 2, frame: 13
env0_0.push(description);
env0_1.push(channel_id);
if (emoji_id == null) {
}
}