120 lines
5.2 KiB
TypeScript
120 lines
5.2 KiB
TypeScript
// Metro module 11060 (f11061).
|
|
import _objectWithoutProperties from "../../../_bundle/_objectWithoutProperties";
|
|
import { View } from "react-native";
|
|
import AuthenticationStore from "../../../stores/AuthenticationStore";
|
|
import GuildMemberStore from "../../../stores/GuildMemberStore";
|
|
import GuildStore from "../../../stores/GuildStore";
|
|
import { QUARANTINE_USER_ALERT_KEY } from "../Constants";
|
|
import { AnalyticEvents, UserSettingsSections } from "../../../Constants";
|
|
import { GuildMemberFlags } from "../../guild_member/GuildMemberConstants";
|
|
import { createStyles } from "../../../design/components/Styles/native/createStyles";
|
|
import Module712 from "../../../_bundle/Module712";
|
|
import Alert from "../../../components_native/common/Alert";
|
|
import { intl, t } from "../../../intl/index.native";
|
|
import { Icon } from "../../../design/void/native";
|
|
import Module11061 from "../../../_bundle/Module11061";
|
|
import { Text } from "../../../design/components/Text/native/Text";
|
|
import { useOpenFixQuarantinedProfileModal } from "../AutomodQuarantineUtils";
|
|
import { openUserSettings } from "../../user_settings/core/native/openUserSettings";
|
|
import { useStateFromStores } from "../../../_bundle/defaultAreStatesEqual";
|
|
import { getAutomodReason, getAutomodQuarantinedGuildMemberFlags } from "../AutomodPermissionUtils";
|
|
import useMountEffect from "../../../hooks/useMountEffect";
|
|
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
|
|
let _excluded, _excluded2, _excluded3, useStyles, PerServerProfileAlert, ServerTagAlert;
|
|
const ChatBlockedAlert = function ChatBlockedAlert(props) {
|
|
const { title, description, buttonCta, onConfirm: onConfirm2, ...rest } = props;
|
|
const styles = useStyles();
|
|
return <Alert {...rest} style={styles.wrapper} cancelText={intl.string(t["ETE/oC"])} onCancel={rest?.onClose} confirmText={buttonCta} onConfirm={onConfirm2}>
|
|
<View style={styles.body}>
|
|
<Icon source={Module11061} size={Icon.Sizes.CUSTOM} style={styles.mainIcon} />
|
|
<Text style={styles.title} accessibilityRole="header" variant="heading-md/medium" color="mobile-text-heading-primary">{title}</Text>
|
|
<Text style={styles.description} variant="text-sm/medium" color="text-default">{description}</Text>
|
|
</View>
|
|
</Alert>;
|
|
};
|
|
PerServerProfileAlert = function PerServerProfileAlert(props) {
|
|
const { guildId: guildId2, guildName, automodReason, ...rest } = props;
|
|
let description = automodReason === GuildMemberFlags.AUTOMOD_QUARANTINED_USERNAME_OR_GUILD_NICKNAME ? intl.string(t.SpDXI7) : intl.string(t.TBeZmG);
|
|
let [c18507_0, r46] = useOpenFixQuarantinedProfileModal({
|
|
guildId: guildId2
|
|
});
|
|
if (!r46) {
|
|
description = intl.string(t.FFj5Dt);
|
|
}
|
|
const buttonCta = r46 ? intl.string(t["/PGQf0"]) : intl.string(t.WikgZ1);
|
|
return <ChatBlockedAlert {...rest} title={intl.format(t.kcYdTq, {
|
|
guildName
|
|
})} description={description} buttonCta={buttonCta} onConfirm={function onConfirm() {
|
|
c18507_0();
|
|
}} />;
|
|
};
|
|
ServerTagAlert = function ServerTagAlert(props) {
|
|
const guildName = props.guildName;
|
|
return <ChatBlockedAlert {..._objectWithoutProperties(props, _excluded3)} title={intl.format(t.c8TwbL, {
|
|
guildName
|
|
})} description={intl.string(t.EJJLHp)} buttonCta={intl.string(t.Viksoo)} onConfirm={function onConfirm() {
|
|
openUserSettings({
|
|
screen: UserSettingsSections.PROFILE_CUSTOMIZATION
|
|
});
|
|
}} />;
|
|
};
|
|
_excluded = ["title", "description", "buttonCta", "onConfirm"];
|
|
_excluded2 = ["guildId", "guildName", "automodReason"];
|
|
_excluded3 = ["guildName"];
|
|
useStyles = createStyles({
|
|
wrapper: {
|
|
padding: 16
|
|
},
|
|
body: {
|
|
flexDirection: "column",
|
|
alignItems: "center"
|
|
},
|
|
mainIcon: {
|
|
width: 48,
|
|
height: 48,
|
|
tintColor: Module712.colors.TEXT_FEEDBACK_CRITICAL,
|
|
marginBottom: 16
|
|
},
|
|
title: {
|
|
marginBottom: 16,
|
|
textAlign: "center"
|
|
},
|
|
description: {
|
|
textAlign: "center"
|
|
}
|
|
});
|
|
export default function AutomodUserProfileQuarantineAlert(props) {
|
|
let r49;
|
|
const guildId = props.guildId;
|
|
const stateFromStores = useStateFromStores([AuthenticationStore], () => AuthenticationStore.getId());
|
|
let guildName = useStateFromStores([GuildStore], () => GuildStore.getGuild(guildId), [guildId])?.name;
|
|
if (guildName == null) {
|
|
guildName = "";
|
|
}
|
|
L11: {
|
|
const stateFromStores2 = useStateFromStores([GuildMemberStore], () => {
|
|
if (guildId == null) {
|
|
return null;
|
|
}
|
|
return getAutomodReason(getAutomodQuarantinedGuildMemberFlags(GuildMemberStore.getMember(guildId, stateFromStores)));
|
|
}, [guildId, stateFromStores]);
|
|
useMountEffect(() => {
|
|
AnalyticsUtils.track(AnalyticEvents.OPEN_MODAL, {
|
|
type: QUARANTINE_USER_ALERT_KEY,
|
|
guild_id: guildId,
|
|
other_user_id: stateFromStores
|
|
});
|
|
});
|
|
if (stateFromStores2 !== GuildMemberFlags.AUTOMOD_QUARANTINED_BIO && stateFromStores2 !== GuildMemberFlags.AUTOMOD_QUARANTINED_USERNAME_OR_GUILD_NICKNAME) {
|
|
if (stateFromStores2 === GuildMemberFlags.AUTOMOD_QUARANTINED_SERVER_TAG) {
|
|
r49 = <ServerTagAlert guildName={guildName} {...props} />;
|
|
break L11;
|
|
}
|
|
r49 = <PerServerProfileAlert automodReason={stateFromStores2} guildName={guildName} {...props} />;
|
|
} else {
|
|
r49 = <PerServerProfileAlert automodReason={stateFromStores2} guildName={guildName} {...props} />;
|
|
}
|
|
}
|
|
return r49;
|
|
};
|