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

@@ -0,0 +1,83 @@
// Metro module 11539 (f11540).
import { useState } from "react";
import { View } from "react-native";
import UserStore from "../../../../stores/UserStore";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { useMessageRequestActions } from "../../hooks/useMessageRequestActions";
import ToastActionCreators from "../../../toast/native/ToastActionCreators";
import { intl, t } from "../../../../intl/index.native";
import Module9172 from "../../../../_bundle/Module9172";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import { BottomSheet } from "../../../../design/components/Sheet/native/BottomSheet.native";
import { BottomSheetTitleHeader } from "../../../../design/components/Sheet/native/BottomSheetTitleHeader.native";
import { ActionSheetCloseButton } from "../../../../design/components/Sheet/native/ActionSheetCloseButton.native";
import { FormSwitchRow } from "../../../../design/void/Form/native/index";
import { Button } from "../../../../design/components/Button/native/Button.native";
const useStyles = createStyles({
header: {
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH
},
container: {
marginTop: Module712.space.PX_24,
paddingHorizontal: Module712.space.PX_16
},
buttonContainer: {
marginTop: Module712.space.PX_24
},
switch: {
paddingHorizontal: 0
}
});
export default function SpamMessageRequestHamActionSheet(props) {
let acceptMessageRequest;
const { channel, onConfirm, onCancel } = props;
acceptMessageRequest = void 0;
const styles = useStyles();
const [state, setState] = useState(false);
const messageRequestActions = useMessageRequestActions({
user: useStateFromStores([UserStore], () => UserStore.getUser(channel.getRecipientId())),
onError: function onError() {
ToastActionCreators.open({
key: "MESSAGE_REQUEST_REQUEST_ERROR_ALERT_TITLE",
content: intl.string(t["EDYbS+"]),
icon: Module9172
});
},
onAcceptSuccess: function onAcceptSuccess() {
ActionSheetActionCreators.hideActionSheet();
}
});
acceptMessageRequest = messageRequestActions.acceptMessageRequest;
let isAcceptLoading = messageRequestActions.isAcceptLoading;
const { isUserProfileLoading, isOptimisticAccepted } = messageRequestActions;
const r68 = [<BottomSheetTitleHeader title={intl.string(t["9ty6yc"])} trailing={<ActionSheetCloseButton onPress={function onPress() {
ActionSheetActionCreators.hideActionSheet();
onCancel();
}} />} backgroundColor={styles.header} />, ,];
const r87 = [<FormSwitchRow style={styles.switch} label={intl.string(t.ZhGpNQ)} value={state} switchProps={{
renderIosBackground: true
}} onValueChange={(value) => setState(value)} />, ,];
const props2 = {
size: "md",
onPress: function onPress() {
onConfirm(state);
acceptMessageRequest(channel.id);
},
text: intl.string(t.olZgw5),
disabled: (isAcceptLoading ? isAcceptLoading : isUserProfileLoading) || isOptimisticAccepted,
loading: null
};
if (!isAcceptLoading) {
isAcceptLoading = isOptimisticAccepted;
}
props2.loading = isAcceptLoading;
r87[1] = <View style={styles.buttonContainer}>
<Button {...props2} />
</View>;
r68[1] = <View style={styles.container}>{r87}</View>;
return <BottomSheet onDismiss={function onDismiss() {
onCancel();
}}>{r68}</BottomSheet>;
};
@@ -0,0 +1,221 @@
// Metro module 15718 (f15719).
import { useCallback } from "react";
import { ActivityIndicator, FlatList, View } from "react-native";
import { AnalyticEvents } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { intl, t } from "../../../../intl/index.native";
import { useLongestChannelMessageBeforeReply } from "../../../messages/useLongestChannelMessageBeforeReply";
import ToastActionCreators from "../../../toast/native/ToastActionCreators";
import Module9172 from "../../../../_bundle/Module9172";
import { transitionToChannel } from "../../../routing/transitionToChannel";
import ModalActionCreators from "../../../../actions/ModalActionCreators";
import { useMessageRequestActions } from "../../hooks/useMessageRequestActions";
import AnalyticsUtils from "../../../../utils/AnalyticsUtils";
import { PressableOpacity } from "../../../../design/void/Pressables/native/Pressables";
import MessageRequestRowSenderDetails from "../MessageRequestRowSenderDetails";
import { Icon } from "../../../../design/void/native";
import Module10356 from "../../../../_bundle/Module10356";
import Module13954 from "../../../../_bundle/Module13954";
import { FormDivider } from "../../../../design/void/Form/native/index";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import { useSpamMessageRequestCount } from "../../hooks/useSpamMessageRequestsCount";
import useSortedSpamMessageRequests from "../../hooks/useSortedSpamMessageRequests";
import { useListHasSingleSpamMessageRequest } from "../../hooks/useListHasSingleMessageRequest";
import useMountEffect from "../../../../hooks/useMountEffect";
import MonitoringAgent from "../../../monitoring/MonitoringAgent";
import { MetricEvents } from "../../../../_bundle/Module5872";
import MessageRequestEmpty from "../MessageRequestEmpty";
import { isAndroid } from "../../../../utils/PlatformUtils";
import { Text } from "../../../../design/components/Text/native/Text";
let useStyles, c11228_11;
const PendingSpamMessageRequestRow = function PendingSpamMessageRequestRow(props) {
let rejectMessageRequest, markAsNotSpam;
const { messageRequest, goToMessageRequestPreview: goToMessageRequestPreview2, isLastRow, hasSingleMessageRequest } = props;
rejectMessageRequest = void 0;
markAsNotSpam = void 0;
const styles2 = useStyles();
const { user, channel } = messageRequest;
const id = channel.id;
const longestChannelMessageBeforeReply = useLongestChannelMessageBeforeReply(id, channel.getRecipientId());
const callback = useCallback(() => {
ToastActionCreators.open({
key: "MESSAGE_REQUESTS_SPAM_ERROR_ALERT_TITLE",
content: intl.string(t.pIQ3h4),
icon: Module9172
});
}, []);
const messageRequestActions = useMessageRequestActions({
user,
onAcceptSuccess: useCallback(() => {
if (hasSingleMessageRequest) {
transitionToChannel(id);
ModalActionCreators.pop();
}
}, [id, hasSingleMessageRequest]),
onError: callback
});
rejectMessageRequest = messageRequestActions.rejectMessageRequest;
const { isAcceptLoading, isRejectLoading, isUserProfileLoading, isOptimisticAccepted, isOptimisticRejected } = messageRequestActions;
markAsNotSpam = messageRequestActions.markAsNotSpam;
const disabled = isAcceptLoading || isRejectLoading || isUserProfileLoading || isOptimisticAccepted || isOptimisticRejected;
const props2 = {
onPress: function handleSelectRow() {
AnalyticsUtils.track(AnalyticEvents.MESSAGE_REQUEST_PREVIEW_VIEWED, {
is_spam: true,
channel_id: channel.id,
other_user_id: user.id
});
goToMessageRequestPreview2();
},
accessibilityRole: "button",
accessibilityActions: [{
name: c11228_11.ACCEPT_SPAM_MESSAGE,
label: intl.string(t.apePSa)
}, {
name: c11228_11.IGNORE_SPAM_MESSAGE,
label: intl.string(t.MWOV9D)
}, {
name: c11228_11.PREVIEW_SPAM_MESSAGE,
label: intl.string(t.I6PFLB)
}],
onAccessibilityAction: function onAccessibilityAction(a0) {
const actionName = a0.nativeEvent.actionName;
if (c11228_11.ACCEPT_SPAM_MESSAGE === actionName) {
markAsNotSpam(channel, longestChannelMessageBeforeReply);
return void 0;
}
if (c11228_11.IGNORE_SPAM_MESSAGE === actionName) {
rejectMessageRequest(channel.id);
return void 0;
}
if (c11228_11.PREVIEW_SPAM_MESSAGE === actionName) {
AnalyticsUtils.track(AnalyticEvents.MESSAGE_REQUEST_PREVIEW_VIEWED, {
is_spam: true,
channel_id: channel.id,
other_user_id: user.id
});
goToMessageRequestPreview2();
return void 0;
}
},
style: styles2.pressableRow,
children: null
};
props2.children = [<View style={styles2.rowContainer}>
<MessageRequestRowSenderDetails channel={messageRequest.channel} otherUser={messageRequest.user} />
<View style={styles2.actionContainer}>
<PressableOpacity accessibilityRole="button" accessibilityLabel={intl.formatToPlainString(t["6p0yBo"], {
name: user == null ? void 0 : user.toString()
})} onPress={function handleAcceptMessageRequest() {
markAsNotSpam(channel, longestChannelMessageBeforeReply);
}} disabled={disabled} style={[styles2.actionButton, styles2.acceptButton]}>
{!isAcceptLoading && (!isUserProfileLoading && !isOptimisticAccepted) ? <Icon size={Icon.Sizes.SMALL} disableColor source={Module10356} /> : <ActivityIndicator style={styles2.activityIndicator} />}
</PressableOpacity>
<PressableOpacity accessibilityRole="button" accessibilityLabel={intl.formatToPlainString(t["C9Xe6+"], {
name: user == null ? void 0 : user.toString()
})} onPress={function handleRejectMessageRequest() {
rejectMessageRequest(channel.id);
}} disabled={disabled} style={styles2.actionButton}>
{!isRejectLoading && !isOptimisticRejected ? <Icon size={Icon.Sizes.SMALL} disableColor source={Module13954} /> : <ActivityIndicator style={styles2.activityIndicator} />}
</PressableOpacity>
</View>
</View>, isLastRow ? null : <FormDivider iconPush outer />];
return <PressableOpacity {...props2} />;
};
useStyles = createStyles({
sectionContainer: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
flexDirection: "row",
justifyContent: "space-between",
marginTop: 6,
marginBottom: 10
},
rowContainer: {
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between",
marginTop: 14,
marginBottom: 12
},
actionContainer: {
flexDirection: "row",
alignItems: "flex-start",
height: "100%"
},
actionButton: {
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
tintColor: Module712.colors.INTERACTIVE_TEXT_DEFAULT,
borderRadius: Module712.radii.lg,
alignItems: "center",
justifyContent: "center",
height: 32,
width: 32
},
acceptButton: {
marginRight: 16
},
pressableRow: {
borderRadius: Module712.radii.md
},
activityIndicator: {
height: 16,
width: 16
},
list: {
flex: 1,
paddingHorizontal: 16,
alignSelf: "stretch",
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
}
});
c11228_11 = {
ACCEPT_SPAM_MESSAGE: "accept-spam-message-request",
IGNORE_SPAM_MESSAGE: "ignore-spam-message-request",
PREVIEW_SPAM_MESSAGE: "preview-spam-message-request"
};
export default function SpamMessageList(props) {
const goToMessageRequestPreview3 = props.goToMessageRequestPreview;
const styles = useStyles();
const bottom = useSafeAreaInsets_native().bottom;
const spamMessageRequestCount = useSpamMessageRequestCount();
const sortedSpamMessageRequests = useSortedSpamMessageRequests();
let c22386_3 = sortedSpamMessageRequests;
const listHasSingleSpamMessageRequest = useListHasSingleSpamMessageRequest();
useMountEffect(() => {
AnalyticsUtils.track(AnalyticEvents.SPAM_MESSAGE_REQUESTS_VIEWED, {
num_spam_message_requests: spamMessageRequestCount
});
MonitoringAgent.increment({
name: MetricEvents.SPAM_MESSAGE_REQUEST_VIEW
});
});
if (sortedSpamMessageRequests.length === 0) {
return <MessageRequestEmpty bodyText={intl.string(t.hasFPQ)} />;
}
const data = ["header-section", ...sortedSpamMessageRequests];
return <FlatList style={[styles.list, {
marginBottom: isAndroid() ? bottom : 0
}]} scrollIndicatorInsets={{
right: 0.01
}} contentContainerStyle={{
paddingBottom: bottom,
paddingTop: 12
}} renderItem={function renderItem({ item }) {
let r29;
if (typeof item === "string") {
r29 = <View style={styles.sectionContainer}>
<Text variant="eyebrow" color="text-default">
{intl.format(t.aNh5Kf, {
count: c22386_3.length
})}
</Text>
</View>;
} else {
const id2 = item.channel.id;
const r21 = c22386_3[c22386_3.length - 1];
r29 = <PendingSpamMessageRequestRow key={item.channel.id} messageRequest={item} goToMessageRequestPreview={() => goToMessageRequestPreview3(item.channel.id)} isLastRow={id2 === (r21 == null ? void 0 : r21.channel.id)} hasSingleMessageRequest={listHasSingleSpamMessageRequest} />;
}
return r29;
}} data={data} />;
};