// Metro module 11426 (f11427). import { useRef } from "react"; import MessageRequestStore from "../message_request/MessageRequestStore"; import MessageStore from "../../stores/MessageStore"; import RelationshipStore from "../../stores/RelationshipStore"; import UserStore from "../../stores/UserStore"; import { RelationshipTypes, UserFlags } from "../../Constants"; import { ChannelFlags } from "../channel/ChannelConstants"; import { useStrangerDangerWarning } from "../self_mod/stranger_danger/hooks/useStrangerDangerWarning"; import { useStateFromStores } from "../../_bundle/Module589"; export const MAX_MESSAGES_ALLOWED_FOR_GREETING = 25; export function useShowConvoStarterInDM(a0) { let c18825_3, recipientId, strangerDangerWarning, hasFlag; const ref = useRef(false); const ref2 = useRef(a0.id); const r10 = a0.isDM() && !a0.isSystemDM() && !a0.rawRecipients.some((rawRecipient) => rawRecipient.bot); c18825_3 = r10; recipientId = r10 ? a0.getRecipientId() : null; strangerDangerWarning = useStrangerDangerWarning(a0.id); hasFlag = a0.hasFlag(ChannelFlags.HAS_ONLY_SYSTEM_MESSAGES); return useStateFromStores([MessageStore, MessageRequestStore, RelationshipStore, UserStore], () => { const current = ref2.current; if (current !== a0.id) { ref.current = false; ref2.current = a0.id; } if (strangerDangerWarning != null) { return false; } if (c18825_3) { if (MessageRequestStore.isMessageRequest(a0.id)) { return false; } if (recipientId != null && RelationshipStore.getRelationshipType(recipientId) === RelationshipTypes.BLOCKED) { return false; } if (recipientId != null) { const user = UserStore.getUser(recipientId); if (user != null && user.hasFlag(UserFlags.PROVISIONAL_ACCOUNT)) { return false; } } const messages = MessageStore.getMessages(a0.id); const hasMoreBefore = messages.hasMoreBefore; const r36 = (hasMoreBefore ? !hasMoreBefore : !messages.hasMoreAfter) && messages.length < 25; const hasCurrentUserSentWaveBlockingMessage = MessageStore.hasCurrentUserSentWaveBlockingMessage(a0.id); let current2 = messages.ready || ref.current; if (current2) { let r44 = hasFlag; if (!hasFlag) { r44 = r36; } current2 = r44; } if (current2) { current2 = !hasCurrentUserSentWaveBlockingMessage; } ref.current = current2; return current2; } return false; }, [strangerDangerWarning, r10, a0.id, recipientId, hasFlag]); }