decord/source/modules/connections/native/ConnectionsRoleMessageBadgeActionSheet.tsx

409 lines
17 KiB
TypeScript
Raw Normal View History

2026-08-08 06:10:11 +00:00
// Module ID: 11217
// Function ID: 11218
2026-07-20 16:05:17 +00:00
// Name: PopoutCheck
2026-08-08 06:10:11 +00:00
// Dependencies: [32, 19, 17, 1911, 1218, 1971, 1964, 1891, 11218, 5125, 676, 21, 4303, 712, 1236, 5124, 4255, 4299, 4239, 12, 4005, 5000, 11038, 9131, 1297, 1416, 4153, 38, 5728, 5748, 589, 698, 4498, 5232, 5397, 5772, 4714, 4271, 11041, 8783, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-08-08 06:10:11 +00:00
// Module 11217 (PopoutCheck)
2026-07-29 08:29:29 +00:00
import collectGuildAnalyticsMetadata from "collectGuildAnalyticsMetadata";
import apply from "apply";
import get_ActivityIndicator from "Text";
import createdAt from "createdAt";
import fetchFingerprint from "fetchFingerprint";
import trackCommunicationDisabled from "trackCommunicationDisabled";
import createGuildRoleRecordFromRust from "createGuildRoleRecordFromRust";
import createGuildRecordFromRust from "createGuildRecordFromRust";
import map from "map";
2026-07-23 10:11:24 +00:00
import { OperatorTypes } from "OperatorTypes";
import ME from "ME";
2026-07-29 08:29:29 +00:00
import jsxProd from "getPlatformUserUrl";
import createCacheKey from "createCacheKey";
2026-07-23 10:11:24 +00:00
2026-07-29 08:29:29 +00:00
let c5;
2026-07-23 10:11:24 +00:00
let closure_14;
let closure_15;
let closure_16;
let closure_17;
let closure_18;
let closure_6;
const require = arg1;
2026-07-20 16:05:17 +00:00
function PopoutCheck(arg0) {
let connectionMetadataField;
let connectionType;
let description;
let operator;
let value;
({ operator, value, description } = arg0);
({ connectionType, connectionMetadataField } = arg0);
2026-07-29 08:29:29 +00:00
const tmp = createCacheKey();
2026-07-20 16:05:17 +00:00
if (null != description) {
if (OperatorTypes.LESS_THAN === operator) {
2026-07-29 08:29:29 +00:00
const intl = require(1236) /* getSystemLocale */.intl;
let obj = { description: null, count: null };
obj[0] = description;
2026-07-20 16:05:17 +00:00
const _Math = Math;
const _Number = Number;
2026-07-29 08:29:29 +00:00
obj[1] = Math.max(0, Number(value) - 1);
let formatResult = intl.format(require(1236) /* getSystemLocale */.t["2p7dA3"], obj);
2026-07-20 16:05:17 +00:00
} else {
formatResult = description;
2026-07-29 08:29:29 +00:00
if (tmp5.GREATER_THAN === operator) {
const intl2 = require(1236) /* getSystemLocale */.intl;
obj = { description: null, count: null };
obj[0] = description;
2026-07-20 16:05:17 +00:00
const _Math2 = Math;
const _Number2 = Number;
2026-07-29 08:29:29 +00:00
obj[1] = Math.max(0, Number(value) + 1);
formatResult = intl2.format(require(1236) /* getSystemLocale */.t["2p7dA3"], obj);
2026-07-20 16:05:17 +00:00
}
}
} else {
2026-08-08 06:10:11 +00:00
obj = require(5124) /* officialApplicationIds */;
2026-07-29 08:29:29 +00:00
const obj1 = { connectionType: null, connectionMetadataField: null, operator: null, value: null };
obj1[0] = connectionType;
obj1[1] = connectionMetadataField;
obj1[2] = operator;
obj1[3] = value;
2026-07-20 16:05:17 +00:00
formatResult = obj.getConnectionsCheckText(obj1);
}
let tmp9 = null;
if (null != formatResult) {
2026-07-29 08:29:29 +00:00
const obj2 = { style: null, children: null };
obj2[0] = tmp.popoutCheck;
const obj3 = { size: "sm", style: null };
obj3[1] = tmp.popoutCheckIcon;
2026-08-08 06:10:11 +00:00
const items = [callback(require(4255) /* CheckmarkLargeIcon */.CheckmarkLargeIcon, obj3), ];
2026-07-29 08:29:29 +00:00
const obj4 = { variant: "text-xs/medium", color: "mobile-text-heading-primary", children: null };
obj4[2] = formatResult;
2026-08-08 06:10:11 +00:00
items[1] = callback(require(4299) /* Text */.Text, obj4);
2026-07-29 08:29:29 +00:00
obj2[1] = items;
2026-07-23 10:11:24 +00:00
tmp9 = callback2(closure_6, obj2);
2026-07-20 16:05:17 +00:00
}
return tmp9;
}
class PopoutChecks {
constructor(arg0) {
2026-07-23 10:11:24 +00:00
guildId = global.guildId;
2026-07-29 08:29:29 +00:00
guildId = undefined;
c2 = undefined;
c3 = undefined;
c4 = undefined;
GREEN_330 = undefined;
guildId = Fragment();
2026-07-23 10:11:24 +00:00
c2 = require("useTheme")();
obj = require("apply");
2026-07-20 16:05:17 +00:00
groupByResult = obj.groupBy(global.eligibilityStates, (application_id) => {
let str = "";
if (null != application_id.application_id) {
const _HermesInternal = HermesInternal;
str = ":" + application_id.application_id;
}
return "" + application_id.connection_type + str;
});
2026-07-29 08:29:29 +00:00
c3 = groupByResult;
2026-07-20 16:05:17 +00:00
keys = Object.keys(groupByResult);
2026-07-23 10:11:24 +00:00
c4 = keys.length - 1;
obj2 = require("map");
2026-07-29 08:29:29 +00:00
GREEN_330 = obj2.useToken(require("Themes").unsafe_rawColors.GREEN_330);
2026-07-20 16:05:17 +00:00
obj = {
children: keys.map((arg0, arg1) => {
const found = arr.filter((operator) => null != operator.operator);
const found1 = arr.find((application) => null != application.application);
2026-07-29 08:29:29 +00:00
let obj = lib(table[21]);
2026-07-20 16:05:17 +00:00
const value = obj.get(arg0);
let application;
2026-07-29 08:29:29 +00:00
if (found1 != null) {
2026-07-20 16:05:17 +00:00
application = found1.application;
}
let bot;
2026-07-29 08:29:29 +00:00
if (application != null) {
2026-07-20 16:05:17 +00:00
bot = application.bot;
}
2026-07-29 08:29:29 +00:00
let tmp7 = null;
2026-07-20 16:05:17 +00:00
if (null != bot) {
2026-07-29 08:29:29 +00:00
tmp7 = new outer1_7(application.bot);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const officialApplicationIds = guildId(tmp3[15]).officialApplicationIds;
let str;
if (application != null) {
str = application.id;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (str == null) {
str = "";
2026-07-20 16:05:17 +00:00
}
if (officialApplicationIds.includes(str)) {
2026-07-29 08:29:29 +00:00
obj = { style: null, guildId: null, roleColor: null, size: 16 };
obj[0] = lib.botTag;
obj[1] = guildId;
obj[2] = closure_5;
let tmp12 = outer1_16(tmp2(tmp3[22]), obj);
} else if (null != tmp7) {
obj = { style: null, verified: false };
obj[0] = lib.botTag;
tmp12 = outer1_16(tmp2(tmp3[23]), obj);
2026-07-20 16:05:17 +00:00
}
const items = [lib.popoutChecksGroup, ];
let prop = null;
2026-07-29 08:29:29 +00:00
if (arg1 < apply) {
prop = tmp21.popoutChecksGroupBottomMargin;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const obj1 = { style: items, children: null };
2026-07-20 16:05:17 +00:00
items[1] = prop;
2026-07-29 08:29:29 +00:00
const obj2 = { style: lib.popoutCheckGroupName, children: null };
2026-07-20 16:05:17 +00:00
if (null == value) {
const items1 = [null, , , ];
2026-07-29 08:29:29 +00:00
let tmp26 = null;
if (null != tmp7) {
2026-08-04 21:03:28 +00:00
const obj3 = { style: null, user: null, size: null, guildId: "Array" };
2026-07-29 08:29:29 +00:00
obj3[0] = tmp21.popoutCheckGroupPlatformIcon;
obj3[1] = tmp7;
obj3[2] = tmp11(tmp3[24]).AvatarSizes.XSMALL;
tmp26 = outer1_16(tmp11(tmp3[24]).Avatar, obj3);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
items1[1] = tmp26;
2026-07-20 16:05:17 +00:00
let name;
2026-07-29 08:29:29 +00:00
if (value != null) {
2026-07-20 16:05:17 +00:00
name = value.name;
}
2026-07-29 08:29:29 +00:00
if (name == null) {
2026-07-20 16:05:17 +00:00
let name1;
2026-07-29 08:29:29 +00:00
if (application != null) {
2026-07-20 16:05:17 +00:00
name1 = application.name;
}
name = name1;
}
2026-07-29 08:29:29 +00:00
const obj4 = { variant: "text-sm/medium", color: "interactive-text-active", children: null };
obj4[2] = name;
items1[2] = outer1_16(tmp11(tmp3[17]).Text, obj4);
items1[3] = tmp12;
obj2[1] = items1;
2026-07-20 16:05:17 +00:00
const items2 = [
2026-07-29 08:29:29 +00:00
tmp19(tmp20, obj2),
2026-07-20 16:05:17 +00:00
found.map((description) => {
let connection_metadata_field;
let connection_type;
let operator;
let value;
({ connection_type, connection_metadata_field, operator, value } = description);
2026-07-29 08:29:29 +00:00
callback(38)(null != connectionMetadataField, "connectionMetadataField is null");
callback(38)(null != operator, "operator is null");
callback(38)(null != value, "value is null");
return callback2(closure_20, { connectionType, connectionMetadataField, operator, value, description: description.description }, "" + connectionType + ":" + connectionMetadataField + ":" + operator + ":" + value);
2026-07-20 16:05:17 +00:00
})
];
2026-07-29 08:29:29 +00:00
obj1[1] = items2;
return tmp19(tmp20, obj1, arg0);
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
const obj5 = { style: null, source: null, disableColor: true, size: null };
obj5[0] = tmp21.popoutCheckGroupPlatformIcon;
let tmp11Result = tmp11(tmp3[25]);
tmp11Result = tmp11(tmp3[26]);
2026-07-20 16:05:17 +00:00
const icon = value.icon;
2026-07-29 08:29:29 +00:00
obj5[1] = tmp11Result.makeSource(tmp11Result.isThemeDark(table) ? icon.darkPNG : icon.lightPNG);
obj5[3] = tmp11(tmp3[24]).Icon.Sizes.MEDIUM;
outer1_16(tmp11(tmp3[24]).Icon, obj5);
const tmp23 = outer1_16;
2026-07-20 16:05:17 +00:00
}
})
};
return jsx(Fragment, obj);
}
}
2026-07-29 08:29:29 +00:00
({ ActivityIndicator: c5, View: closure_6 } = get_ActivityIndicator);
2026-07-23 10:11:24 +00:00
({ AnalyticEvents: closure_14, EMPTY_STRING_SNOWFLAKE_ID: closure_15 } = ME);
({ jsx: closure_16, jsxs: closure_17, Fragment: closure_18 } = jsxProd);
2026-07-29 08:29:29 +00:00
createCacheKey = { container: { flexDirection: "column", alignItems: "center", padding: 16 }, header: null, verifiedContainer: null, headerTextContainer: null, verifiedCheck: null, loadingSpinner: null, popoutCheck: null, popoutCheckIcon: null, popoutChecksGroup: null, popoutChecksGroupBottomMargin: null, popoutCheckGroupName: null, popoutCheckGroupPlatformIcon: null, button: null, botTag: null };
createCacheKey = { width: "100%", flexDirection: "row", alignItems: "center", paddingBottom: 16, borderBottomWidth: 1, borderBottomColor: require("Themes").colors.BORDER_SUBTLE, marginBottom: require("Themes").space.PX_24 };
createCacheKey[1] = createCacheKey;
createCacheKey[2] = { marginRight: 8, height: 24, width: 24 };
createCacheKey[3] = { flexShrink: 1, flexDirection: "column" };
createCacheKey[4] = { position: "absolute", left: 0, top: 0 };
createCacheKey[5] = { marginVertical: 40 };
createCacheKey[6] = { flexDirection: "row", alignItems: "center", marginTop: 8, marginLeft: 32, paddingRight: 20 };
createCacheKey[7] = { marginRight: 8, tintColor: require("Themes").colors.TEXT_FEEDBACK_POSITIVE };
createCacheKey[8] = { width: "100%", marginBottom: 24 };
let obj1 = { marginRight: 8, tintColor: require("Themes").colors.TEXT_FEEDBACK_POSITIVE };
createCacheKey[9] = { paddingBottom: 12, borderBottomWidth: 1, borderBottomColor: require("Themes").colors.BORDER_SUBTLE, marginBottom: 12 };
createCacheKey[10] = { flexDirection: "row", alignItems: "center" };
createCacheKey[11] = { marginRight: 8 };
createCacheKey[12] = { marginBottom: 8 };
createCacheKey[13] = { marginLeft: 4 };
createCacheKey = createCacheKey.createStyles(createCacheKey);
let obj2 = { paddingBottom: 12, borderBottomWidth: 1, borderBottomColor: require("Themes").colors.BORDER_SUBTLE, marginBottom: 12 };
2026-07-23 10:11:24 +00:00
let result = require("get ActivityIndicator").fileFinishedImporting("modules/connections/native/ConnectionsRoleMessageBadgeActionSheet.tsx");
2026-07-20 16:05:17 +00:00
export default function ConnectionsRoleMessageBadgeActionSheet(userId) {
userId = userId.userId;
const roleId = userId.roleId;
const channelId = userId.channelId;
const guildId = userId.guildId;
2026-07-29 08:29:29 +00:00
let analyticsLocations;
let stateFromStores;
let closure_6;
let stateFromStores2;
let first;
let trackCommunicationDisabled;
let tmp = createCacheKey();
analyticsLocations = roleId(channelId[28])(roleId(channelId[29]).CONNECTIONS_ROLE_POPOUT).analyticsLocations;
2026-07-23 10:11:24 +00:00
let obj = userId(channelId[30]);
2026-07-29 08:29:29 +00:00
const items = [createGuildRecordFromRust];
stateFromStores = obj.useStateFromStores(items, () => outer1_11.getGuild(guildId));
2026-07-23 10:11:24 +00:00
let obj1 = userId(channelId[30]);
const items1 = [first];
2026-07-29 08:29:29 +00:00
closure_6 = obj1.useStateFromStores(items1, () => first.getId());
2026-07-23 10:11:24 +00:00
let obj2 = userId(channelId[30]);
2026-07-29 08:29:29 +00:00
const items2 = [trackCommunicationDisabled];
2026-07-20 16:05:17 +00:00
const stateFromStores1 = obj2.useStateFromStores(items2, () => member.getMember(guildId, closure_6));
2026-07-23 10:11:24 +00:00
let obj3 = userId(channelId[30]);
2026-07-29 08:29:29 +00:00
const items3 = [map];
stateFromStores2 = obj3.useStateFromStores(items3, () => outer1_12.getGuildRoleConnectionEligibility(roleId));
let obj4 = analyticsLocations;
const tmp8 = guildId(analyticsLocations.useState(null == stateFromStores2), 2);
first = tmp8[0];
trackCommunicationDisabled = tmp8[1];
if (stateFromStores1 != null) {
2026-07-20 16:05:17 +00:00
const roles = stateFromStores1.roles;
const hasItem = roles.includes(roleId);
}
const items4 = [userId, roleId, channelId, guildId];
2026-07-29 08:29:29 +00:00
const effect = obj4.useEffect(() => {
2026-07-20 16:05:17 +00:00
let obj = roleId(channelId[31]);
obj = { other_user_id: userId, role_id: roleId };
const merged = Object.assign(userId(channelId[32]).collectChannelAnalyticsMetadataFromId(channelId));
const obj3 = userId(channelId[32]);
const merged1 = Object.assign(userId(channelId[32]).collectGuildAnalyticsMetadata(guildId));
2026-07-23 10:11:24 +00:00
obj.track(outer1_14.PASSPORT_ROLE_POPOUT_VIEWED, obj);
2026-07-20 16:05:17 +00:00
}, items4);
const items5 = [guildId, roleId, first, stateFromStores2];
2026-07-29 08:29:29 +00:00
const effect1 = obj4.useEffect(() => {
2026-07-20 16:05:17 +00:00
let tmp = first;
if (first) {
tmp = null == stateFromStores2;
}
if (tmp) {
const guildRoleConnectionsEligibility = roleId(channelId[33]).fetchGuildRoleConnectionsEligibility(guildId, roleId);
2026-07-29 08:29:29 +00:00
guildRoleConnectionsEligibility.then(() => callback(false));
2026-07-20 16:05:17 +00:00
const obj = roleId(channelId[33]);
}
}, items5);
2026-07-29 08:29:29 +00:00
if (stateFromStores2 != null) {
2026-07-20 16:05:17 +00:00
const flatResult = stateFromStores2.flat();
const someResult = stateFromStores2.flat().some((application_id) => undefined === application_id.application_id);
}
2026-07-29 08:29:29 +00:00
const tmp2 = roleId;
const tmp4 = roleId(channelId[28]);
const items6 = [createGuildRoleRecordFromRust];
const stateFromStores3 = userId(channelId[30]).useStateFromStores(items6, () => {
2026-07-20 16:05:17 +00:00
let role;
if (null != stateFromStores) {
2026-07-29 08:29:29 +00:00
role = outer1_10.getRole(tmp.id, roleId);
2026-07-20 16:05:17 +00:00
}
return role;
});
if (null != stateFromStores2) {
if (1 === stateFromStores2.length) {
2026-07-29 08:29:29 +00:00
obj = { value: null, children: null };
obj[0] = analyticsLocations;
obj = { style: null, children: null };
obj[0] = tmp.container;
obj1 = { style: null, children: null };
obj1[0] = tmp.header;
obj2 = { style: null, children: null };
obj2[0] = tmp.verifiedContainer;
obj3 = { style: null, guildId: null, role: null, size: 24 };
obj3[0] = tmp.verifiedCheck;
2026-07-20 16:05:17 +00:00
let id;
2026-07-29 08:29:29 +00:00
if (stateFromStores != null) {
2026-07-20 16:05:17 +00:00
id = stateFromStores.id;
}
2026-07-29 08:29:29 +00:00
if (id == null) {
2026-07-20 16:05:17 +00:00
id = closure_15;
}
2026-07-29 08:29:29 +00:00
obj3[1] = id;
obj3[2] = stateFromStores3;
obj2[1] = closure_16(tmp2(tmp3[35]), obj3);
const items7 = [closure_16(closure_6, obj2), ];
obj4 = { style: null, children: null };
obj4[0] = tmp.headerTextContainer;
2026-07-20 16:05:17 +00:00
let name;
2026-07-29 08:29:29 +00:00
if (stateFromStores3 != null) {
2026-07-20 16:05:17 +00:00
name = stateFromStores3.name;
}
2026-07-29 08:29:29 +00:00
const obj5 = { variant: "text-lg/semibold", color: "mobile-text-heading-primary", children: null };
obj5[2] = name;
const items8 = [closure_16(tmp5(tmp3[17]).Text, obj5), ];
const obj6 = { variant: "text-xs/normal", color: "text-default", children: null };
obj6[2] = formatResult;
items8[1] = closure_16(tmp5(tmp3[17]).Text, obj6);
obj4[1] = items8;
items7[1] = closure_17(closure_6, obj4);
obj1[1] = items7;
const items9 = [closure_17(closure_6, obj1), ];
2026-07-20 16:05:17 +00:00
if (null != stateFromStores2) {
if (null != stateFromStores2.flat()) {
2026-07-29 08:29:29 +00:00
const obj7 = { eligibilityStates: null, guildId: null };
obj7[0] = stateFromStores2.flat();
obj7[1] = guildId;
const items10 = [tmp16(PopoutChecks, obj7), , ];
let tmp16Result = null;
2026-07-20 16:05:17 +00:00
if (!hasItem) {
2026-07-29 08:29:29 +00:00
const obj8 = { style: null, children: null };
obj8[0] = tmp.button;
const obj9 = { onPress: null, text: null, variant: "primary", grow: true };
obj9[0] = function onPress() {
let obj = roleId(channelId[37]);
obj.hideActionSheet("ConnectionsRoleMessageBadgeActionSheet");
obj = { guildId };
const result = userId(channelId[38]).openGuildRoleConnectionsModal(obj);
2026-07-20 16:05:17 +00:00
};
2026-07-29 08:29:29 +00:00
const intl4 = tmp5(tmp3[14]).intl;
obj9[1] = intl4.string(tmp5(tmp3[14]).t.T1t1WV);
obj8[1] = tmp16(tmp5(tmp3[36]).Button, obj9);
tmp16Result = tmp16(tmp18, obj8);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
items10[1] = tmp16Result;
tmp16Result = null;
2026-07-20 16:05:17 +00:00
if (someResult) {
2026-07-29 08:29:29 +00:00
const obj10 = { style: null, children: null };
obj10[0] = tmp.button;
const obj11 = { onPress: null, text: null, variant: "secondary", grow: true };
obj11[0] = function onPress() {
roleId(channelId[39])({ userId, channelId, roleId, sourceAnalyticsLocations: analyticsLocations });
2026-07-20 16:05:17 +00:00
};
2026-07-29 08:29:29 +00:00
const intl5 = tmp5(tmp3[14]).intl;
obj11[1] = intl5.string(tmp5(tmp3[14]).t.hgKDnG);
obj10[1] = tmp16(tmp5(tmp3[36]).Button, obj11);
tmp16Result = tmp16(tmp18, obj10);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const obj12 = { children: null };
items10[2] = tmp16Result;
obj12[0] = items10;
let tmp16Result1 = tmp17(closure_18, obj12);
const tmp25 = closure_18;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const obj13 = { children: null };
items9[1] = tmp16Result1;
obj[1] = items9;
obj13[0] = tmp17(tmp18, obj);
obj[1] = tmp16(tmp5(tmp3[34]).BottomSheet, obj13);
return tmp16(tmp5(tmp3[28]).AnalyticsLocationProvider, obj);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const obj14 = { style: null, size: "large" };
obj14[0] = tmp.loadingSpinner;
tmp16Result1 = tmp16(stateFromStores, obj14);
const tmp21 = stateFromStores3;
const tmp2Result = tmp2(tmp3[35]);
2026-07-20 16:05:17 +00:00
}
if (1 === stateFromStores2.length) {
2026-07-29 08:29:29 +00:00
const intl2 = tmp5(tmp3[14]).intl;
formatResult = intl2.format(tmp5(tmp3[14]).t["0eBj3x"], {});
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
const intl = tmp5(tmp3[14]).intl;
formatResult = intl.format(tmp5(tmp3[14]).t.D7uftB, {});
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
const intl3 = tmp5(tmp3[14]).intl;
formatResult = intl3.string(tmp5(tmp3[14]).t.jDym4E);
2026-07-20 16:05:17 +00:00
};
export { PopoutChecks };