Files
discord-decomp/sources/components_native/AppContainer.tsx
T
2026-07-27 16:20:00 +03:00

319 lines
19 KiB
TypeScript

/* Metro module 13096; source: components_native/AppContainer.tsx; dependencies: [57, 31, 27, 6936, 1934, 661, 33, 4501, 697, 4017, 8750, 5321, 5083, 1239, 1217, 4008, 4510, 5457, 13097, 13098, 4007, 1230, 4048, 683, 4009, 13099, 5468, 1485, 1360, 13100, 477, 11340, 13101, 13109, 3932, 13111, 1481, 10710, 12074, 12080, 13112, 4027, 13113, 13115, 13117, 13118, 13119, 14289, 14297, 14298, 1216, 2] */
function _fun100128(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#100128, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13286:6, offset: 0x021deb9a, size: 598 bytes, params: 8, frame: 24
var property;
const env0_1 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_4 = importDefault(dependencyMap[0]);
const env0_5 = importAll(dependencyMap[1]);
const env0_6 = require(dependencyMap[2]).NativeModules;
const env0_7 = require(dependencyMap[3]).handleHistoryStoreNavigationChange;
const env0_8 = importDefault(dependencyMap[4]);
let value = require(dependencyMap[5]);
const env0_9 = value.AnalyticEvents;
const env0_10 = value.ComponentActions;
const env0_11 = value.Routes;
value = require(dependencyMap[6]);
const env0_12 = value.jsx;
const env0_13 = value.jsxs;
value = require(dependencyMap[7]);
const createStyles = value.createStyles;
const ANDROID_NAVIGATION_BAR_BACKGROUND = importDefault(dependencyMap[8]).colors.ANDROID_NAVIGATION_BAR_BACKGROUND;
const env0_14 = Reflect.apply(createStyles, value, [{flex: {flex: 1},
rootBackgroundColor: {backgroundColor: ANDROID_NAVIGATION_BAR_BACKGROUND}}]);
value = require(dependencyMap[9]);
const configureReanimatedLogger = value.configureReanimatedLogger;
const ReanimatedLogLevel = require(dependencyMap[9]).ReanimatedLogLevel;
Reflect.apply(configureReanimatedLogger, value, [{level: ReanimatedLogLevel.error, strict: false}]);
try {
property = dependencyMap[16];
value = require(property);
value.enableFreeze();
} catch (error) {
}
value = require(dependencyMap[17]);
const setDesignConfig = value.setDesignConfig;
const useTrackNavigatorScreenImpression = require(dependencyMap[18]).useTrackNavigatorScreenImpression;
Reflect.apply(setDesignConfig, value, [{useTrackNavigatorScreenImpression: useTrackNavigatorScreenImpression}]);
object = {code: 'function AppContainerTsx1(){const{RNScreensTurboModule}=this.__closure;global.RNScreensTurboModule=RNScreensTurboModule;}'};
value = importDefault(dependencyMap[50]);
value = value.profiledRootComponent(AppContainer_100141);
require(dependencyMap[51]).fileFinishedImporting('components_native/AppContainer.tsx');
exports.default = value;
}
function GestureWrapper({children}) { // fn#100129, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13286:418, offset: 0x021dedf0, size: 135 bytes, params: 2, frame: 20
const styles = useStyles();
const value3 = env0_5.useMemo(_fun100130,
[(require(8750) /* metro dependency 8750: useIsScreenLandscapeNative */).useIsScreenLandscape(), styles]);
const GestureHandlerRootView = (require(5321) /* metro dependency 5321 */).GestureHandlerRootView;
return (
<GestureHandlerRootView style={value3}>
{children}
</GestureHandlerRootView>
);
}
function handleNavigationOnReady() { // fn#100131, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13286:630, offset: 0x021deea4, size: 138 bytes, params: 1, frame: 15
(importDefault(5083) /* metro dependency 5083: ModalDispatchQueue */).flush();
const ComponentDispatch = (require(1239) /* metro dependency 1239: ComponentDispatchUtils */).ComponentDispatch;
const dispatch = ComponentDispatch.dispatch;
const NAVIGATOR_READY = ComponentActions.NAVIGATOR_READY;
Reflect.apply(dispatch, ComponentDispatch, [NAVIGATOR_READY]);
const routingInstrumentation = (require(1217) /* metro dependency 1217: SentryInitUtils */).routingInstrumentation;
const registerNavigationContainer = routingInstrumentation.registerNavigationContainer;
const rootNavigationRefNativeModule = require(4008) /* metro dependency 4008: RootNavigationRefNative */;
const getRootNavigationRef = rootNavigationRefNativeModule.getRootNavigationRef;
Reflect.apply(registerNavigationContainer, routingInstrumentation, [Reflect.apply(getRootNavigationRef,
rootNavigationRefNativeModule, [])]);
handleHistoryStoreNavigationChange();
}
function AppNavigationContainer({children}) { // fn#100132, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13286:964, offset: 0x021def2e, size: 268 bytes, params: 2, frame: 20
const value2 = (importDefault(4048) /* metro dependency 4048: useTheme */)();
const env0_0 = env0_5.useRef(undefined);
const value3 = env0_5.useCallback(_fun100133, []);
const value4 = env0_5.useMemo(_fun100134, []);
const env0_1 = env0_5.useRef(true);
env0_5.useEffect(_fun100135, []);
const value5 = (require(5468) /* metro dependency 5468: useNavigationThemeNative */).useNavigationTheme(value2);
const NavigationContainer = (require(1485) /* metro dependency 1485 */).NavigationContainer;
return (
<NavigationContainer
theme={value5}
ref={(require(4008) /* metro dependency 4008: RootNavigationRefNative */).getRootNavigationRef()}
onReady={handleNavigationOnReady}
onStateChange={value3}
initialState={value4}
>
{children}
</NavigationContainer>
);
}
function ShareNavigationContainer({children}) { // fn#100139, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13286:2219, offset: 0x021df32c, size: 105 bytes, params: 2, frame: 17
const value3 = (require(5468) /* metro dependency 5468: useNavigationThemeNative */).useNavigationTheme((importDefault(4048) /* metro dependency 4048: useTheme */)());
const NavigationContainer = (require(1485) /* metro dependency 1485 */).NavigationContainer;
return (
<NavigationContainer theme={value3}>
{children}
</NavigationContainer>
);
}
function AppNavigationContainerOrEmpty({children, appEntryKey}) { // fn#100140, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13286:2379, offset: 0x021df395, size: 122 bytes, params: 2, frame: 14
if (appEntryKey === 'main') {
return (
<AppNavigationContainer>
{children}
</AppNavigationContainer>
);
}
if (appEntryKey === 'share') {
return (
<ShareNavigationContainer>
{children}
</ShareNavigationContainer>
);
}
return (require(1360) /* metro dependency 1360: GlobalUtils */).assertNever(appEntryKey);
}
function AppContainer_100141({children, appEntryKey}) { // fn#100141, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13286:2901, offset: 0x021df40f, size: 191 bytes, params: 2, frame: 18
(require(13100) /* metro dependency 13100: useRequestGatewaySocket */).useRequestGatewaySocket('AppContainer:' + appEntryKey);
env0_5.useEffect(_fun100142, []);
env0_5.useEffect(function() {
if (require(dependencyMap[30]).isIOS() && NativeModules.SplashScreenManager) {
NativeModules.SplashScreenManager.hideSplashScreen();
}
}, []);
return env0_5.useMemo(_fun100149, [appEntryKey, children, useManaContextProviderValue()]);
}
function _fun100130() { // fn#100130, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13286:514, offset: 0x021dee77, size: 45 bytes, params: 1, frame: 4
return [styles.flex, env0_1 ? styles.rootBackgroundColor : undefined];
}
function _fun100133() { // fn#100133, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13286:1063, offset: 0x021df03a, size: 441 bytes, params: 1, frame: 19
var currentRoute;
var value6;
var moduleValue4;
var defaultImport;
var value10;
var property;
var property2;
var value11;
var moduleValue6;
const rootNavigationRef = (require(4008) /* metro dependency 4008: RootNavigationRefNative */).getRootNavigationRef();
if (rootNavigationRef != null) {
if (rootNavigationRef.isReady()) {
currentRoute = rootNavigationRef.getCurrentRoute();
value6 = ((require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */).coerceMessagesRoute(currentRoute) ?? (require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */).coerceGuildsRoute(currentRoute)) != null;
moduleValue4 = require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */;
if (moduleValue4.coerceChannelRoute(env0_0.current) != null && value6) {
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
defaultImport.track(AnalyticEvents.NAV_DRAWER_OPENED);
}
env0_0.current = currentRoute;
value10 = env1_4((importDefault(13098) /* metro dependency 13098: getChannelDetailsFromRoute */)(currentRoute,
true), 2);
property = value10[0];
property2 = value10[1];
if (property2 != null) {
if (property2 !== SelectedChannelStore.getChannelId()) {
value11 = (require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */).coerceChannelRoute(currentRoute);
if (!(value11 != null && value11.params.showCreateThread)) {
moduleValue6 = require(1230) /* metro dependency 1230: router_utils */;
moduleValue6.transitionTo(Routes.CHANNEL(property, property2), {'openChannel': true,
'navigationReplace': false});
}
}
}
}
}
handleHistoryStoreNavigationChange();
}
function _fun100134() { // fn#100134, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13286:1632, offset: 0x021df1f3, size: 115 bytes, params: 1, frame: 16
let value = environment.__proto__;
value = undefined;
const value2 = (importDefault(4009) /* metro dependency 4009: getInitialNavigationState */)();
const defaultImport = importDefault(13099) /* metro dependency 13099: MainNavigationLogger */;
defaultImport.log('Initial Screen: ' + (value2 == null || value2.routes[0] == null ? value : value2.routes[0].name));
return value2;
}
function _fun100135() { // fn#100135, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13286:1779, offset: 0x021df266, size: 71 bytes, params: 1, frame: 15
if (env0_1.current) {
env0_1.current = false;
return undefined;
}
const env0_0 = global.setTimeout(_fun100136, 0);
return _fun100138;
}
function _fun100142() { // fn#100142, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13286:3019, offset: 0x021df4ce, size: 119 bytes, params: 1, frame: 15
var RNScreensTurboModule;
var moduleValue;
var runOnUI;
var closure;
if (!env1_15) {
RNScreensTurboModule = env1_0.RNScreensTurboModule;
moduleValue = require(4017) /* metro dependency 4017: ReanimatedRexport */;
runOnUI = moduleValue.runOnUI;
closure = e_100143;
closure.__closure = {RNScreensTurboModule: RNScreensTurboModule};
closure.__workletHash = 8891274578898;
closure.__initData = env1_16;
Reflect.apply(runOnUI, moduleValue, [closure])();
}
}
function useManaContextProviderValue() { // fn#100145, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13286:3332, owner: AppContainer_100141.useManaContextProviderValue, offset: 0x021df5a8, size: 143 bytes, params: 1, frame: 17
return env1_5.useMemo(_fun100147, [env1_5.useMemo(_fun100146,
[(require(14297) /* metro dependency 14297: RiveMobileRendererExperiment */).useRiveRendererExperiment('AppContainer'),
(require(14298) /* metro dependency 14298: RiveAppStatePlaybackExperiment */).useRiveAppStatePlaybackExperiment('AppContainer')])]);
}
function _fun100149() { // fn#100149, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13286:3757, offset: 0x021df6c7, size: 687 bytes, params: 1, frame: 61
const value = environment.__proto__;
const StartupProfiler = importDefault(11340) /* metro dependency 11340: StartupProfiler */;
const Profiles = (require(11340) /* metro dependency 11340: StartupProfiler */).Profiles;
const AppContainer = Profiles.AppContainer;
const ReanimatedScreenProvider = (require(13101) /* metro dependency 13101 */).ReanimatedScreenProvider;
const RootThemeContextProvider = (require(13109) /* metro dependency 13109: RootThemeContextProviderNative */).RootThemeContextProvider;
const ManaContextProvider = (require(3932) /* metro dependency 3932: ManaContextNative */).ManaContextProvider;
const manaContextProviderProps = {value: env0_2};
const AccessibilityPreferencesContextProviderNative = importDefault(13111) /* metro dependency 13111: AccessibilityPreferencesContextProviderNative */;
const AppEntryKeyContext = (require(1481) /* metro dependency 1481: AppEntryKeyContext */).AppEntryKeyContext;
const Provider = AppEntryKeyContext.Provider;
const appEntryKeyBinding = appEntryKey;
const WebViewContextProvider = (require(10710) /* metro dependency 10710: WebViewContext */).WebViewContextProvider;
const Router = (require(12074) /* metro dependency 12074 */).Router;
const routerProps = {history: (importDefault(12080) /* metro dependency 12080: RouteManager */).getHistory()};
const ErrorBoundary = importDefault(13112) /* metro dependency 13112: ErrorBoundary */;
const PortalProvider = (require(4027) /* metro dependency 4027 */).PortalProvider;
const Component = (importDefault(13113) /* metro dependency 13113: AnimatedKeyboardProviderAndroid */).Component;
const KeyCommandsView = importDefault(13115) /* metro dependency 13115: KeyCommandsView */;
const value3 = ((Component) => <Component />)(importDefault(13117) /* metro dependency 13117: ThemedStatusBar */);
const SafeAreaProvider = (require(13118) /* metro dependency 13118: SafeAreaProviderNative */).SafeAreaProvider;
const items2 = [children];
const SafeAreaReporter = (require(13118) /* metro dependency 13118: SafeAreaProviderNative */).SafeAreaReporter;
items2[1] = <SafeAreaReporter />;
items2[2] = ((Component) => <Component />)(importDefault(13119) /* metro dependency 13119: DevToolsLazy */);
items2[3] = ((Component) => <Component />)(importDefault(14289) /* metro dependency 14289: ScreenRecordingPip */);
return (
<StartupProfiler profile={AppContainer}>
<ReanimatedScreenProvider>
<RootThemeContextProvider>
<ManaContextProvider {...manaContextProviderProps}>
<AccessibilityPreferencesContextProviderNative>
<Provider value={appEntryKeyBinding}>
<AppNavigationContainerOrEmpty appEntryKey={appEntryKeyBinding}>
<WebViewContextProvider>
<Router {...routerProps}>
<GestureWrapper>
<ErrorBoundary>
<PortalProvider>
<Component>
<KeyCommandsView>
{value3}
<SafeAreaProvider>
{items2}
</SafeAreaProvider>
</KeyCommandsView>
</Component>
</PortalProvider>
</ErrorBoundary>
</GestureWrapper>
</Router>
</WebViewContextProvider>
</AppNavigationContainerOrEmpty>
</Provider>
</AccessibilityPreferencesContextProviderNative>
</ManaContextProvider>
</RootThemeContextProvider>
</ReanimatedScreenProvider>
</StartupProfiler>
);
}
function _fun100136() { // fn#100136, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13286:1817, offset: 0x021df2ad, size: 127 bytes, params: 1, frame: 14
var environment;
const value = environment.__proto__.__proto__;
const rootNavigationRef = (require(4008) /* metro dependency 4008: RootNavigationRefNative */).getRootNavigationRef();
if (rootNavigationRef != null) {
if (rootNavigationRef.isReady()) {
rootNavigationRef.reset((importDefault(4009) /* metro dependency 4009: getInitialNavigationState */)(rootNavigationRef.getState().routes.filter(function(a0) {
return a0.name === 'modal';
})));
}
}
}
function e_100143() { // fn#100143, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13286:3083, offset: 0x021df545, size: 24 bytes, params: 1, frame: 2
env2_0.RNScreensTurboModule = RNScreensTurboModule;
}
function _fun100146() { // fn#100146, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13286:3504, offset: 0x021df637, size: 55 bytes, params: 1, frame: 12
const items2 = [];
if (env0_0) {
items2.push('rive-mobile-renderer');
}
if (env0_1) {
items2.push('rive-app-state-playback');
}
return items2;
}
function _fun100147() { // fn#100147, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13286:3625, offset: 0x021df66e, size: 37 bytes, params: 1, frame: 3
return {experiments: {enabledExperiments: env0_2}, captureException: captureException_100148};
}
function captureException_100148(a0, a1) { // fn#100148, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13286:3683, offset: 0x021df693, size: 52 bytes, params: 3, frame: 13
const value = environment.__proto__.__proto__.__proto__;
return (importDefault(1216) /* metro dependency 1216: SentryUtilsNative */).captureException(a0, {tags: a1});
}