Files
discord-decomp/modules/guild_onboarding_home/isSelectedFromHomeChannel.native.tsx
T
2026-11-01 12:12:55 +02:00

40 lines
1.3 KiB
TypeScript

// Metro module 10416 (f10417).
import "../../stores/ChannelSectionStore";
import "../../stores/SelectedChannelStore";
import { isGuildHomeChannel } from "../channel/ChannelConstants";
import { getRootNavigationRef } from "../main_tabs_v2/RootNavigationRef.native";
import { coerceMainRoute, coerceChannelRoute } from "../main_tabs_v2/helpers/NavigationRouteUtils.native";
export default function isSelectedFromHomeChannel(a0) {
const rootNavigationRef = getRootNavigationRef();
if (rootNavigationRef != null && rootNavigationRef.isReady()) {
const rootState = rootNavigationRef.getRootState();
if (rootState == null) {
return false;
}
const r27 = coerceMainRoute(rootState.routes[rootState.index]);
if (r27 == null) {
return false;
}
const state = r27.state;
if (state == null) {
return false;
}
let index = state.index;
while (index >= 0) {
const r14 = state.routes[index];
if (r14 != null) {
const r34 = coerceChannelRoute(r14);
if (r34 != null && r34.params.channelId === a0.id) {
const r43 = coerceChannelRoute(state.routes[index - 1]);
if (r43 != null) {
return r43.params.guildId === a0.guild_id && isGuildHomeChannel(r43.params.channelId);
}
}
}
index = index - 1;
}
return false;
}
return false;
};