52 lines
2.1 KiB
TypeScript
52 lines
2.1 KiB
TypeScript
// Metro module 15035 (f15036).
|
|
import MessageStore from "../../stores/MessageStore";
|
|
import RelationshipStore from "../../stores/RelationshipStore";
|
|
import { ChannelFlags } from "./ChannelConstants";
|
|
import { MessageTypes } from "../../Constants";
|
|
import { useStateFromStores } from "../../_bundle/Module589";
|
|
import SnowflakeUtils from "../../utils/SnowflakeUtils";
|
|
import * as _DateUtils from "../../utils/DateUtils";
|
|
import Module3771 from "../../_bundle/Module3771";
|
|
import { useStrangerDangerWarning } from "../self_mod/stranger_danger/hooks/useStrangerDangerWarning";
|
|
export function usePrivateChannelWaveEligible(a0, a1) {
|
|
let recipientId;
|
|
let r18 = a0.isDM() && !a0.isSystemDM() && !a0.rawRecipients.some((rawRecipient) => rawRecipient.bot);
|
|
recipientId = r18 ? a0.getRecipientId() : null;
|
|
const stateFromStores = useStateFromStores([RelationshipStore], () => recipientId != null && RelationshipStore.isFriend(recipientId));
|
|
const stateFromStores2 = useStateFromStores([RelationshipStore], () => recipientId != null && RelationshipStore.isIgnored(recipientId));
|
|
const stateFromStores3 = useStateFromStores([MessageStore], () => {
|
|
const messages = MessageStore.getMessages(a0.id);
|
|
return messages.length === 1 && messages.first()?.type === MessageTypes.FRIEND_REQUEST_ACCEPTED;
|
|
});
|
|
let r44 = a0.hasFlag(ChannelFlags.HAS_ONLY_SYSTEM_MESSAGES);
|
|
const stateFromStores4 = useStateFromStores([MessageStore], () => MessageStore.hasCurrentUserSentWaveBlockingMessage(a0.id));
|
|
const r54 = SnowflakeUtils.extractTimestamp(a0.id);
|
|
const isWithinInterval = _DateUtils.isWithinInterval(Module3771(), Module3771(r54), 1814400000);
|
|
const strangerDangerWarning = useStrangerDangerWarning(a0.id);
|
|
if (r18) {
|
|
r18 = stateFromStores;
|
|
}
|
|
if (r18) {
|
|
r18 = !stateFromStores2;
|
|
}
|
|
if (r18) {
|
|
if (!r44) {
|
|
r44 = a1 == null;
|
|
}
|
|
if (!r44) {
|
|
r44 = stateFromStores3;
|
|
}
|
|
r18 = r44;
|
|
}
|
|
if (r18) {
|
|
r18 = !stateFromStores4;
|
|
}
|
|
if (r18) {
|
|
r18 = isWithinInterval;
|
|
}
|
|
if (r18) {
|
|
r18 = strangerDangerWarning == null;
|
|
}
|
|
return r18;
|
|
}
|