195 lines
8.8 KiB
TypeScript
195 lines
8.8 KiB
TypeScript
// Metro module 10449 (f10450).
|
|
import { memo, useState, useEffect } from "react";
|
|
import { View } from "react-native";
|
|
import ChannelStore from "../../../stores/ChannelStore";
|
|
import RelationshipStore from "../../../stores/RelationshipStore";
|
|
import UserStore from "../../../stores/UserStore";
|
|
import { UserRemediationAction } from "../RelationshipConstants";
|
|
import { IGNORE_CONFIRMATION_ACTION_SHEET_KEY, RESTRICTION_CONFIRMATION_ACTION_SHEET_HEIGHT } from "./RestrictionConfirmationConstants";
|
|
import { AnalyticEvents, HelpdeskArticles } from "../../../Constants";
|
|
import { createStyles } from "../../../design/components/Styles/native/createStyles";
|
|
import Module712 from "../../../_bundle/Module712";
|
|
import Module8361 from "../../../_bundle/Module8361";
|
|
import { intl, t } from "../../../intl/index.native";
|
|
import Module4147 from "../../../_bundle/Module4147";
|
|
import { TableRowGroup } from "../../../design/components/TableRow/native/TableRowGroup.native";
|
|
import { TableRow } from "../../../design/components/TableRow/native/TableRow.native";
|
|
import { Icon, Avatar, AvatarSizes } from "../../../design/void/native";
|
|
import useSafeAreaInsets_native from "../../safe_area/useSafeAreaInsets.native";
|
|
import useAnalyticsLocations, { AnalyticsLocationProvider } from "../../app_analytics/useAnalyticsLocations";
|
|
import AnalyticsLocation from "../../app_analytics/AnalyticsLocation";
|
|
import { useStateFromStores } from "../../../_bundle/Module589";
|
|
import { getUser } from "../../../actions/UserActionCreators";
|
|
import { BottomSheet } from "../../../design/components/Sheet/native/BottomSheet.native";
|
|
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
|
|
import { BottomSheetScrollView } from "../../../_bundle/Module5245";
|
|
import Module8363 from "../../../_bundle/Module8363";
|
|
import { Text } from "../../../design/components/Text/native/Text";
|
|
import NicknameUtils from "../../../utils/NicknameUtils";
|
|
import Module8364 from "../../../_bundle/Module8364";
|
|
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
|
|
import { ImpressionNames } from "../../../_bundle/Module503";
|
|
import { Button } from "../../../design/components/Button/native/Button.native";
|
|
import RelationshipActionCreators from "../../../actions/RelationshipActionCreators";
|
|
import SafetyToastsActionCreators_native from "../../safety_common/SafetyToastsActionCreators.native";
|
|
import HelpdeskUtils from "../../../utils/HelpdeskUtils";
|
|
import Linking from "../../../lib/native/Linking";
|
|
let useStyles, c6997_17;
|
|
const BlockedInformationTable = function BlockedInformationTable() {
|
|
return <TableRowGroup hasIcons>
|
|
{c6997_17.map((item, index) => <TableRow key={index} start={index === 0} end={c6997_17.length - 1 === index} icon={<Icon size={Icon.Sizes.MEDIUM} source={item.icon} />} label={item.text()} subLabel={item.subtext()} accessible accessibilityLabel={item.a11yLabel()} />)}
|
|
</TableRowGroup>;
|
|
};
|
|
useStyles = createStyles({
|
|
button: {
|
|
alignContent: "center",
|
|
textAlign: "center"
|
|
},
|
|
tableContainer: {
|
|
marginBottom: Module712.space.PX_16
|
|
},
|
|
otherOptions: {
|
|
marginBottom: Module712.space.PX_24
|
|
},
|
|
headerText: {
|
|
textAlign: "center"
|
|
},
|
|
container: {
|
|
flex: 1,
|
|
paddingHorizontal: Module712.space.PX_16,
|
|
paddingTop: Module712.space.PX_16
|
|
},
|
|
header: {
|
|
marginBottom: Module712.space.PX_16
|
|
},
|
|
avatarContainer: {
|
|
position: "relative",
|
|
alignSelf: "center",
|
|
marginBottom: Module712.space.PX_16
|
|
},
|
|
avatarIconContainer: {
|
|
position: "absolute",
|
|
bottom: -8,
|
|
right: -8,
|
|
padding: Module712.space.PX_4,
|
|
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
|
|
borderRadius: Module712.radii.round
|
|
},
|
|
avatar: {
|
|
alignSelf: "center"
|
|
},
|
|
footerText: {
|
|
textAlign: "center",
|
|
marginTop: Module712.space.PX_12,
|
|
paddingBottom: Module712.space.PX_4
|
|
}
|
|
});
|
|
c6997_17 = [{
|
|
icon: Module8361,
|
|
text: () => intl.string(t.fjFJFV),
|
|
subtext: () => intl.string(t["8SIMPz"]),
|
|
a11yLabel: () => intl.string(t.qHsrGS)
|
|
}, {
|
|
icon: Module8361,
|
|
text: () => intl.string(t.QCrmqS),
|
|
subtext: () => intl.string(t.TKDMoN),
|
|
a11yLabel: () => intl.string(t.WR1Mbe)
|
|
}, {
|
|
icon: Module4147,
|
|
text: () => intl.string(t["lkm/a8"]),
|
|
subtext: () => intl.string(t["8j3qaC"]),
|
|
a11yLabel: () => intl.string(t.lfrNw0)
|
|
}];
|
|
const r122 = memo(function BlockConfirmationActionSheet(props) {
|
|
const { userId, channelId, onBlock, onIgnore, onSuccess } = props;
|
|
const styles = useStyles();
|
|
const bottom = useSafeAreaInsets_native().bottom;
|
|
const analyticsLocations = useAnalyticsLocations([AnalyticsLocation.IGNORE_CONFIRMATION_ACTION_SHEET]).analyticsLocations;
|
|
const [disabled, setState] = useState(false);
|
|
const stateFromStores = useStateFromStores([UserStore], () => UserStore.getUser(userId), [userId]);
|
|
const stateFromStores3 = useStateFromStores([RelationshipStore], () => RelationshipStore.isIgnored(userId), [userId]);
|
|
const stateFromStores2 = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(channelId)?.guild_id, [channelId]);
|
|
useEffect(() => {
|
|
if (stateFromStores == null) {
|
|
getUser(userId);
|
|
}
|
|
}, [stateFromStores, userId]);
|
|
return stateFromStores != null ? <AnalyticsLocationProvider value={analyticsLocations}>
|
|
<BottomSheet onDismiss={function onDismiss() {
|
|
AnalyticsUtils.track(AnalyticEvents.USER_REMEDIATION_ACTION, {
|
|
action: UserRemediationAction.DISMISS_BLOCK,
|
|
location: "user-profile-context-menu"
|
|
});
|
|
}} scrollable startHeight={(stateFromStores3 ? 485 : RESTRICTION_CONFIRMATION_ACTION_SHEET_HEIGHT) + bottom + Module712.space.PX_24 + Module712.space.PX_24} bodyStyles={{
|
|
paddingBottom: Module712.space.PX_24 + bottom,
|
|
...styles.container
|
|
}}>
|
|
<BottomSheetScrollView>
|
|
<View style={styles.header}>
|
|
<View style={styles.avatarContainer}>
|
|
<Avatar guildId={void 0} user={stateFromStores} animate={false} size={AvatarSizes.XLARGE} style={styles.avatar} />
|
|
<View style={styles.avatarIconContainer}>
|
|
<Icon size={Icon.Sizes.MEDIUM} source={Module8363} />
|
|
</View>
|
|
</View>
|
|
<Text style={styles.headerText} variant="heading-xl/bold" color="mobile-text-heading-primary" accessibilityRole="header">
|
|
{intl.format(t.CIbzHR, {
|
|
username: NicknameUtils.getName(stateFromStores2, channelId, stateFromStores)
|
|
})}
|
|
</Text>
|
|
<Text style={styles.headerText} variant="heading-md/medium" color="text-default" accessibilityRole="header">
|
|
{intl.string(t.S70jou)}
|
|
</Text>
|
|
</View>
|
|
<View style={styles.tableContainer}>
|
|
<BlockedInformationTable />
|
|
</View>
|
|
{stateFromStores3 ? !stateFromStores3 : <View style={styles.otherOptions}>
|
|
<TableRowGroup title={intl.string(t["+BJTcB"])} hasIcons>
|
|
<TableRow icon={<Icon size={Icon.Sizes.MEDIUM} source={Module8364} />} label={intl.string(t.hC8tcc)} subLabel={intl.string(t.If89rE)} accessibilityLabel={intl.string(t["8qGQsM"])} onPress={() => {
|
|
AnalyticsUtils.track(AnalyticEvents.USER_REMEDIATION_ACTION, {
|
|
action: UserRemediationAction.GOTO_IGNORE,
|
|
location: "user-profile-context-menu"
|
|
});
|
|
ActionSheetActionCreators.openLazy(import("./IgnoreConfirmationActionSheet"), IGNORE_CONFIRMATION_ACTION_SHEET_KEY, {
|
|
userId,
|
|
channelId,
|
|
onSuccess,
|
|
onIgnore,
|
|
impressionName: ImpressionNames.IGNORE_USER_CONFIRMATION
|
|
}, "replaceTopSheet");
|
|
}} arrow />
|
|
</TableRowGroup>
|
|
</View>}
|
|
<View style={styles.button}>
|
|
<Button size="lg" variant="destructive" text={intl.string(t.l4Emac)} onPress={() => {
|
|
setState(true);
|
|
RelationshipActionCreators.blockUser(userId, {
|
|
location: AnalyticsLocation.BLOCK_CONFIRMATION_ACTION_SHEET
|
|
}).then(() => {
|
|
SafetyToastsActionCreators_native.showBlockSuccessToast(userId, channelId);
|
|
if (onSuccess != null) {
|
|
onSuccess();
|
|
}
|
|
ActionSheetActionCreators.hideActionSheet();
|
|
});
|
|
if (onBlock != null) {
|
|
onBlock();
|
|
}
|
|
AnalyticsUtils.track(AnalyticEvents.BLOCK_USER_CONFIRMED);
|
|
}} disabled={disabled} loading={disabled} />
|
|
<Text style={styles.footerText} variant="text-sm/normal" color="text-default">
|
|
{intl.format(t.CpTgBn, {
|
|
articleLink: function articleLink() {
|
|
ActionSheetActionCreators.hideActionSheet();
|
|
Linking.openURL(HelpdeskUtils.getArticleURL(HelpdeskArticles.STEALTH_REMEDIATION_FEATURE_GUIDE));
|
|
}
|
|
})}
|
|
</Text>
|
|
</View>
|
|
</BottomSheetScrollView>
|
|
</BottomSheet>
|
|
</AnalyticsLocationProvider> : null;
|
|
});
|
|
export default r122;
|