This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
// Metro module 10438 (f10439).
import { intl, t } from "../../intl/index.native";
export const LIKELY_ATO_MORE_TIPS_MODAL_KEY = "LIKELY_ATO_MORE_TIPS_MODAL";
export const LEARN_MORE_HC_ARTICLE = "https://discord.com/safety/understanding-and-avoiding-common-scams";
export function getLikelyAtoMoreTips() {
return [{
title: intl.string(t.wSZfJR),
description: intl.string(t.CRwzW5)
}, {
title: intl.string(t.cmMUaB),
description: intl.string(t.n6G1ue)
}, {
title: intl.string(t["5SPKSy"]),
description: intl.string(t.eyjeJQ)
}];
}
@@ -0,0 +1,17 @@
// Metro module 10436 (f10437).
import { SafetyWarningTypes } from "../../self_mod/ChannelSafetyWarningsStore";
import { useIsSpamMessageRequest } from "../../message_request/hooks/useIsSpamMessageRequest";
import { useIsMessageRequest } from "../../message_request/hooks/useIsMessageRequest";
import { useChannelSafetyWarning } from "../../self_mod/hooks/useChannelSafetyWarning";
import { useInappropriateConversationWarningsForChannel } from "../../self_mod/inappropriate_conversation/hooks/useInappropriateConversationWarningsForChannel";
import { useStrangerDangerWarning } from "../../self_mod/stranger_danger/hooks/useStrangerDangerWarning";
export function useLikelyAtoWarning(a0) {
const isSpamMessageRequest = useIsSpamMessageRequest(a0);
const isMessageRequest = useIsMessageRequest(a0);
const channelSafetyWarning = useChannelSafetyWarning(a0, SafetyWarningTypes.LIKELY_ATO);
const r3 = useInappropriateConversationWarningsForChannel(a0).length > 0;
const r31 = useStrangerDangerWarning(a0) != null;
if (!isSpamMessageRequest && !isMessageRequest && !r3 && !r31) {
return channelSafetyWarning;
}
}
@@ -0,0 +1,18 @@
// Metro module 10446 (f10447).
import { useMemo } from "react";
import UserStore from "../../../../stores/UserStore";
import { useStateFromStores } from "../../../../_bundle/Module589";
import UserUtils from "../../../../utils/UserUtils";
import { TableRowGroup } from "../../../../design/components/TableRow/native/TableRowGroup.native";
import { TableRow } from "../../../../design/components/TableRow/native/TableRow.native";
import { intl, t } from "../../../../intl/index.native";
import { BellSlashIcon } from "../../../../design/components/Icon/native/redesign/generated/BellSlashIcon";
export default function LikelyAtoMoreTipsModalActionItems(props) {
const { senderId, handleMutePressed } = props;
const stateFromStores = useStateFromStores([UserStore], () => UserStore.getUser(senderId), [senderId]);
return <TableRowGroup hasIcons>
<TableRow label={intl.formatToPlainString(t["F/ID+9"], {
username: useMemo(() => UserUtils.getName(stateFromStores), [stateFromStores])
})} subLabel={intl.string(t.w2ve0t)} onPress={handleMutePressed} icon={<BellSlashIcon />} />
</TableRowGroup>;
};
@@ -0,0 +1,107 @@
// Metro module 10437 (f10438).
import { useEffect, useCallback } from "react";
import { SafetyWarningTypes } from "../../../self_mod/ChannelSafetyWarningsStore";
import { LEARN_MORE_HC_ARTICLE, LIKELY_ATO_MORE_TIPS_MODAL_KEY, getLikelyAtoMoreTips } from "../../Constants";
import { AnalyticEvents } from "../../../../Constants";
import { MuteUntilSeconds } from "../../../user_settings/UserSettingsConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { trackCtaEvent, CtaEventTypes, trackViewedEvent } from "../../../self_mod/shared/SafetyWarningUtils";
import { dismissChannelSafetyWarnings } from "../../../self_mod/ChannelSafetyWarningsActionCreators";
import ModalActionCreators from "../../../../actions/ModalActionCreators";
import { handleMuteSettingPress } from "../../../main_tabs_v2/native/sidebar/details/screens/MuteSettingsUtils";
import SafetyToastsActionCreators_native from "../../../safety_common/SafetyToastsActionCreators.native";
import Linking from "../../../../lib/native/Linking";
import SafetyWarningBanner from "../../../self_mod/shared/native/SafetyWarningBanner";
import { intl, t } from "../../../../intl/index.native";
import { Text } from "../../../../design/components/Text/native/Text";
import LikelyAtoMoreTipsModalActionItems from "./LikelyAtoMoreTipsModalActionItems";
let useStyles;
export function LikelyAtoWarningBanner(props) {
let styles, callback, callback2;
const { channelId, warningId, senderId } = props;
styles = void 0;
callback = void 0;
callback2 = void 0;
const handleLearnMore2 = function handleLearnMore() {
trackCtaEvent({
channelId,
warningId,
senderId,
warningType: SafetyWarningTypes.LIKELY_ATO,
cta: CtaEventTypes.USER_MODAL_LEARN_MORE
});
Linking.openURL(LEARN_MORE_HC_ARTICLE);
};
styles = useStyles();
useEffect(() => {
trackViewedEvent(AnalyticEvents.SAFETY_WARNING_VIEWED, {
channelId,
warningId,
senderId,
warningType: SafetyWarningTypes.LIKELY_ATO
});
}, [channelId, warningId, senderId]);
callback = useCallback(() => {
dismissChannelSafetyWarnings(channelId, [warningId]);
ModalActionCreators.popWithKey(LIKELY_ATO_MORE_TIPS_MODAL_KEY);
}, [channelId, warningId]);
callback2 = useCallback((a0) => {
handleMuteSettingPress({
channelId,
guildId: null,
muteDurationSeconds: MuteUntilSeconds.ALWAYS
});
SafetyToastsActionCreators_native.showMuteSuccessToast(senderId, channelId);
trackCtaEvent({
channelId,
warningId,
senderId,
warningType: SafetyWarningTypes.LIKELY_ATO,
cta: a0
});
callback();
}, [channelId, senderId, warningId, callback]);
return <SafetyWarningBanner channelId={channelId} warningId={warningId} senderId={senderId} warningType={SafetyWarningTypes.LIKELY_ATO} header={intl.string(t.R8UsiI)} description={intl.string(t.lI8nQl)} onDismiss={callback} buttons={[{
text: intl.string(t.tC1pvL),
variant: "primary",
onpress: function onpress() {
ModalActionCreators.pushLazy(import("../../../self_mod/stranger_danger/native/components/more_tips_modal/MoreTipsModal"), {
modalKey: LIKELY_ATO_MORE_TIPS_MODAL_KEY,
headerStyle: styles.moreTipsHeader,
channelId,
warningId,
senderId,
description: intl.string(t["/uid3p"]),
safetyTips: getLikelyAtoMoreTips().map((item, index) => <>
<Text key={index} variant="text-md/medium" color="mobile-text-heading-primary">{item.title}</Text>
<Text key={index} variant="text-xs/medium" color="text-subtle">{item.description}</Text>
</>),
actionItems: <LikelyAtoMoreTipsModalActionItems senderId={senderId} handleMutePressed={() => callback2(CtaEventTypes.USER_MODAL_MUTE)} />,
learnMore: <Text variant="text-sm/normal" color="text-link">
{intl.format(t.UkH122, {
learnMoreLink: handleLearnMore2
})}
</Text>
}, LIKELY_ATO_MORE_TIPS_MODAL_KEY);
trackCtaEvent({
channelId,
warningId,
senderId,
warningType: SafetyWarningTypes.LIKELY_ATO,
cta: CtaEventTypes.OPEN_MORE_TIPS
});
}
}, {
text: intl.string(t.ftIK2A),
variant: "secondary",
onpress: () => callback2(CtaEventTypes.USER_BANNER_MUTE)
}]} />;
}
useStyles = createStyles({
moreTipsHeader: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWER,
shadowColor: "transparent"
}
});
export default LikelyAtoWarningBanner;