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,106 @@
// Metro module 15226 (f15227).
import { useEffect, useMemo } from "react";
import GuildProgressStore from "../../guild_progress/GuildProgressStore";
import GuildChannelStore from "../../../stores/GuildChannelStore";
import GuildStore from "../../../stores/GuildStore";
import UserStore from "../../../stores/UserStore";
import { ChannelListChannelNoticeRow } from "../GuildSidebarConstants";
import { MFALevels } from "../../../Constants";
import { ContentDismissActionType, DismissibleContentGroupName } from "../../dismissible_content/DismissibleContentConstants";
import mobileAccountLinkingExperiment from "../../application_account_linking/experiments/mobileAccountLinkingExperiment";
import { useStateFromStores, useStateFromStoresArray } from "../../../_bundle/defaultAreStatesEqual";
import { useApplication } from "../../applications/ApplicationActionCreators";
import useStartAuthorize from "../../application_account_linking/native/useStartAuthorize";
import { useDefaultAuthorizationNotifiers } from "../../application_account_linking/native/useDefaultAuthorizationNotifiers";
import { useSelectedSingleUseGuildDismissibleContent } from "../../dismissible_content/hooks/useSelectedDismissibleContent";
import { DismissibleContent } from "../../../_bundle/Module1358";
import { UNSAFE_markSingleUseGuildDismissibleContentAsDismissed } from "../../dismissible_content/DismissibleContentUnsafeUtils";
import { useGuildHasLiveChannelNotice } from "../../guild_scheduled_events/useGuildHasLiveChannelNotice";
import { useCanShowGameClaimCoachmark } from "../../game_claim/useGameClaimCoachmark";
export default function useChannelNoticeRows(a0) {
let currentUser, stateFromStores2, guildHasLiveChannelNotice, c21781_6, c21781_7;
const id = a0.id;
const stateFromStores = useStateFromStores([GuildProgressStore], () => GuildProgressStore.hasProgress(id));
currentUser = UserStore.getCurrentUser();
stateFromStores2 = useStateFromStores([GuildChannelStore], () => currentUser != null && a0.mfaLevel === MFALevels.ELEVATED && !currentUser.mfaEnabled && GuildChannelStore.hasElevatedPermissions(id), [currentUser, a0.mfaLevel, id]);
guildHasLiveChannelNotice = useGuildHasLiveChannelNotice(id);
const r53 = useCanShowGameClaimCoachmark(id) ? [DismissibleContent.GAME_CLAIM_COACHMARK] : [];
let hasAlreadyLinked;
const [r63, gameClaimMarkAsDismissed] = useSelectedSingleUseGuildDismissibleContent(r53, id, DismissibleContentGroupName.CHANNEL_NOTICES, true);
const r4 = r63 != null;
c21781_6 = r4;
const id2 = id;
hasAlreadyLinked = void 0;
let enabled = mobileAccountLinkingExperiment.useConfig({
location: "useMobileAccountLinkRow"
}).enabled;
const r76 = useStateFromStoresArray([GuildStore], () => {
let r8 = GuildStore.getGuild(id2)?.gameApplicationIds;
if (r8 == null) {
r8 = [];
}
return r8;
})[0];
const startAuthorize = useStartAuthorize(useApplication(enabled ? r76 : null).data);
const fetched = startAuthorize.fetched;
hasAlreadyLinked = startAuthorize.hasAlreadyLinked;
const { canStartAuthorization, startAuthorization, connectionApp } = startAuthorize;
const defaultAuthorizationNotifiers = useDefaultAuthorizationNotifiers(startAuthorization, hasAlreadyLinked);
if (enabled) {
enabled = fetched;
}
if (enabled) {
enabled = !hasAlreadyLinked;
}
if (enabled) {
enabled = canStartAuthorization;
}
if (enabled) {
enabled = connectionApp != null;
}
if (enabled) {
enabled = connectionApp.applicationAccountLinkBenefitConfig != null;
}
if (enabled) {
enabled = connectionApp.applicationAccountLinkBenefitConfig.reward_name != null;
}
if (enabled) {
enabled = connectionApp.applicationAccountLinkBenefitConfig.reward_image != null;
}
const [r114, applicationAccountLinkMarkAsDismissed] = useSelectedSingleUseGuildDismissibleContent(enabled ? [DismissibleContent.MOBILE_ACCOUNT_LINKING_BANNER] : [], id, DismissibleContentGroupName.CHANNEL_NOTICES, true);
useEffect(() => {
if (hasAlreadyLinked) {
UNSAFE_markSingleUseGuildDismissibleContentAsDismissed(DismissibleContent.MOBILE_ACCOUNT_LINKING_BANNER, id2, {
dismissAction: ContentDismissActionType.INDIRECT_ACTION,
guildId: id2,
groupName: DismissibleContentGroupName.CHANNEL_NOTICES
});
}
}, [id, hasAlreadyLinked]);
const r121 = r114 != null;
c21781_7 = r121;
return {
rows: useMemo(() => {
const r6 = [ChannelListChannelNoticeRow.SPACER];
if (c21781_6) {
r6.push(ChannelListChannelNoticeRow.GAME_CLAIM);
}
if (c21781_7) {
r6.push(ChannelListChannelNoticeRow.APPLICATION_ACCOUNT_LINK);
}
if (stateFromStores) {
r6.push(ChannelListChannelNoticeRow.GUILD_PROGRESS);
} else if (stateFromStores2) {
r6.push(ChannelListChannelNoticeRow.MFA_WARNING);
}
if (guildHasLiveChannelNotice) {
r6.push(ChannelListChannelNoticeRow.LIVE_CHANNEL_NOTICE);
}
return r6;
}, [stateFromStores, stateFromStores2, guildHasLiveChannelNotice, r4, r121]),
gameClaimMarkAsDismissed,
applicationAccountLinkMarkAsDismissed,
startApplicationAccountLinkAuthorization: defaultAuthorizationNotifiers,
accountLinkApplication: connectionApp
};
};