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

312 lines
18 KiB
TypeScript

/* Metro module 8744; source: modules/user_profile/native/UserProfileSpeedBumpActionSheet.tsx; dependencies: [57, 31, 27, 1379, 1945, 1878, 8516, 661, 33, 4501, 697, 8745, 1244, 6231, 6238, 1305, 4002, 4048, 566, 8490, 6771, 6789, 8514, 8746, 683, 8061, 8743, 6275, 6277, 8747, 8748, 4573, 4617, 4578, 5278, 3829, 2] */
import Module00057 from '../../../by-id/module-00057.js'; /* Metro dependency 57 */
import ChannelStore from '../../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
import UserStore from '../../../stores/UserStore.tsx'; /* Metro dependency 1878 */
import GuildMemberStore from '../../../stores/GuildMemberStore.tsx'; /* Metro dependency 1945 */
import UseTheme from '../../../hooks/useTheme.tsx'; /* Metro dependency 4048 */
import UseAnalyticsLocations from '../../app_analytics/useAnalyticsLocations.tsx'; /* Metro dependency 6771 */
import AnalyticsLocation from '../../app_analytics/AnalyticsLocation.tsx'; /* Metro dependency 6789 */
import UseUserProfileAnalyticsProperties from '../hooks/native/useUserProfileAnalyticsProperties.tsx'; /* Metro dependency 8746 */
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 JsxRuntimeModule from '../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
import * as NativeModule from '../../../design/void/native.tsx'; /* Metro dependency 1305 */
import * as SharedModule from '../../../design/shared.tsx'; /* Metro dependency 4002 */
import * as CreateStylesModule from '../../../design/components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */
import * as TextModule from '../../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */
import * as ButtonNativeModule from '../../../design/components/Button/native/Button.native.tsx'; /* Metro dependency 4578 */
import * as TableRowGroupNativeModule from '../../../design/components/TableRow/native/TableRowGroup.native.tsx'; /* Metro dependency 6231 */
import * as TableRowNativeModule from '../../../design/components/TableRow/native/TableRow.native.tsx'; /* Metro dependency 6238 */
import * as BottomSheetNativeModule from '../../../design/components/Sheet/native/BottomSheet.native.tsx'; /* Metro dependency 6275 */
import * as Module06277Module from '../../../by-id/module-06277.js'; /* Metro dependency 6277 */
import * as UseAnalyticsLocationsModule from '../../app_analytics/useAnalyticsLocations.tsx'; /* Metro dependency 6771 */
import * as UserProfileAnalyticsContextModule from '../UserProfileAnalyticsContext.tsx'; /* Metro dependency 8514 */
import * as ConstantsModule2 from '../Constants.tsx'; /* Metro dependency 8516 */
function _fun68465(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#68465, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8929:6, offset: 0x01c4f741, size: 716 bytes, params: 8, frame: 24
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ReactModule;
const createStyles = CreateStylesModule.createStyles;
object = {};
let PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object.button = {paddingHorizontal: PX_16, paddingBottom: 56};
const object3 = {};
let PX_24 = (importDefault(697) /* metro dependency 697: native */).space.PX_24;
object3.marginBottom = PX_24;
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object3.paddingHorizontal = PX_16;
object.tableContainer = object3;
const object4 = {};
PX_24 = (importDefault(697) /* metro dependency 697: native */).space.PX_24;
object4.marginBottom = PX_24;
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object4.marginHorizontal = PX_16;
const PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object4.gap = PX_8;
object.header = object4;
object.bodyText = {textAlign: 'center'};
object.headerText = {textAlign: 'center'};
object.avatar = {alignSelf: 'center'};
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object.avatarContainer = {'position': 'relative', 'alignSelf': 'center', marginTop: PX_16};
const object8 = {'position': 'absolute', 'bottom': -8, 'right': -8};
const PX_4 = (importDefault(697) /* metro dependency 697: native */).space.PX_4;
object8.padding = PX_4;
const BACKGROUND_SURFACE_HIGH = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_SURFACE_HIGH;
object8.backgroundColor = BACKGROUND_SURFACE_HIGH;
object8.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.round;
object.avatarIconContainer = object8;
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object.suppress = {alignSelf: 'center', marginTop: PX_16};
const env0_14 = Reflect.apply(createStyles, CreateStylesModule, [object]);
value = value.memo(UserProfileSpeedBumpActionSheet);
(FileImportTrackerModule).fileFinishedImporting('modules/user_profile/native/UserProfileSpeedBumpActionSheet.tsx');
exports.default = value;
function InformationTable({speedBumpType}) { // fn#68466, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8929:987, offset: 0x01c4fa0d, size: 320 bytes, params: 2, frame: 22
let object = {};
object.icon = importDefault(8745) /* metro dependency 8745 */;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
object.text = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.kcuWva);
const items2 = [object];
object = {icon: importDefault(8745) /* metro dependency 8745 */};
object.text = speedBumpType === 'block' ? intl.string((require(1244) /* metro dependency 1244: indexNative */).t.QxrDY1) : intl.string((require(1244) /* metro dependency 1244: indexNative */).t.W6fjkS);
items2[1] = object;
const TableRowGroup = (TableRowGroupNativeModule).TableRowGroup;
return (
<TableRowGroup hasIcons>
{items2.map(_fun68467)}
</TableRowGroup>
);
function _fun68467(a0, a1) { // fn#68467, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8929:1283, offset: 0x01c4fb4d, size: 163 bytes, params: 3, frame: 22
const TableRow = (TableRowNativeModule).TableRow;
const tableRowProps = {start: a1 === 0, end: env0_0.length === a1};
const Icon = (NativeModule).Icon;
const Icon2 = (NativeModule).Icon;
const Sizes = Icon2.Sizes;
const MEDIUM = Sizes.MEDIUM;
tableRowProps.icon = <Icon size={MEDIUM} source={a0.icon} />;
tableRowProps.label = a0.text;
return <TableRow {...tableRowProps} key={a1} />;
}
}
function UserProfileSpeedBumpActionSheet({userId, channelId, messageId, roleId, sessionId, onClose, location, openedAt, sourceAnalyticsLocations = [], speedBumpType}) { // fn#68468, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8929:1445, offset: 0x01c4fbf0, size: 1972 bytes, params: 2, frame: 48
const styles = useStyles();
const isThemeLight2 = SharedModule.isThemeLight((UseTheme)());
const user = (require(566) /* metro dependency 566: flux */).useStateFromStores([UserStore], function() {
return UserStore.getUser(userId);
});
const user2 = user;
const guild_id = (require(566) /* metro dependency 566: flux */).useStateFromStores([ChannelStore], function() {
return ChannelStore.getChannel(channelId);
}, [channelId])?.guild_id;
const value5 = (require(566) /* metro dependency 566: flux */).useStateFromStores([GuildMemberStore], _fun68471);
const value6 = (importDefault(8490) /* metro dependency 8490: useDisplayProfile */)(user?.id ?? EMPTY_STRING_SNOWFLAKE_ID,
guild_id);
const IGNORED_USER_SHEET = UserProfileAnalyticsTypes.IGNORED_USER_SHEET;
const binding = user2;
const [property, env0_9] = location(binding.useState(false), 2);
const defaultImport2 = UseAnalyticsLocations;
const items2 = [];
const value9 = arraySpread(items2, sourceAnalyticsLocations, 0, channelId);
const IGNORED_PROFILE_ACTION_SHEET = (AnalyticsLocation).IGNORED_PROFILE_ACTION_SHEET;
items2[value9] = IGNORED_PROFILE_ACTION_SHEET;
value9 + 1;
const analyticsLocations = defaultImport2(items2).analyticsLocations;
const value10 = (UserProfileAnalyticsContextModule).useCreateUserProfileAnalyticsContext({layout: 'ACTION_SHEET',
sourceSessionId: sessionId, userId: userId, channelId: channelId, messageId: messageId, roleId: roleId});
binding.useEffect(_fun68472,
[(UseUserProfileAnalyticsProperties)({userId: userId,
user: user, channelId: channelId, guildId: guild_id, displayProfile: value6, guildMember: value5,
type: IGNORED_USER_SHEET}), value6, guild_id, property, value5]);
binding.useEffect(function() {
return _fun68474;
}, [onClose]);
binding.useEffect(_fun68475, [user, userId]);
if (user == null) {
return null;
}
const onPress_684762 = onPress_68476;
const value12 = speedBumpType === 'block';
const AnalyticsLocationProvider = (UseAnalyticsLocationsModule).AnalyticsLocationProvider;
const UserProfileAnalyticsProvider = (UserProfileAnalyticsContextModule).UserProfileAnalyticsProvider;
const fetchStartedAt = value6?.fetchStartedAt;
const fetchEndedAt = value6?.fetchEndedAt;
const isLoaded = value6?.isLoaded;
const BottomSheet = (BottomSheetNativeModule).BottomSheet;
const BottomSheetView = (Module06277Module).BottomSheetView;
const Avatar = (NativeModule).Avatar;
const AvatarSizes = (NativeModule).AvatarSizes;
const XLARGE = AvatarSizes.XLARGE;
const avatar = (
<Avatar
user={user}
guildId={guild_id}
animate={false}
size={XLARGE}
style={styles.avatar}
/>
);
const Icon = (NativeModule).Icon;
const object = {};
const Icon2 = (NativeModule).Icon;
const Sizes = Icon2.Sizes;
const MEDIUM = Sizes.MEDIUM;
object.size = MEDIUM;
if (value12) {
object.source = importDefault(8747) /* metro dependency 8747 */;
} else {
object.source = importDefault(8748) /* metro dependency 8748 */;
}
const items3 = [
<View style={styles.avatarContainer}>
{avatar}
<View style={styles.avatarIconContainer}>
<Icon {...object} />
</View>
</View>,
];
const Text = (TextModule).Text;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const string = intl.string;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
items3[1] = (
<Text
style={styles.headerText}
variant="heading-xl/bold"
color="mobile-text-heading-primary"
accessibilityRole="header"
>
{Reflect.apply(string, intl, [t.b33pLD])}
</Text>
);
const format = intl.format;
const r29 = value12 ? t['8F+WNz'] : t['/cZp5s'];
const object4 = {};
object4.username = (importDefault(4617) /* metro dependency 4617: NicknameUtils */).getName(guild_id, channelId,
user);
items3[2] = (
<Text
style={styles.bodyText}
variant="text-md/medium"
color="mobile-text-heading-primary"
>
{Reflect.apply(format, intl, [r29, object4])}
</Text>
);
const items4 = [
<View style={styles.header}>
{items3}
</View>,
];
items4[1] = (
<View style={styles.tableContainer}>
<InformationTable speedBumpType={speedBumpType} />
</View>
);
const Button = (ButtonNativeModule).Button;
items4[2] = (
<View style={styles.button}>
<Button
variant={isThemeLight2 ? 'tertiary' : 'secondary'}
size="lg"
text={intl.string((require(1244) /* metro dependency 1244: indexNative */).t['UJKH/l'])}
onPress={onPress_684762}
/>
{
speedBumpType !== 'ignore'
? null
: ((PressableOpacity) => <PressableOpacity style={styles.suppress} accessibilityRole="button" onPress={function() {
var IgnoreProfileSpeedbumpDisabled = require(dependencyMap[35]).IgnoreProfileSpeedbumpDisabled;
IgnoreProfileSpeedbumpDisabled.updateSetting(true);
onPress_68476();
}}><Text variant="text-sm/normal" color="text-link">{intl.string((require(1244) /* metro dependency 1244: indexNative */).t.QbcRCJ)}</Text></PressableOpacity>)((require(5278) /* metro dependency 5278: Pressables */).PressableOpacity)
}
</View>
);
return (
<AnalyticsLocationProvider value={analyticsLocations}>
<UserProfileAnalyticsProvider
value={value10}
openedAt={openedAt}
fetchStartedAt={fetchStartedAt}
fetchEndedAt={fetchEndedAt}
isLoaded={isLoaded}
>
<BottomSheet startExpanded>
<BottomSheetView>
{items4}
</BottomSheetView>
</BottomSheet>
</UserProfileAnalyticsProvider>
</AnalyticsLocationProvider>
);
function _fun68471() { // fn#68471, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8929:1847, offset: 0x01c503d9, size: 45 bytes, params: 1, frame: 14
const guild_idBinding = guild_id;
const value2 = null;
return value2 != guild_idBinding ? GuildMemberStore.getMember(guild_id, userId) : value2;
}
function _fun68472() { // fn#68472, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8929:2309, offset: 0x01c50406, size: 131 bytes, params: 1, frame: 15
var value6;
var defaultImport;
if (!(env0_8 || env0_7 == null)) {
if (guild_id == null || env0_6?.fullProfileLoadedTimestamp != null) {
value6 = environment.__proto__;
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
defaultImport.track(AnalyticEvents.OPEN_POPOUT, JsxRuntimeModule.jsx);
env0_9(true);
}
}
}
function _fun68473() { // fn#68473, offset: 0x01c50489, size: 11 bytes, params: 1, frame: 1
return function() {
if (onClose != null) {
onClose();
}
};
function _fun68474() { // fn#68474, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8929:2462, offset: 0x01c50494, size: 27 bytes, params: 1, frame: 10
if (onClose != null) {
onClose();
}
}
}
function _fun68475() { // fn#68475, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8929:2500, offset: 0x01c504af, size: 57 bytes, params: 1, frame: 12
var value2;
var moduleValue;
if (user == null) {
value2 = environment.__proto__;
moduleValue = require(8061) /* metro dependency 8061: UserActionCreators */;
moduleValue.getUser(userId);
}
}
function UserProfileSpeedBumpActionSheetOnPress() { // fn#68476, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8929:2596, owner: UserProfileSpeedBumpActionSheet.onPress, offset: 0x01c504e8, size: 72 bytes, params: 1, frame: 14
let value = environment.__proto__;
value = importDefault(8743) /* metro dependency 8743: showUserProfileActionSheet */;
const object = {};
object.sourceAnalyticsLocations = analyticsLocations;
object.ignoreBlockedSpeedBump = true;
const locationBinding = location;
object.location = locationBinding;
copyDataProperties(object, ConstantsModule.EMPTY_STRING_SNOWFLAKE_ID, locationBinding);
value(object);
}
}
}
global.__d(_fun68465, 8744, [57, 31, 27, 1379, 1945, 1878, 8516, 661, 33, 4501, 697, 8745, 1244, 6231, 6238, 1305,
4002, 4048, 566, 8490, 6771, 6789, 8514, 8746, 683, 8061, 8743, 6275, 6277, 8747, 8748, 4573, 4617, 4578, 5278,
3829,
2]) /* metro module 8744, dependencies: [57, 31, 27, 1379, 1945, 1878, 8516, 661, 33, 4501, 697, 8745, 1244, 6231, 6238, 1305, 4002, 4048, 566, 8490, 6771, 6789, 8514, 8746, 683, 8061, 8743, 6275, 6277, 8747, 8748, 4573, 4617, 4578, 5278, 3829, 2] */;