Files
discord-decomp/sources/modules/guild_themes/native/useRoutedActiveGuildTheme.tsx
T
2026-07-28 01:06:53 +03:00

130 lines
7.6 KiB
TypeScript

/* Metro module 4006; source: modules/guild_themes/native/useRoutedActiveGuildTheme.tsx; dependencies: [57, 31, 661, 4007, 4008, 4037, 4038, 2] */
import Module00057 from '../../../by-id/module-00057.js'; /* Metro dependency 57 */
import GuildThemeGuildIdOverrideContext from './GuildThemeGuildIdOverrideContext.tsx'; /* Metro dependency 4037 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
import * as RootNavigationRefNativeModule from '../../main_tabs_v2/RootNavigationRef.native.tsx'; /* Metro dependency 4008 */
import * as GuildThemeResolverModule from '../GuildThemeResolver.tsx'; /* Metro dependency 4038 */
function _fun32972(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#32972, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4164:6, offset: 0x01023fe8, size: 175 bytes, params: 8, frame: 19
const env0_0 = require;
const getActiveGuildThemeGuildIdSnapshot = function() {
var value5;
var value2 = require(dependencyMap[4]).getRootNavigationRef();
var value3 = null;
if (value3 != value2) {
if (value2.isReady()) {
value5 = _fun32975(value2.getRootState());
return value3 == value5 || value5 === ME ? value3 : value5;
}
}
return value3;
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
(FileImportTrackerModule).fileFinishedImporting('modules/guild_themes/native/useRoutedActiveGuildTheme.tsx');
exports.default = function() {
return require(dependencyMap[6]).useActiveGuildThemeForGuildId(_fun32978());
};
function getGuildIdFromNavigationState(a0) { // fn#32973, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4164:129, offset: 0x01024097, size: 95 bytes, params: 2, frame: 14
var guildId;
var r0;
var property;
var value;
if (a0 != null) {
var routes = a0.routes;
if (routes != null) {
property = routes[a0.index];
value = undefined;
guildId = property == null || property.params == null ? value : property.params.guildId;
if (guildId != null) {
r0 = guildId;
} else {
value = getGuildIdFromNavigationState(property == null ? value : property.state);
r0 = value;
}
return r0;
}
}
}
function getActiveGuildThemeGuildIdSnapshot() { // fn#32974, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4164:353, offset: 0x010240f6, size: 102 bytes, params: 1, frame: 13
var value5;
const rootNavigationRef = (RootNavigationRefNativeModule).getRootNavigationRef();
let value3 = null;
if (value3 != rootNavigationRef) {
if (rootNavigationRef.isReady()) {
value5 = ((a0) => {
var r4;
var getGuildIdFromNavigationStateBinding = getGuildIdFromNavigationState;
var value2 = undefined;
var value3 = getGuildIdFromNavigationStateBinding(a0);
if (value3 != null) {
return value3;
}
r4 = a0 == null || a0.routes == null ? value2 : a0.routes.map((require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */).coerceMainRoute).find(_fun32976);
return getGuildIdFromNavigationState(r4 == null ? value2 : r4.state);
})(rootNavigationRef.getRootState());
return value3 == value5 || value5 === ME ? value3 : value5;
}
}
return value3;
function getGuildIdFromRootNavigationState(a0) { // fn#32975, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4164:479, owner: getActiveGuildThemeGuildIdSnapshot.getGuildIdFromRootNavigationState, offset: 0x0102415c, size: 128 bytes, params: 2, frame: 18
const getGuildIdFromNavigationStateBinding = getGuildIdFromNavigationState;
const value2 = undefined;
const guildIdFromNavigationStateBinding = getGuildIdFromNavigationStateBinding(a0);
if (guildIdFromNavigationStateBinding != null) {
return guildIdFromNavigationStateBinding;
}
const r4 = a0 == null || a0.routes == null ? value2 : a0.routes.map((require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */).coerceMainRoute).find(function(a0) {
return a0 != null;
});
return getGuildIdFromNavigationState(r4 == null ? value2 : r4.state);
}
}
function useRoutedActiveGuildTheme() { // fn#32977, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4164:887, offset: 0x010241dc, size: 49 bytes, params: 1, frame: 13
return (GuildThemeResolverModule).useActiveGuildThemeForGuildId(useRoutedActiveGuildThemeGuildId());
function useRoutedActiveGuildThemeGuildId() { // fn#32978, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4164:930, owner: useRoutedActiveGuildTheme.useRoutedActiveGuildThemeGuildId, offset: 0x0102420d, size: 128 bytes, params: 1, frame: 17
var environment;
const value = environment.__proto__;
const binding = env1_4;
const value2 = binding.useContext(GuildThemeGuildIdOverrideContext);
const useState = binding.useState;
const value4 = env1_3(Reflect.apply(useState, binding, [getActiveGuildThemeGuildIdSnapshot]), 2);
const property = value4[0];
const env0_0 = value4[1];
binding.useEffect(_fun32979, []);
return value2 === undefined ? property : value2 === ME ? null : value2;
function _fun32979() { // fn#32979, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4164:1094, offset: 0x0102428d, size: 72 bytes, params: 1, frame: 13
var environment;
var handleStateChange2;
let value = environment.__proto__.__proto__;
value = require(4008) /* metro dependency 4008: RootNavigationRefNative */;
value = value.getRootNavigationRef();
if (value != null) {
handleStateChange2 = handleStateChange;
handleStateChange2();
return value.addListener('state', handleStateChange2);
}
function handleStateChange() { // fn#32980, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4164:1170, offset: 0x010242d5, size: 27 bytes, params: 1, frame: 11
env1_0(getActiveGuildThemeGuildIdSnapshot());
}
}
}
}
}
function _fun32976(a0) { // fn#32976, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4164:664, offset: 0x00d0b2f0, size: 11 bytes, params: 2, frame: 2
return a0 != null;
}
global.__d(_fun32972, 4006, [57, 31, 661, 4007, 4008, 4037, 4038,
2]) /* metro module 4006, dependencies: [57, 31, 661, 4007, 4008, 4037, 4038, 2] */;