decord/source/modules/panels/isChannelFocused.native.tsx

203 lines
6.3 KiB
TypeScript
Raw Normal View History

// Module ID: 10181
// Function ID: 10182
// Name: isChannelFocused
// Dependencies: [32, 19, 4623, 7402, 4815, 4466, 4464, 4465, 4467, 2]
2026-07-29 08:29:29 +00:00
// Exports: isChannelFocused, isChannelFocusedForReadStateAck, useIsChannelFocused
2026-07-20 16:05:17 +00:00
// Module 10181 (isChannelFocused)
import RootNavigationRef from "RootNavigationRef" /* 4465 */;
import getInitialNavigationStateDefault from "getInitialNavigationState" /* 4466 */;
import useChatLayout from "useChatLayout" /* 4467 */;
import _slicedToArray from "module_32" /* 32 */;
import noop from "module_19" /* 19 */;
import ChannelRTCStore from "ChannelRTCStore" /* 4623 */;
import NavigationHistoryStore from "NavigationHistoryStore" /* 7402 */;
import VoicePanelStore from "VoicePanelStore" /* 4815 */;
2026-07-22 07:54:56 +00:00
const useChatLayoutDefault = useChatLayout;
const NavigationRouteUtils = params(4464);
require = fn;
2026-07-20 16:05:17 +00:00
function getFocusedChannelId() {
2026-07-29 08:29:29 +00:00
let params = require;
let paramsResult3 = dependencyMap;
const rootNavigationRef = RootNavigationRef.getRootNavigationRef();
2026-08-24 06:08:38 +00:00
const isChatLockedOpen = useChatLayout.getChatLayout().isChatLockedOpen;
2026-07-20 16:05:17 +00:00
let tmp2 = null;
if (null != rootNavigationRef) {
if (rootNavigationRef.isReady()) {
const currentRoute = rootNavigationRef.getCurrentRoute();
const coerceChannelRouteResult = NavigationRouteUtils.coerceChannelRoute(currentRoute);
2026-07-20 16:05:17 +00:00
if (tmp2 != coerceChannelRouteResult) {
return coerceChannelRouteResult.params.channelId;
2026-07-29 08:29:29 +00:00
} else if (isChatLockedOpen) {
const coerceGuildsRouteResult = NavigationRouteUtils.coerceGuildsRoute(currentRoute);
2026-07-29 08:29:29 +00:00
let tmp6;
if (tmp2 != coerceGuildsRouteResult) {
const params2 = coerceGuildsRouteResult.params;
let channelId;
if (params2 != tmp2) {
channelId = params2.channelId;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp6 = channelId;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp6;
2026-07-20 16:05:17 +00:00
}
const paramsResult = NavigationRouteUtils;
2026-07-20 16:05:17 +00:00
}
}
2026-07-23 10:11:24 +00:00
if (tmp2 !== c9) {
return c9;
2026-07-20 16:05:17 +00:00
} else {
const tmp19 = getInitialNavigationStateDefault();
let routes2 = NavigationRouteUtils;
2026-07-29 08:29:29 +00:00
let tmp8;
if (tmp19 != tmp2) {
const routes = tmp19.routes;
if (routes != tmp2) {
let num;
if (tmp19 != tmp2) {
num = tmp19.index;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (num == tmp2) {
num = 0;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp8 = routes[num];
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
let num2 = routes2.coerceMainRoute(tmp8);
if (tmp2 == num2) {
c9 = tmp9;
2026-07-20 16:05:17 +00:00
} else {
routes2 = NavigationRouteUtils;
2026-07-20 16:05:17 +00:00
if (!isChatLockedOpen) {
2026-07-29 08:29:29 +00:00
const state = num2.state;
let tmp10;
if (state != tmp2) {
const routes3 = state.routes;
if (routes3 != tmp2) {
const state2 = num2.state;
let num3;
if (state2 != tmp2) {
num3 = state2.index;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (num3 == tmp2) {
num3 = 0;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp10 = routes3[num3];
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
const coerceChannelRouteResult1 = routes2.coerceChannelRoute(tmp10);
2026-07-20 16:05:17 +00:00
if (tmp2 != coerceChannelRouteResult1) {
2026-07-29 08:29:29 +00:00
const params3 = coerceChannelRouteResult1.params;
2026-07-20 16:05:17 +00:00
let channelId1;
2026-07-29 08:29:29 +00:00
if (params3 != tmp2) {
channelId1 = params3.channelId;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp9 = channelId1;
2026-07-20 16:05:17 +00:00
}
}
}
2026-07-29 08:29:29 +00:00
const state3 = num2.state;
let tmp13;
if (state3 != tmp2) {
const routes4 = state3.routes;
if (routes4 != tmp2) {
const state4 = num2.state;
num2 = undefined;
if (state4 != tmp2) {
num2 = state4.index;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (num2 == tmp2) {
num2 = 0;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp13 = routes4[num2];
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
const coerceTabsRouteResult = routes2.coerceTabsRoute(tmp13);
if (tmp2 != coerceTabsRouteResult) {
params = NavigationRouteUtils.coerceGuildsRoute;
2026-07-29 08:29:29 +00:00
routes2 = coerceTabsRouteResult.state;
let tmp16;
if (routes2 != tmp2) {
routes2 = routes2.routes;
if (routes2 != tmp2) {
num2 = coerceTabsRouteResult.state;
let num4;
if (num2 != tmp2) {
num4 = num2.index;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (num4 == tmp2) {
num4 = 0;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp16 = routes2[num4];
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
paramsResult3 = params(tmp16);
if (tmp2 != paramsResult3) {
params = paramsResult3.params;
tmp2 = params == tmp2;
paramsResult3 = undefined;
2026-07-20 16:05:17 +00:00
if (!tmp2) {
2026-07-29 08:29:29 +00:00
paramsResult3 = params.channelId;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp9 = paramsResult3;
2026-07-20 16:05:17 +00:00
}
const paramsResult2 = NavigationRouteUtils;
2026-07-20 16:05:17 +00:00
}
}
}
const CHANNEL_PREFIX = fn(7402).CHANNEL_PREFIX;
2026-07-23 10:11:24 +00:00
let c9 = null;
const size = fn(2);
const result = size.fileFinishedImporting("modules/panels/isChannelFocused.native.tsx");
2026-07-20 16:05:17 +00:00
export { getFocusedChannelId };
2026-07-29 08:29:29 +00:00
export const isChannelFocused = function isChannelFocused() {
return null != getFocusedChannelId();
};
2026-07-20 16:05:17 +00:00
export const useIsChannelFocused = function useIsChannelFocused() {
const tmp = _slicedToArray(noop.useState(() => null != getFocusedChannelId()), 2);
2026-08-24 06:08:38 +00:00
closure_0 = tmp[1];
const items = [useChatLayoutDefault()];
const effect = noop.useEffect(() => {
closure_0(null != getFocusedChannelId());
2026-07-20 16:05:17 +00:00
}, items);
const effect1 = noop.useEffect(() => {
2026-07-20 16:05:17 +00:00
function handleStateChange() {
rootNavigationRef(null != getFocusedChannelId());
2026-07-20 16:05:17 +00:00
}
const rootNavigationRef = closure_0(dependencyMap[7]).getRootNavigationRef();
2026-07-20 16:05:17 +00:00
if (null != rootNavigationRef) {
rootNavigationRef.addListener("state", handleStateChange);
return () => {
rootNavigationRef.removeListener("state", handleStateChange);
};
}
const obj = closure_0(dependencyMap[7]);
2026-07-20 16:05:17 +00:00
}, []);
return tmp[0];
};
2026-07-29 08:29:29 +00:00
export const isChannelFocusedForReadStateAck = function isChannelFocusedForReadStateAck(channelId, arg1) {
if (ChannelRTCStore.getChatOpen(channelId)) {
2026-07-20 16:05:17 +00:00
return true;
} else {
const state = VoicePanelStore.getState();
2026-07-20 16:05:17 +00:00
if (state.isVoicePanelFullscreen()) {
return false;
} else if (getFocusedChannelId() === channelId) {
return true;
} else {
2026-07-29 08:29:29 +00:00
if (null != arg1) {
const lastFocusedTimestampForHistoryItem = NavigationHistoryStore.getLastFocusedTimestampForHistoryItem(CHANNEL_PREFIX + channelId);
2026-07-20 16:05:17 +00:00
if (null != lastFocusedTimestampForHistoryItem) {
2026-07-29 08:29:29 +00:00
if (lastFocusedTimestampForHistoryItem >= arg1) {
2026-07-20 16:05:17 +00:00
return true;
}
}
}
return false;
}
}
};