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

338 lines
20 KiB
TypeScript

/* Metro module 11435; source: modules/connections/native/ConnectionsRoleMessageBadgeActionSheet.tsx; dependencies: [57, 31, 27, 1885, 1226, 1945, 1938, 1867, 11436, 5044, 661, 33, 4501, 697, 1244, 5043, 4064, 4573, 4048, 22, 3860, 4915, 11367, 8706, 1305, 1423, 4002, 44, 6771, 6789, 566, 683, 4863, 6593, 6275, 6812, 4578, 4080, 11370, 8743, 2] */
function _fun87515(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#87515, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11621:6, offset: 0x01fc1553, size: 743 bytes, params: 8, frame: 26
var object3;
const env0_0 = require;
const closure = PopoutChecks;
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.ActivityIndicator;
const env0_6 = value.View;
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 */;
const guildStore = importDefault(1867) /* metro dependency 1867: GuildStore */;
const guildRoleConnectionEligibilityStore = importDefault(11436) /* metro dependency 11436: GuildRoleConnectionEligibilityStore */;
const env0_13 = (require(5044) /* metro dependency 5044: Constants */).OperatorTypes;
value = require(661) /* metro dependency 661: Constants */;
const env0_14 = value.AnalyticEvents;
const env0_15 = value.EMPTY_STRING_SNOWFLAKE_ID;
value = require(33) /* metro dependency 33 */;
const env0_16 = value.jsx;
const env0_17 = value.jsxs;
const env0_18 = value.Fragment;
value = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = value.createStyles;
object3 = {container: {'flexDirection': 'column', 'alignItems': 'center', 'padding': 16}};
const object4 = {'width': '100%', 'flexDirection': 'row', 'alignItems': 'center', 'paddingBottom': 16,
'borderBottomWidth': 1};
let BORDER_SUBTLE = (importDefault(697) /* metro dependency 697: native */).colors.BORDER_SUBTLE;
object4.borderBottomColor = BORDER_SUBTLE;
const PX_24 = (importDefault(697) /* metro dependency 697: native */).space.PX_24;
object4.marginBottom = PX_24;
object3.header = object4;
object3.verifiedContainer = {'marginRight': 8, 'height': 24, 'width': 24};
object3.headerTextContainer = {'flexShrink': 1, 'flexDirection': 'column'};
object3.verifiedCheck = {'position': 'absolute', 'left': 0, 'top': 0};
object3.loadingSpinner = {marginVertical: 40};
object3.popoutCheck = {'flexDirection': 'row', 'alignItems': 'center', 'marginTop': 8, 'marginLeft': 32,
'paddingRight': 20};
const TEXT_FEEDBACK_POSITIVE = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_FEEDBACK_POSITIVE;
object3.popoutCheckIcon = {marginRight: 8, tintColor: TEXT_FEEDBACK_POSITIVE};
object3.popoutChecksGroup = {'width': '100%', 'marginBottom': 24};
BORDER_SUBTLE = (importDefault(697) /* metro dependency 697: native */).colors.BORDER_SUBTLE;
object3.popoutChecksGroupBottomMargin = {'paddingBottom': 12, 'borderBottomWidth': 1, 'borderBottomColor': null,
'marginBottom': 12, borderBottomColor: BORDER_SUBTLE};
object3.popoutCheckGroupName = {'flexDirection': 'row', 'alignItems': 'center'};
object3.popoutCheckGroupPlatformIcon = {marginRight: 8};
object3.button = {marginBottom: 8};
object3.botTag = {marginLeft: 4};
const env0_19 = Reflect.apply(createStyles, value, [object3]);
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/connections/native/ConnectionsRoleMessageBadgeActionSheet.tsx');
exports.default = ConnectionsRoleMessageBadgeActionSheet;
exports.PopoutChecks = closure;
}
function PopoutCheck({connectionType, connectionMetadataField, operator, value, description}) { // fn#87516, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11621:1324, offset: 0x01fc183a, size: 513 bytes, params: 2, frame: 24
var r9;
var r0;
var moduleValue;
var object2;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
var format;
var property;
var Math;
var max;
const styles = useStyles();
if (description != null) {
if (OperatorTypes.LESS_THAN === operator) {
format = intl.format;
property = (require(1244) /* metro dependency 1244: indexNative */).t['2p7dA3'];
object2 = {description: description};
Math = global.Math;
max = Math.max;
value = global.Number(value);
object2.count = Reflect.apply(max, Math, [0, value - 1]);
value = Reflect.apply(format, intl, [property, object2]);
r9 = value;
} else if (OperatorTypes.GREATER_THAN !== operator) {
r9 = description;
} else {
format = intl.format;
property = (require(1244) /* metro dependency 1244: indexNative */).t['2p7dA3'];
object2 = {description: description};
Math = global.Math;
max = Math.max;
value = global.Number(value);
object2.count = Reflect.apply(max, Math, [0, value + 1]);
value = Reflect.apply(format, intl, [property, object2]);
r9 = value;
}
} else {
moduleValue = require(5043) /* metro dependency 5043: ConnectionsUtils */;
value = moduleValue.getConnectionsCheckText({connectionType: connectionType,
connectionMetadataField: connectionMetadataField, operator: operator, value: value});
r9 = value;
}
if (r9 == null) {
r0 = null;
} else {
var viewBindingProps = {style: styles.popoutCheck};
const CheckmarkLargeIcon = (require(4064) /* metro dependency 4064: CheckmarkLargeIcon */).CheckmarkLargeIcon;
value = <CheckmarkLargeIcon size="sm" style={styles.popoutCheckIcon} />;
value = <View {...viewBindingProps}>{value}{((Text) => <Text variant="text-xs/medium" color="mobile-text-heading-primary">{r9}</Text>)((require(4573) /* metro dependency 4573: Text */).Text)}</View>;
r0 = value;
}
return r0;
}
function PopoutChecks({eligibilityStates, guildId}) { // fn#87517, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11621:2021, offset: 0x01fc1a3b, size: 227 bytes, params: 2, frame: 18
const env0_1 = useStyles();
const env0_2 = (importDefault(4048) /* metro dependency 4048: useTheme */)();
const value2 = (importDefault(22) /* metro dependency 22 */).groupBy(eligibilityStates, function(a0) {
var connection_type = a0.connection_type;
var value = '';
return value + connection_type + (a0.application_id != null ? ':' + a0.application_id : value);
});
const Object = global.Object;
const value3 = Object.keys(value2);
const env0_4 = value3.length - 1;
const useTokenModule = require(3860) /* metro dependency 3860: useToken */;
const useToken = useTokenModule.useToken;
const GREEN_330 = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.GREEN_330;
const env0_5 = Reflect.apply(useToken, useTokenModule, [GREEN_330]);
return (
<>
{value3.map(_fun87519)}
</>
);
}
function ConnectionsRoleMessageBadgeActionSheet({userId, roleId, channelId, guildId}) { // fn#87523, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11621:3763, offset: 0x01fc1f66, size: 1622 bytes, params: 2, frame: 42
var r18;
var r16;
var r11;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
var jsxRuntimeEnv0_18Binding;
var items4;
const Button = (require(4578) /* metro dependency 4578: ButtonNative */).Button;
var object14;
var object16;
const env0_3 = guildId;
const styles = useStyles();
const defaultImport = importDefault(6771) /* metro dependency 6771: useAnalyticsLocations */;
const CONNECTIONS_ROLE_POPOUT = (importDefault(6789) /* metro dependency 6789: AnalyticsLocation */).CONNECTIONS_ROLE_POPOUT;
const analyticsLocations = defaultImport(CONNECTIONS_ROLE_POPOUT).analyticsLocations;
const env0_4 = analyticsLocations;
const guild = (require(566) /* metro dependency 566: flux */).useStateFromStores([GuildStore], function() {
return GuildStore.getGuild(guildId);
});
const id = (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 guildRoleConnectionEligibility = (require(566) /* metro dependency 566: flux */).useStateFromStores([GuildRoleConnectionEligibilityStore],
function() {
return GuildRoleConnectionEligibilityStore.getGuildRoleConnectionEligibility(roleId);
});
let binding = env0_4;
const [property, env0_9] = env0_3(binding.useState(guildRoleConnectionEligibility == null), 2);
const r19 = member == null ? undefined : member.roles.includes(roleId);
binding = env0_4;
binding.useEffect(_fun87528, [userId, roleId, channelId, guildId]);
binding.useEffect(_fun87529, [guildId, roleId, property, guildRoleConnectionEligibility]);
const r17 = guildRoleConnectionEligibility == null ? undefined : guildRoleConnectionEligibility.flat().some(function(a0) {
return a0.application_id === undefined;
});
const value9 = (require(566) /* metro dependency 566: flux */).useStateFromStores([GuildRoleStore], _fun87532);
const r29 = guildRoleConnectionEligibility == null ? intl.string((require(1244) /* metro dependency 1244: indexNative */).t.jDym4E) : guildRoleConnectionEligibility.length !== 1 ? guildRoleConnectionEligibility.length === 1 ? intl.format((require(1244) /* metro dependency 1244: indexNative */).t['0eBj3x'],
{}) : intl.format((require(1244) /* metro dependency 1244: indexNative */).t.D7uftB,
{}) : guildRoleConnectionEligibility[0].length === 1 ? intl.string((require(1244) /* metro dependency 1244: indexNative */).t.jDym4E) : guildRoleConnectionEligibility.length === 1 ? intl.format((require(1244) /* metro dependency 1244: indexNative */).t['0eBj3x'],
{}) : intl.format((require(1244) /* metro dependency 1244: indexNative */).t.D7uftB, {});
const AnalyticsLocationProvider = (require(6771) /* metro dependency 6771: useAnalyticsLocations */).AnalyticsLocationProvider;
const BottomSheet = (require(6275) /* metro dependency 6275: BottomSheetNative */).BottomSheet;
const view = <View style={styles.verifiedContainer}>{((Component) => <Component style={styles.verifiedCheck} guildId={guild?.id ?? EMPTY_STRING_SNOWFLAKE_ID} role={value9 ?? undefined} size={24} />)(importDefault(6812) /* metro dependency 6812: VerifiedRoleIcon */)}</View>;
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
const view2 = <View style={styles.header}>{view}<View style={styles.headerTextContainer}><Text variant="text-lg/semibold" color="mobile-text-heading-primary">{value9?.name}</Text><Text variant="text-xs/normal" color="text-default">{r29}</Text></View></View>;
if (guildRoleConnectionEligibility == null) {
r11 = <ActivityIndicator style={styles.loadingSpinner} size="large" />;
} else if (guildRoleConnectionEligibility.flat() != null) {
jsxRuntimeEnv0_18Binding = jsxRuntimeEnv0_18;
items4 = [<PopoutChecks eligibilityStates={guildRoleConnectionEligibility.flat()} guildId={guildId} />];
if (r19) {
r18 = null;
} else {
r18 = <View style={styles.button}><Button onPress={onPress_87533} text={intl.string((require(1244) /* metro dependency 1244: indexNative */).t.T1t1WV)} variant="primary" grow /></View>;
}
items4[1] = r18;
if (r17) {
r16 = <View style={styles.button}><Button onPress={onPress_87534} text={intl.string((require(1244) /* metro dependency 1244: indexNative */).t.hgKDnG)} variant="secondary" grow /></View>;
} else {
r16 = null;
}
items4[2] = r16;
r11 = <>{items4}</>;
} else {
r11 = <ActivityIndicator style={styles.loadingSpinner} size="large" />;
}
return (
<AnalyticsLocationProvider value={analyticsLocations}>
<BottomSheet>
<View style={styles.container}>
{view2}
{r11}
</View>
</BottomSheet>
</AnalyticsLocationProvider>
);
}
function _fun87519(a0, a1) { // fn#87519, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11621:2315, offset: 0x01fc1b1e, size: 884 bytes, params: 3, frame: 37
var r23;
var r13;
var userRecord;
var Icon;
var moduleValue;
var makeSource;
var isThemeDark2;
var icon;
const property = env0_3[a0];
const value2 = property.filter(function(a0) {
return a0.operator != null;
});
const value3 = property.find(function(a0) {
return a0.application != null;
});
const value5 = undefined;
const value6 = (importDefault(4915) /* metro dependency 4915: Platforms */).get(a0);
const value7 = null;
const application = value7 == value3 ? value5 : value3.application;
if (value7 != (value7 == application ? value5 : application.bot)) {
userRecord = new UserRecord(application.bot);
} else {
r23 = value7;
}
const officialApplicationIds = (require(5043) /* metro dependency 5043: ConnectionsUtils */).officialApplicationIds;
const includes = officialApplicationIds.includes;
const id = value7 == application ? value5 : application.id;
const r11 = Reflect.apply(includes, officialApplicationIds,
[value7 != id ? id : '']) ? ((Component) => <Component style={styles.botTag} guildId={guildId} roleColor={env0_5} size={16} />)(importDefault(11367) /* metro dependency 11367: OfficialConnectionIcon */) : value7 != r23 ? ((Component) => <Component style={styles.botTag} verified={false} />)(importDefault(8706) /* metro dependency 8706: BotTag */) : value5;
const items4 = [styles.popoutChecksGroup];
items4[1] = a1 < env0_4 ? styles.popoutChecksGroupBottomMargin : value7;
if (value7 != value6) {
Icon = (require(1305) /* metro dependency 1305: native */).Icon;
var iconProps = {style: styles.popoutCheckGroupPlatformIcon};
moduleValue = require(1423) /* metro dependency 1423: AvatarUtils */;
makeSource = moduleValue.makeSource;
isThemeDark2 = (require(4002) /* metro dependency 4002: shared */).isThemeDark(env0_2);
icon = value6.icon;
iconProps.source = Reflect.apply(makeSource, moduleValue, [isThemeDark2 ? icon.darkPNG : icon.lightPNG]);
iconProps.disableColor = true;
iconProps.size = (require(1305) /* metro dependency 1305: native */).Icon.Sizes.MEDIUM;
r13 = <Icon {...iconProps} />;
} else {
r13 = value7;
}
const items2 = [r13];
items2[1] = value7 != r23 ? ((Avatar) => <Avatar style={styles.popoutCheckGroupPlatformIcon} user={r23} size={(require(1305) /* metro dependency 1305: native */).AvatarSizes.XSMALL} guildId={value5} />)((require(1305) /* metro dependency 1305: native */).Avatar) : value7;
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
const name = value7 == value6 ? value5 : value6.name;
items2[2] = <Text variant="text-sm/medium" color="interactive-text-active">{value7 != name ? name : value7 == application ? value5 : application.name}</Text>;
items2[3] = r11;
const items3 = [<View style={styles.popoutCheckGroupName}>{items2}</View>];
items3[1] = value2.map(_fun87522);
return (
<View style={items4} key={a0}>
{items3}
</View>
);
}
function _fun87528() { // fn#87528, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11621:4269, offset: 0x01fc25f9, size: 140 bytes, params: 1, frame: 21
let value = environment.__proto__;
const defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
const track = defaultImport.track;
const PASSPORT_ROLE_POPOUT_VIEWED = AnalyticEvents.PASSPORT_ROLE_POPOUT_VIEWED;
const object2 = {};
object2.other_user_id = userId;
object2.role_id = roleId;
value = require(4863) /* metro dependency 4863: AppAnalyticsUtils */;
copyDataProperties(object2, value.collectChannelAnalyticsMetadataFromId(channelId), value);
const appAnalyticsUtilsModule = require(4863) /* metro dependency 4863: AppAnalyticsUtils */;
copyDataProperties(object2, appAnalyticsUtilsModule.collectGuildAnalyticsMetadata(guildId), value);
Reflect.apply(track, defaultImport, [PASSPORT_ROLE_POPOUT_VIEWED, object2]);
}
function _fun87529() { // fn#87529, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11621:4472, offset: 0x01fc2685, size: 91 bytes, params: 1, frame: 13
var environment;
var value3;
var defaultImport;
if (env0_8 && guildRoleConnectionEligibility == null) {
value3 = environment.__proto__;
defaultImport = importDefault(6593) /* metro dependency 6593: GuildActionCreators */;
defaultImport.fetchGuildRoleConnectionsEligibility(guildId, roleId).then(_fun87530);
}
}
function _fun87532() { // fn#87532, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11621:4675, offset: 0x01fc2703, size: 52 bytes, params: 1, frame: 14
return guild != null ? GuildRoleStore.getRole(guild.id, roleId) : undefined;
}
function ConnectionsRoleMessageBadgeActionSheetOnPress() { // fn#87533, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11621:5600, owner: ConnectionsRoleMessageBadgeActionSheet.onPress, offset: 0x01fc2737, size: 84 bytes, params: 1, frame: 14
const value = environment.__proto__;
(importDefault(4080) /* metro dependency 4080: ActionSheetActionCreators */).hideActionSheet('ConnectionsRoleMessageBadgeActionSheet');
(require(11370) /* metro dependency 11370: GuildRoleConnectionsModalActionCreators */).openGuildRoleConnectionsModal({guildId: guildId});
}
function ConnectionsRoleMessageBadgeActionSheetOnPress_87534() { // fn#87534, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11621:5864, owner: ConnectionsRoleMessageBadgeActionSheet.onPress, offset: 0x01fc278b, size: 71 bytes, params: 1, frame: 13
const value = environment.__proto__;
(importDefault(8743) /* metro dependency 8743: showUserProfileActionSheet */)({userId: userId, channelId: channelId,
roleId: roleId, sourceAnalyticsLocations: analyticsLocations});
}
function _fun87522({connection_type, connection_metadata_field, operator, value, description}) { // fn#87522, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11621:3313, offset: 0x01fc1e92, size: 212 bytes, params: 2, frame: 28
(importDefault(44) /* metro dependency 44 */)(connection_metadata_field != null, 'connectionMetadataField is null');
(importDefault(44) /* metro dependency 44 */)(operator != null, 'operator is null');
(importDefault(44) /* metro dependency 44 */)(value != null, 'value is null');
return (
<PopoutCheck
connectionType={connection_type}
connectionMetadataField={connection_metadata_field}
operator={operator}
value={value}
description={description}
key={'' + connection_type + ':' + connection_metadata_field + ':' + operator + ':' + value}
/>
);
}
function _fun87530() { // fn#87530, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11621:4546, offset: 0x01fc26e0, size: 18 bytes, params: 1, frame: 11
return env1_9(false);
}