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

315 lines
17 KiB
TypeScript

/* Metro module 11372; source: modules/connections/native/GuildRoleConnectionsScreen.tsx; dependencies: [57, 31, 27, 1885, 1226, 1945, 1938, 661, 33, 4501, 697, 1305, 4048, 566, 683, 4863, 6593, 4080, 11373, 1962, 11363, 11370, 4915, 1423, 4002, 6766, 1244, 1948, 11369, 6812, 4573, 10881, 2] */
function _fun87163(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#87163, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11558:6, offset: 0x01fb1a1d, size: 731 bytes, params: 8, frame: 24
var object2;
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importDefault(57) /* metro dependency 57 */;
const env0_4 = importAll(31) /* metro dependency 31 */;
let value = require(27) /* metro dependency 27 */;
const env0_5 = value.View;
const env0_6 = value.Pressable;
const env0_7 = value.ScrollView;
const userRecord = importDefault(1885) /* metro dependency 1885: UserRecord */;
const authenticationStore = importDefault(1226) /* metro dependency 1226: AuthenticationStore */;
const guildMemberStore = importDefault(1945) /* metro dependency 1945: GuildMemberStore */;
const guildRoleStore = importDefault(1938) /* metro dependency 1938: GuildRoleStore */;
value = require(661) /* metro dependency 661: Constants */;
const env0_12 = value.AnalyticEvents;
const env0_13 = value.HelpdeskArticles;
value = require(33) /* metro dependency 33 */;
const env0_14 = value.jsx;
const env0_15 = value.jsxs;
value = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = value.createStyles;
object2 = {};
const BACKGROUND_BASE_LOWER = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOWER;
object2.container = {backgroundColor: BACKGROUND_BASE_LOWER, flex: 1};
object2.content = {'flexDirection': 'column', 'alignItems': 'center', 'padding': 16};
object2.infoText = {marginTop: 24};
object2.verifiedRoles = {'marginTop': 24, 'flexDirection': 'column', 'width': '100%'};
const object3 = {'flexDirection': 'row', 'borderColor': null, 'borderWidth': 2, 'borderRadius': null,
'paddingHorizontal': 16, 'paddingVertical': 20, 'marginBottom': 16, 'width': '100%', 'alignItems': 'center',
'position': 'relative'};
const BORDER_SUBTLE = (importDefault(697) /* metro dependency 697: native */).colors.BORDER_SUBTLE;
object3.borderColor = BORDER_SUBTLE;
object3.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.md;
object2.verifiedRole = object3;
const object6 = {};
let BACKGROUND_BASE_LOWEST = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOWEST;
object6.borderColor = BACKGROUND_BASE_LOWEST;
BACKGROUND_BASE_LOWEST = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOWEST;
object6.backgroundColor = BACKGROUND_BASE_LOWEST;
object2.verifiedRoleHasRole = object6;
const BORDER_MUTED = (importDefault(697) /* metro dependency 697: native */).colors.BORDER_MUTED;
object2.verifiedRolePressed = {borderColor: BORDER_MUTED};
object2.verifiedRoleIcon = {marginRight: 12};
const BACKGROUND_BRAND = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BRAND;
object2.roleCheckmark = {'width': 20, 'height': 20, 'borderRadius': 10, 'backgroundColor': null,
'position': 'absolute', 'right': -8, 'top': -8, backgroundColor: BACKGROUND_BRAND};
object2.verifiedRoleName = {'flex': 1, 'overflow': 'hidden', 'marginRight': 32};
object2.platformIconContainer = {flexDirection: 'row'};
object2.cutout = {marginRight: -6};
const env0_16 = Reflect.apply(createStyles, value, [object2]);
object2 = {};
const CutoutDirection = (require(1305) /* metro dependency 1305: native */).CutoutDirection;
const RIGHT = CutoutDirection.RIGHT;
object2.direction = RIGHT;
object2.radius = 8;
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/connections/native/GuildRoleConnectionsScreen.tsx');
exports.default = GuildRoleConnectionsScreen;
}
function GuildRoleConnectionsScreen({guildId, onCloseModal}) { // fn#87164, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11558:1312, offset: 0x01fb1cf8, size: 605 bytes, params: 2, frame: 30
const styles = useStyles();
const env0_3 = (importDefault(4048) /* metro dependency 4048: useTheme */)();
const sortedRoles = (require(566) /* metro dependency 566: flux */).useStateFromStores([GuildRoleStore],
function() {
return GuildRoleStore.getSortedRoles(guildId);
});
const env0_4 = (require(566) /* metro dependency 566: flux */).useStateFromStores([AuthenticationStore],
function() {
return AuthenticationStore.getId();
});
const member = (require(566) /* metro dependency 566: flux */).useStateFromStores([GuildMemberStore], function() {
return GuildMemberStore.getMember(guildId, id);
});
const binding = env0_4;
let [property, env0_7] = env0_3(binding.useState([]), 2);
binding.useEffect(_fun87168, [guildId, property]);
binding.useEffect(_fun87170, [guildId]);
if (member == null) {
return null;
}
const value4 = sortedRoles.filter(function(a0) {
return a0.tags.guild_connections === null;
});
const TextWithIOSLinkWorkaround = (require(6766) /* metro dependency 6766: TextWithIOSLinkWorkaround */).TextWithIOSLinkWorkaround;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const format = intl.format;
property = (require(1244) /* metro dependency 1244: indexNative */).t['Y+TsEV'];
const defaultImport = importDefault(1948) /* metro dependency 1948: HelpdeskUtils */;
const getArticleURL = defaultImport.getArticleURL;
const CONNECTION_DETAILS = HelpdeskArticles.CONNECTION_DETAILS;
return (
<View style={styles.container}>
<ScrollView contentContainerStyle={styles.content}>
<TextWithIOSLinkWorkaround
style={styles.infoText}
variant="heading-md/semibold"
color="mobile-text-heading-primary"
>
{Reflect.apply(format, intl, [property, {helpdeskArticleUrl: Reflect.apply(getArticleURL,
defaultImport, [CONNECTION_DETAILS])}])}
</TextWithIOSLinkWorkaround>
<View style={styles.verifiedRoles}>
{value4.map(_fun87173)}
</View>
</ScrollView>
</View>
);
}
function _fun87168() { // fn#87168, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11558:1625, offset: 0x01fb1fa3, size: 136 bytes, params: 1, frame: 20
var environment;
var value2;
var defaultImport;
var track;
var PASSPORT_ENTRY_VIEWED;
var object2;
var binding;
var moduleValue;
if (env0_6.length !== 0) {
value2 = environment.__proto__;
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
track = defaultImport.track;
PASSPORT_ENTRY_VIEWED = AnalyticEvents.PASSPORT_ENTRY_VIEWED;
object2 = {};
binding = env0_6;
object2.role_ids = binding.map(function(a0) {
return a0.role_id;
});
moduleValue = require(4863) /* metro dependency 4863: AppAnalyticsUtils */;
copyDataProperties(object2, moduleValue.collectGuildAnalyticsMetadata(guildId), binding);
Reflect.apply(track, defaultImport, [PASSPORT_ENTRY_VIEWED, object2]);
}
}
function _fun87170() { // fn#87170, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11558:1788, offset: 0x01fb2036, size: 64 bytes, params: 1, frame: 12
var environment;
let value = environment.__proto__;
const getGuildRoleConnectionsConfigurations = (importDefault(6593) /* metro dependency 6593: GuildActionCreators */).getGuildRoleConnectionsConfigurations;
value = Reflect.apply(getGuildRoleConnectionsConfigurations, value, [guildId]);
value.then(_fun87171);
}
function _fun87173(a0) { // fn#87173, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11558:2309, offset: 0x01fb2076, size: 513 bytes, params: 2, frame: 27
var r7;
var Icon;
const env0_0 = a0;
const roles = member.roles;
const value2 = roles.includes(a0.id);
const iconsForConnectionRole = getIconsForConnectionRole(a0.id);
const object2 = {accessibilityRole: 'button', style: style_87178, onPress: onPress_87179};
if (value2) {
var viewBindingProps = {style: styles.roleCheckmark};
Icon = (require(1305) /* metro dependency 1305: native */).Icon;
r7 = <View {...viewBindingProps}><Icon size={(require(1305) /* metro dependency 1305: native */).Icon.Sizes.SMALL_20} source={importDefault(11369) /* metro dependency 11369 */} color={(importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.WHITE} /></View>;
} else {
r7 = null;
}
const items2 = [r7];
const VerifiedRoleIcon = importDefault(6812) /* metro dependency 6812: VerifiedRoleIcon */;
const stylesBinding = styles;
items2[1] = <VerifiedRoleIcon style={stylesBinding.verifiedRoleIcon} guildId={guildId} role={a0} size={24} />;
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
items2[2] = <Text variant="text-md/medium" color="mobile-text-heading-primary" lineClamp={1} style={stylesBinding.verifiedRoleName}>{a0.name}</Text>;
const UserSummaryItem = importDefault(10881) /* metro dependency 10881: UserSummaryItem */;
const platformIconContainer = stylesBinding.platformIconContainer;
const AvatarSizes = (require(1305) /* metro dependency 1305: native */).AvatarSizes;
const XSMALL = AvatarSizes.XSMALL;
items2[3] = <UserSummaryItem style={platformIconContainer} users={[]} renderedUsers={iconsForConnectionRole} max={3} withNames={false} avatarSize={XSMALL} withPlusCount />;
return (
<Pressable {...object2} key={a0.id}>
{items2}
</Pressable>
);
}
function getIconsForConnectionRole(a0) { // fn#87174, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11558:2344, offset: 0x01fb2277, size: 154 bytes, params: 2, frame: 15
var environment;
const env0_0 = a0;
let value = environment.__proto__;
value = env1_6.find(_fun87175);
if (value != null) {
var Set = global.Set;
var set = new Set();
value = value.rules.flat();
value.forEach(_fun87176);
var Array = global.Array;
value = Array.from(set);
value.forEach(_fun87177);
}
return [];
}
function style_87178({pressed}) { // fn#87178, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11558:3144, offset: 0x01fb2554, size: 77 bytes, params: 2, frame: 6
return [styles.verifiedRole, env0_1 ? styles.verifiedRoleHasRole : null,
pressed ? styles.verifiedRolePressed : null];
}
function onPress_87179() { // fn#87179, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11558:3242, offset: 0x01fb25a1, size: 167 bytes, params: 1, frame: 21
var environment;
var value2;
var defaultImport;
var openLazy;
var value3;
var moduleValue2;
const binding = env0_1;
const binding2 = env0_0;
const guildIdBinding = guildId;
if (binding) {
renderLeaveRoleActionSheet(binding2, guildIdBinding);
} else {
value2 = environment.__proto__.__proto__;
defaultImport = importDefault(dependencyMap[17]);
openLazy = defaultImport.openLazy;
value3 = require(dependencyMap[19])(dependencyMap[20], dependencyMap.paths);
moduleValue2 = require(dependencyMap[21]);
Reflect.apply(openLazy, defaultImport, [value3,
moduleValue2.makeGuildRoleConnectionsConnectAccountsActionSheetKey(binding2.id), {role: binding2,
guildId: guildIdBinding, onCloseModal: onCloseModal}]);
}
}
function _fun87175({role_id}) { // fn#87175, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11558:2401, offset: 0x01fb2311, size: 22 bytes, params: 2, frame: 2
return role_id === env0_0;
}
function _fun87176(a0) { // fn#87176, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11558:2489, offset: 0x01fb2327, size: 65 bytes, params: 2, frame: 13
var binding;
if (a0.application_id === undefined) {
binding = env0_3;
binding.add(a0.connection_type);
} else {
binding = env0_3;
binding.add(a0.application_id);
}
}
function _fun87177(a0, a1) { // fn#87177, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11558:2594, offset: 0x01fb2368, size: 492 bytes, params: 3, frame: 25
var binding;
var property;
var push;
const CutoutableAvatarImage = (require(1305) /* metro dependency 1305: native */).CutoutableAvatarImage;
var userRecord;
var value5;
var value6;
var defaultImport2;
var makeSource;
var moduleValue;
var isThemeDark;
var value7;
var isThemeDark2;
var value8;
var value;
const size = env0_3.size;
const value2 = null;
const r7 = a1 === size - 1 ? value2 : env3_17;
const isNaN = global.isNaN;
const parseInt = global.parseInt;
const value4 = undefined;
if (isNaN(parseInt(a0))) {
value5 = environment.__proto__.__proto__.__proto__;
value6 = (importDefault(4915) /* metro dependency 4915: Platforms */).get(a0);
defaultImport2 = importDefault(1423) /* metro dependency 1423: AvatarUtils */;
makeSource = defaultImport2.makeSource;
moduleValue = require(4002) /* metro dependency 4002: shared */;
isThemeDark = moduleValue.isThemeDark;
value7 = environment.__proto__.__proto__;
isThemeDark2 = Reflect.apply(isThemeDark, moduleValue, [env2_3]);
value8 = value2 == value6;
env0_1.push(<CutoutableAvatarImage size={(require(1305) /* metro dependency 1305: native */).AvatarSizes.XSMALL} source={Reflect.apply(makeSource,
defaultImport2,
[isThemeDark2 ? value8 ? value4 : value6.icon.darkPNG : value8 ? value4 : value6.icon.lightPNG])} style={styles.cutout} cutout={r7} key={a0} />);
} else {
property = env0_2.applications[a0];
if (value4 !== (value2 == property ? value4 : property.bot)) {
binding = env0_1;
push = binding.push;
value = environment.__proto__.__proto__.__proto__;
var cutoutableAvatarImageProps = {size: (require(1305) /* metro dependency 1305: native */).AvatarSizes.XSMALL};
userRecord = new UserRecord();
cutoutableAvatarImageProps.user = userRecord;
userRecord = environment.__proto__.__proto__;
cutoutableAvatarImageProps.guildId = guildId;
cutoutableAvatarImageProps.style = styles.cutout;
cutoutableAvatarImageProps.cutout = r7;
Reflect.apply(push, binding, [<CutoutableAvatarImage {...cutoutableAvatarImageProps} key={a0} />]);
}
}
return value4;
}
function renderLeaveRoleActionSheet(a0, a1) { // fn#87180, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11558:3248, owner: onPress_87179.renderLeaveRoleActionSheet, offset: 0x01fb2648, size: 133 bytes, params: 3, frame: 18
var environment;
const env0_0 = a0;
const env0_1 = a1;
let value = environment.__proto__.__proto__.__proto__;
const defaultImport = importDefault(dependencyMap[17]);
const openLazy = defaultImport.openLazy;
value = require(dependencyMap[19]);
value = value(dependencyMap[18], dependencyMap.paths);
Reflect.apply(openLazy, defaultImport, [value, 'LeaveConnectionRoleActionSheet-' + a0.id,
{onLeaveRolePressed: onLeaveRolePressed}]);
}
function onLeaveRolePressed() { // fn#87181, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11558:3392, owner: onPress_87179.renderLeaveRoleActionSheet.onLeaveRolePressed, offset: 0x01fb26cd, size: 77 bytes, params: 1, frame: 14
let value = environment.__proto__.__proto__.__proto__.__proto__;
(importDefault(4080) /* metro dependency 4080: ActionSheetActionCreators */).hideActionSheet();
value = importDefault(6593) /* metro dependency 6593: GuildActionCreators */;
value.unassignGuildRoleConnection(require, env0_0.id);
}