177 lines
8.4 KiB
TypeScript
177 lines
8.4 KiB
TypeScript
/* Metro module 10915; source: modules/panels/isChannelFocused.native.tsx; dependencies: [57, 31, 4606, 6936, 7710, 4009, 4007, 4008, 4010, 2] */
|
|
function _fun83644(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#83644, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11101:6, offset: 0x01f22268, size: 257 bytes, params: 8, frame: 21
|
|
const env0_0 = require;
|
|
const closure = getFocusedChannelId;
|
|
const closure2 = isChannelFocused;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = importDefault(57) /* metro dependency 57 */;
|
|
const env0_4 = importAll(31) /* metro dependency 31 */;
|
|
const channelRTCStore = importDefault(4606) /* metro dependency 4606: ChannelRTCStore */;
|
|
const navigationHistoryStore = importDefault(6936) /* metro dependency 6936: NavigationHistoryStore */;
|
|
const env0_7 = (require(6936) /* metro dependency 6936: NavigationHistoryStore */).CHANNEL_PREFIX;
|
|
const voicePanelStore = importDefault(7710) /* metro dependency 7710: VoicePanelStore */;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/panels/isChannelFocused.native.tsx');
|
|
exports.getFocusedChannelId = closure;
|
|
exports.isChannelFocused = closure2;
|
|
exports.useIsChannelFocused = useIsChannelFocused;
|
|
exports.isChannelFocusedForReadStateAck = isChannelFocusedForReadStateAck;
|
|
}
|
|
|
|
function getFocusedChannelId() { // fn#83645, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11101:178, offset: 0x01f22369, size: 686 bytes, params: 1, frame: 21
|
|
var r1;
|
|
var r3;
|
|
var currentRoute;
|
|
var coerceChannelRoute;
|
|
var value5;
|
|
var coerceGuildsRoute;
|
|
var params;
|
|
var value6;
|
|
var moduleValue4;
|
|
var coerceMainRoute;
|
|
var routes;
|
|
var value8;
|
|
var moduleValue5;
|
|
var state;
|
|
var value10;
|
|
var coerceTabsRoute;
|
|
var value12;
|
|
var moduleValue6;
|
|
var value14;
|
|
var value;
|
|
const value2 = undefined;
|
|
const rootNavigationRef = (require(4008) /* metro dependency 4008: RootNavigationRefNative */).getRootNavigationRef();
|
|
const useChatLayoutModule = require(4010) /* metro dependency 4010: useChatLayout */;
|
|
const getChatLayout = useChatLayoutModule.getChatLayout;
|
|
const isChatLockedOpen = Reflect.apply(getChatLayout, useChatLayoutModule, []).isChatLockedOpen;
|
|
if (rootNavigationRef != null) {
|
|
if (rootNavigationRef.isReady()) {
|
|
currentRoute = rootNavigationRef.getCurrentRoute();
|
|
value5 = (require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */).coerceChannelRoute(currentRoute);
|
|
if (value5 != null) {
|
|
return value5.params.channelId;
|
|
}
|
|
if (isChatLockedOpen) {
|
|
value = require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */;
|
|
value = value.coerceGuildsRoute(currentRoute);
|
|
if (value != null) {
|
|
params = value.params;
|
|
return params == null ? value2 : params.channelId;
|
|
}
|
|
return value2;
|
|
}
|
|
return value2;
|
|
}
|
|
}
|
|
if (env0_9 === null) {
|
|
value6 = (importDefault(4009) /* metro dependency 4009: getInitialNavigationState */)();
|
|
moduleValue4 = require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */;
|
|
coerceMainRoute = moduleValue4.coerceMainRoute;
|
|
if (value6 == null) {
|
|
r1 = value2;
|
|
} else {
|
|
routes = value6.routes;
|
|
r1 = routes == null ? value2 : routes[(value6 == null ? value2 : value6.index) ?? 0];
|
|
}
|
|
value8 = Reflect.apply(coerceMainRoute, moduleValue4, [r1]);
|
|
if (value8 != null) {
|
|
moduleValue5 = require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */;
|
|
if (isChatLockedOpen) {
|
|
coerceTabsRoute = moduleValue5.coerceTabsRoute;
|
|
state = value8.state;
|
|
if (state == null) {
|
|
r3 = value2;
|
|
} else {
|
|
routes = state.routes;
|
|
if (routes == null) {
|
|
r3 = value2;
|
|
} else {
|
|
state = value8.state;
|
|
r3 = routes[(state == null ? value2 : state.index) ?? 0];
|
|
}
|
|
}
|
|
value12 = Reflect.apply(coerceTabsRoute, moduleValue5, [r3]);
|
|
if (value12 != null) {
|
|
moduleValue6 = require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */;
|
|
coerceGuildsRoute = moduleValue6.coerceGuildsRoute;
|
|
state = value12.state;
|
|
value14 = Reflect.apply(coerceGuildsRoute, moduleValue6,
|
|
[state == null || state.routes == null ? value2 : state.routes[(value12.state == null ? value2 : value12.state.index) ?? 0]]);
|
|
r1 = value14 != null ? value14.params == null ? value2 : value14.params.channelId : value2;
|
|
} else {
|
|
r1 = value2;
|
|
}
|
|
} else {
|
|
coerceChannelRoute = moduleValue5.coerceChannelRoute;
|
|
state = value8.state;
|
|
value10 = Reflect.apply(coerceChannelRoute, moduleValue5,
|
|
[state == null || state.routes == null ? value2 : state.routes[(value8.state == null ? value2 : value8.state.index) ?? 0]]);
|
|
r1 = value10 == null || value10.params == null ? value2 : value10.params.channelId;
|
|
}
|
|
} else {
|
|
r1 = value2;
|
|
}
|
|
env0_9 = r1;
|
|
}
|
|
return env0_9;
|
|
}
|
|
|
|
function isChannelFocused() { // fn#83646, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11101:1251, offset: 0x01f22617, size: 21 bytes, params: 1, frame: 9
|
|
return getFocusedChannelId() != null;
|
|
}
|
|
|
|
function useIsChannelFocused() { // fn#83647, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11101:1490, offset: 0x01f2262c, size: 132 bytes, params: 1, frame: 16
|
|
const binding = env0_4;
|
|
const [property, env0_0] = env0_3(binding.useState(function() {
|
|
return isChannelFocused();
|
|
}), 2);
|
|
binding.useEffect(_fun83649, [(importDefault(4010) /* metro dependency 4010: useChatLayout */)()]);
|
|
binding.useEffect(_fun83650, []);
|
|
return property;
|
|
}
|
|
|
|
function isChannelFocusedForReadStateAck(a0, a1) { // fn#83653, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11101:1912, offset: 0x01f22769, size: 127 bytes, params: 3, frame: 14
|
|
var lastFocusedTimestampForHistoryItem;
|
|
const getChatOpen = ChannelRTCStore.getChatOpen;
|
|
if (Reflect.apply(getChatOpen, ChannelRTCStore, [a0])) {
|
|
return true;
|
|
}
|
|
const state = VoicePanelStore.getState();
|
|
if (!state.isVoicePanelFullscreen()) {
|
|
if (getFocusedChannelId() === a0) {
|
|
return true;
|
|
}
|
|
if (a1 == null) {
|
|
return false;
|
|
}
|
|
lastFocusedTimestampForHistoryItem = NavigationHistoryStore.getLastFocusedTimestampForHistoryItem(CHANNEL_PREFIX + a0);
|
|
if (lastFocusedTimestampForHistoryItem == null) {
|
|
return false;
|
|
}
|
|
if (lastFocusedTimestampForHistoryItem >= a1) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function _fun83649() { // fn#83649, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11101:1619, offset: 0x01f226bf, size: 27 bytes, params: 1, frame: 11
|
|
env0_0(isChannelFocused());
|
|
}
|
|
|
|
function _fun83650() { // fn#83650, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11101:1666, offset: 0x01f226da, size: 85 bytes, params: 1, frame: 14
|
|
var environment;
|
|
let value = environment.__proto__;
|
|
value = require(4008) /* metro dependency 4008: RootNavigationRefNative */;
|
|
value = value.getRootNavigationRef();
|
|
if (value != null) {
|
|
value.addListener('state', handleStateChange);
|
|
return _fun83652;
|
|
}
|
|
}
|
|
|
|
function handleStateChange() { // fn#83651, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11101:1742, offset: 0x01f2272f, size: 27 bytes, params: 1, frame: 11
|
|
env1_0(isChannelFocused());
|
|
}
|
|
|