decord/source/modules/guild_themes/native/useRoutedActiveGuildTheme.tsx
github-actions 4f02868c60 chore: update source for alpha 346.4
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4792.js (118.4 MB)
2026-09-11 10:30:06 +00:00

180 lines
5.5 KiB
TypeScript

// Module ID: 4463
// Function ID: 4464
// Name: useRoutedActiveGuildTheme
// Dependencies: [32, 19, 1074, 4464, 4465, 4490, 4491, 2]
// Exports: default
// Module 4463 (useRoutedActiveGuildTheme)
import NavigationRouteUtils from "NavigationRouteUtils" /* 4464 */;
import RootNavigationRef from "RootNavigationRef" /* 4465 */;
import GuildThemeGuildIdOverrideContextDefault from "GuildThemeGuildIdOverrideContext" /* 4490 */;
import GuildThemeResolver from "GuildThemeResolver" /* 4491 */;
import _slicedToArray from "module_32" /* 32 */;
import noop from "module_19" /* 19 */;
require = fn;
function getGuildIdFromNavigationState(routes) {
if (null != routes) {
routes = routes.routes;
if (null != routes) {
let guildId;
if (routes[routes.index] != null) {
const params = tmp.params;
if (params != null) {
guildId = params.guildId;
}
}
if (null == guildId) {
let state;
if (tmp != null) {
state = tmp.state;
}
guildId = getGuildIdFromNavigationState(state);
}
return guildId;
}
}
}
function getActiveGuildThemeGuildIdSnapshot() {
const rootNavigationRef = RootNavigationRef.getRootNavigationRef();
if (null != rootNavigationRef) {
if (rootNavigationRef.isReady()) {
const rootState = rootNavigationRef.getRootState();
let tmp4;
if (null != rootState) {
const routes = rootState.routes;
if (null != routes) {
let guildId;
if (routes[rootState.index] != null) {
const params = tmp5.params;
if (params != null) {
guildId = params.guildId;
}
}
if (null == guildId) {
let state;
if (tmp5 != null) {
state = tmp5.state;
}
let tmp8;
if (null != state) {
const routes2 = state.routes;
if (null != routes2) {
let guildId1;
if (routes2[state.index] != null) {
const params2 = tmp9.params;
if (params2 != null) {
guildId1 = params2.guildId;
}
}
if (null == guildId1) {
let state1;
if (tmp9 != null) {
state1 = tmp9.state;
}
guildId1 = getGuildIdFromNavigationState(state1);
}
tmp8 = guildId1;
}
}
guildId = tmp8;
}
tmp4 = guildId;
}
}
if (null == tmp4) {
let found;
if (rootState != null) {
const routes1 = rootState.routes;
if (routes1 != null) {
const mapped = routes1.map(NavigationRouteUtils.coerceMainRoute);
found = mapped.find((item) => null != item);
}
}
let state2;
if (found != null) {
state2 = found.state;
}
let tmp15;
if (null != state2) {
const routes3 = state2.routes;
if (null != routes3) {
let guildId2;
if (routes3[state2.index] != null) {
const params3 = tmp16.params;
if (params3 != null) {
guildId2 = params3.guildId;
}
}
if (null == guildId2) {
let state3;
if (tmp16 != null) {
state3 = tmp16.state;
}
let tmp19;
if (null != state3) {
const routes4 = state3.routes;
if (null != routes4) {
let guildId3;
if (routes4[state3.index] != null) {
const params4 = tmp20.params;
if (params4 != null) {
guildId3 = params4.guildId;
}
}
if (null == guildId3) {
let state4;
if (tmp20 != null) {
state4 = tmp20.state;
}
guildId3 = getGuildIdFromNavigationState(state4);
}
tmp19 = guildId3;
}
}
guildId2 = tmp19;
}
tmp15 = guildId2;
}
}
tmp4 = tmp15;
}
let tmp24 = null;
if (null != tmp4) {
tmp24 = null;
if (tmp4 !== ME) {
tmp24 = tmp4;
}
}
return tmp24;
}
}
return null;
}
const ME = fn(1074).ME;
const size = fn(2);
const result = size.fileFinishedImporting("modules/guild_themes/native/useRoutedActiveGuildTheme.tsx");
export default function useRoutedActiveGuildTheme() {
const context = noop.useContext(GuildThemeGuildIdOverrideContextDefault);
[tmp4, require] = noop.useState(getActiveGuildThemeGuildIdSnapshot);
const effect = noop.useEffect(() => {
const rootNavigationRef = RootNavigationRef.getRootNavigationRef();
if (null != rootNavigationRef) {
function handleStateChange() {
closure_1_0(getActiveGuildThemeGuildIdSnapshot());
}
closure_1_0(getActiveGuildThemeGuildIdSnapshot());
return rootNavigationRef.addListener("state", handleStateChange);
}
}, []);
if (undefined !== context) {
let tmp7 = null;
if (context !== ME) {
tmp7 = context;
}
tmp4 = tmp7;
}
const tmp3 = _slicedToArray(noop.useState(getActiveGuildThemeGuildIdSnapshot), 2);
return GuildThemeResolver.useActiveGuildThemeForGuildId(tmp4);
};