Files
discord-decomp/sources/modules/connections/native/GuildRoleConnectionsScreen.tsx
T
2026-07-28 01:06:53 +03:00

365 lines
21 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] */
import Module00057 from '../../../by-id/module-00057.js'; /* Metro dependency 57 */
import AuthenticationStore from '../../../stores/AuthenticationStore.tsx'; /* Metro dependency 1226 */
import UserRecord from '../../../records/UserRecord.tsx'; /* Metro dependency 1885 */
import GuildRoleStore from '../../../stores/GuildRoleStore.tsx'; /* Metro dependency 1938 */
import GuildMemberStore from '../../../stores/GuildMemberStore.tsx'; /* Metro dependency 1945 */
import HelpdeskUtils from '../../../utils/HelpdeskUtils.tsx'; /* Metro dependency 1948 */
import UseTheme from '../../../hooks/useTheme.tsx'; /* Metro dependency 4048 */
import ActionSheetActionCreators from '../../action_sheet/native/ActionSheetActionCreators.tsx'; /* Metro dependency 4080 */
import GuildActionCreators from '../../../actions/GuildActionCreators.tsx'; /* Metro dependency 6593 */
import VerifiedRoleIcon from './VerifiedRoleIcon.tsx'; /* Metro dependency 6812 */
import UserSummaryItem from '../../../components_native/common/UserSummaryItem.tsx'; /* Metro dependency 10881 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactNativeModule from '../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
import * as ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as NativeModule from '../../../design/void/native.tsx'; /* Metro dependency 1305 */
import * as TextModule from '../../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */
import * as TextWithIOSLinkWorkaroundModule from '../../a11y/native/TextWithIOSLinkWorkaround.tsx'; /* Metro dependency 6766 */
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
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ReactNativeModule;
const env0_5 = value.View;
const env0_6 = value.Pressable;
const env0_7 = value.ScrollView;
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;
object = {};
const BACKGROUND_BASE_LOWER = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOWER;
object.container = {backgroundColor: BACKGROUND_BASE_LOWER, flex: 1};
object.content = {'flexDirection': 'column', 'alignItems': 'center', 'padding': 16};
object.infoText = {marginTop: 24};
object.verifiedRoles = {'marginTop': 24, 'flexDirection': 'column', 'width': '100%'};
const object4 = {'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;
object4.borderColor = BORDER_SUBTLE;
object4.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.md;
object.verifiedRole = object4;
const object5 = {};
let BACKGROUND_BASE_LOWEST = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOWEST;
object5.borderColor = BACKGROUND_BASE_LOWEST;
BACKGROUND_BASE_LOWEST = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOWEST;
object5.backgroundColor = BACKGROUND_BASE_LOWEST;
object.verifiedRoleHasRole = object5;
const BORDER_MUTED = (importDefault(697) /* metro dependency 697: native */).colors.BORDER_MUTED;
object.verifiedRolePressed = {borderColor: BORDER_MUTED};
object.verifiedRoleIcon = {marginRight: 12};
const BACKGROUND_BRAND = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BRAND;
object.roleCheckmark = {'width': 20, 'height': 20, 'borderRadius': 10, 'backgroundColor': null,
'position': 'absolute', 'right': -8, 'top': -8, backgroundColor: BACKGROUND_BRAND};
object.verifiedRoleName = {'flex': 1, 'overflow': 'hidden', 'marginRight': 32};
object.platformIconContainer = {flexDirection: 'row'};
object.cutout = {marginRight: -6};
const env0_16 = Reflect.apply(createStyles, value, [object]);
object = {};
const CutoutDirection = (NativeModule).CutoutDirection;
const RIGHT = CutoutDirection.RIGHT;
object.direction = RIGHT;
object.radius = 8;
(FileImportTrackerModule).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 = (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 = (TextWithIOSLinkWorkaroundModule).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 = 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 object;
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;
object = {};
binding = env0_6;
object.role_ids = binding.map(function(a0) {
return a0.role_id;
});
moduleValue = require(4863) /* metro dependency 4863: AppAnalyticsUtils */;
copyDataProperties(object, moduleValue.collectGuildAnalyticsMetadata(guildId), binding);
Reflect.apply(track, defaultImport, [PASSPORT_ENTRY_VIEWED, object]);
}
}
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 = (GuildActionCreators).getGuildRoleConnectionsConfigurations;
value = Reflect.apply(getGuildRoleConnectionsConfigurations, value, [guildId]);
value.then(_fun87171);
function _fun87171(a0) { // fn#87171, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11558:1849, offset: 0x00eab16a, size: 19 bytes, params: 2, frame: 11
return env1_7(a0);
}
}
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 object = {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 stylesBinding = styles;
items2[1] = (
<VerifiedRoleIcon
style={stylesBinding.verifiedRoleIcon}
guildId={guildId}
role={a0}
size={24}
/>
);
const Text = (TextModule).Text;
items2[2] = (
<Text
variant="text-md/medium"
color="mobile-text-heading-primary"
lineClamp={1}
style={stylesBinding.verifiedRoleName}
>
{a0.name}
</Text>
);
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 {...object} 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 _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 userRecord2;
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};
userRecord2 = new UserRecord();
cutoutableAvatarImageProps.user = userRecord2;
userRecord2 = environment.__proto__.__proto__;
cutoutableAvatarImageProps.guildId = guildId;
cutoutableAvatarImageProps.style = styles.cutout;
cutoutableAvatarImageProps.cutout = r7;
Reflect.apply(push, binding, [<CutoutableAvatarImage {...cutoutableAvatarImageProps} key={a0} />]);
}
}
return value4;
}
}
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 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__;
(ActionSheetActionCreators).hideActionSheet();
value = importDefault(6593) /* metro dependency 6593: GuildActionCreators */;
value.unassignGuildRoleConnection(require, env0_0.id);
}
}
}
}
}
}
global.__d(_fun87163, 11372, [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]) /* metro module 11372, 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] */;