This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

@@ -0,0 +1,2 @@
// Metro module 10688 (f10689).
export const RTC_PANEL_HEIGHT = 28;
@@ -0,0 +1,337 @@
// Metro module 12740 (f12741).
import CacheStore from "../../cache/CacheStore";
import AuthenticationStore from "../../../stores/AuthenticationStore";
import MessageStore from "../../../stores/MessageStore";
import SelectedChannelStore from "../../../stores/SelectedChannelStore";
import AppStateStore from "../../../stores/native/AppStateStore";
import { AppStates } from "../../../Constants";
import Logger from "../../debug/Logger";
import ConnectionIndicatorExperiment from "../../main_tabs_v2/native/ConnectionIndicatorExperiment";
import Module589 from "../../../_bundle/Module589";
import NetworkUtils from "../../../utils/NetworkUtils";
import Dispatcher from "../../../Dispatcher";
let c8778_8, c8778_9, c8778_10, delayMs, delayMs2, HIDDEN, state, isAuthenticated, c8778_16, c8778_17, isLoadingMessages, c8778_19, state2, c8778_21, c8778_22, c8778_23, handleLoadingMessagesChanged, handleAuthStoreChanged, handleAppStateUpdate;
const updateState = function updateState() {
let r12, r34, OFFLINE, delayMs4, delayMs5;
L58: {
r12 = HIDDEN;
if (!c8778_19 && AppStateStore.getState() !== AppStates.BACKGROUND) {
L14: {
if (c8778_16 != null && isAuthenticated != null) {
if (c8778_16) {
OFFLINE = c8778_10.OFFLINE;
break L14;
}
L8: {
if (isAuthenticated) {
if (c8778_17 && !isLoadingMessages) {
break L8;
}
OFFLINE = c8778_10.CONNECTING;
break L14;
}
}
OFFLINE = c8778_10.ONLINE;
} else {
OFFLINE = c8778_10.UNKNOWN;
}
}
if (c8778_9.HIDDEN === r12) {
if (c8778_10.OFFLINE === OFFLINE) {
r34 = {
delayed: {
state: c8778_9.NO_CONNECTION,
delayMs: delayMs2
}
};
break L58;
}
if (c8778_10.CONNECTING === OFFLINE) {
if (CacheStore.hasCache()) {
let timeoutMs2 = ConnectionIndicatorExperiment.getConfig({
location: "ConnectivityIndicatorStateStore"
}).timeoutMs;
if (timeoutMs2 == null) {
timeoutMs2 = 10000;
}
delayMs5 = timeoutMs2;
} else {
delayMs5 = delayMs2;
}
r34 = {
delayed: {
state: c8778_9.WAITING_FOR_NETWORK,
delayMs: delayMs5
}
};
break L58;
}
if (c8778_10.ONLINE !== OFFLINE) {
c8778_10.UNKNOWN;
}
r34 = {};
break L58;
}
if (c8778_9.BACK_ONLINE === r12) {
if (c8778_10.OFFLINE === OFFLINE) {
r34 = {
delayed: {
state: c8778_9.NO_CONNECTION,
delayMs: delayMs2
}
};
break L58;
}
if (c8778_10.CONNECTING === OFFLINE) {
if (CacheStore.hasCache()) {
let timeoutMs = ConnectionIndicatorExperiment.getConfig({
location: "ConnectivityIndicatorStateStore"
}).timeoutMs;
if (timeoutMs == null) {
timeoutMs = 10000;
}
delayMs4 = timeoutMs;
} else {
delayMs4 = delayMs2;
}
r34 = {
delayed: {
state: c8778_9.WAITING_FOR_NETWORK,
delayMs: delayMs4
}
};
break L58;
}
if (c8778_10.ONLINE !== OFFLINE && c8778_10.UNKNOWN !== OFFLINE) {
r34 = {};
break L58;
}
r34 = {
delayed: {
state: c8778_9.HIDDEN,
delayMs
}
};
break L58;
}
if (c8778_9.WAITING_FOR_NETWORK === r12) {
if (c8778_10.OFFLINE === OFFLINE) {
r34 = {
immediate: c8778_9.NO_CONNECTION
};
break L58;
}
if (c8778_10.ONLINE === OFFLINE) {
r34 = {
immediate: c8778_9.BACK_ONLINE,
delayed: {
state: c8778_9.HIDDEN,
delayMs
}
};
break L58;
}
if (c8778_10.CONNECTING !== OFFLINE) {
c8778_10.UNKNOWN;
}
r34 = {};
break L58;
}
const NO_CONNECTION = c8778_9.NO_CONNECTION;
r34 = void 0;
if (NO_CONNECTION !== r12) {
break L58;
}
if (c8778_10.CONNECTING === OFFLINE) {
r34 = {
immediate: c8778_9.WAITING_FOR_NETWORK
};
break L58;
}
if (c8778_10.ONLINE === OFFLINE) {
r34 = {
immediate: c8778_9.BACK_ONLINE,
delayed: {
state: c8778_9.HIDDEN,
delayMs
}
};
break L58;
}
if (c8778_10.OFFLINE !== OFFLINE) {
c8778_10.UNKNOWN;
}
r34 = {};
} else {
r34 = {
immediate: c8778_9.HIDDEN
};
}
}
if (r34.immediate != null) {
const immediate = r34.immediate;
HIDDEN = immediate;
if (state !== null && state === immediate) {
if (c8778_21 != null) {
c8778_8.verbose("clearing pending state update timer");
clearTimeout(c8778_21);
c8778_21 = null;
}
state = null;
}
if (r12 !== HIDDEN) {
c8778_8.verbose(`state changed immediately from ${r12} to ${HIDDEN}`);
if (c8778_23 != null) {
c8778_23.emitChange();
}
}
}
if (r34.delayed != null) {
const delayed = r34.delayed;
const { state: state3, delayMs: delayMs3 } = delayed;
if (state === state3 && c8778_21 != null) {
return void 0;
}
if (c8778_21 != null) {
c8778_8.verbose("clearing existing state update timer because we're scheduling a new one");
clearTimeout(c8778_21);
}
state = state3;
c8778_21 = setTimeout(() => {
c8778_21 = null;
state = null;
const r8 = HIDDEN;
HIDDEN = state3;
if (r8 !== state3) {
c8778_8.verbose(`state changed after a delay from ${r8} to ${HIDDEN}`);
if (c8778_23 != null) {
c8778_23.emitChange();
}
}
}, delayMs3);
} else {
if (c8778_21 != null) {
c8778_8.verbose("clearing pending state update timer");
clearTimeout(c8778_21);
c8778_21 = null;
}
state = null;
}
};
const handleConnectionClosed = function handleConnectionClosed() {
c8778_17 = false;
updateState();
return false;
};
handleLoadingMessagesChanged = function handleLoadingMessagesChanged() {
const channelId = SelectedChannelStore.getChannelId();
if (channelId == null) {
return false;
}
const isLoadingMessages2 = MessageStore.isLoadingMessages(channelId);
if (isLoadingMessages2 !== isLoadingMessages) {
isLoadingMessages = isLoadingMessages2;
updateState();
}
return false;
};
handleAuthStoreChanged = function handleAuthStoreChanged() {
const isAuthenticated2 = AuthenticationStore.isAuthenticated();
if (isAuthenticated !== isAuthenticated2) {
isAuthenticated = isAuthenticated2;
updateState();
}
return false;
};
handleAppStateUpdate = function handleAppStateUpdate() {
const state4 = AppStateStore.getState();
if (AppStates.ACTIVE === state4) {
if (state2 === AppStates.BACKGROUND) {
c8778_19 = true;
if (c8778_22 != null) {
clearTimeout(c8778_22);
}
c8778_22 = setTimeout(() => {
c8778_19 = false;
c8778_22 = null;
updateState();
}, 5000);
}
} else if (AppStates.BACKGROUND === state4) {
if (c8778_22 != null) {
clearTimeout(c8778_22);
c8778_22 = null;
}
} else {
AppStates.INACTIVE;
}
state2 = state4;
updateState();
return false;
};
c8778_8 = new Logger("ConnectivityIndicatorStateStore");
c8778_9 = {
HIDDEN: "hidden",
WAITING_FOR_NETWORK: "waiting_for_network",
NO_CONNECTION: "no_connection",
BACK_ONLINE: "back_online"
};
c8778_10 = {
UNKNOWN: "unknown",
ONLINE: "online",
OFFLINE: "offline",
CONNECTING: "connecting"
};
delayMs = 2000;
delayMs2 = 1000;
HIDDEN = c8778_9.HIDDEN;
state = null;
isAuthenticated = null;
c8778_16 = null;
c8778_17 = false;
isLoadingMessages = false;
c8778_19 = false;
state2 = null;
c8778_21 = null;
c8778_22 = null;
c8778_23 = null;
class ConnectivityIndicatorStateStore extends Module589.Store {
static displayName = "ConnectivityIndicatorStateStore";
initialize() {
this.waitFor(AuthenticationStore, CacheStore, MessageStore, SelectedChannelStore, AppStateStore);
this.syncWith([MessageStore], handleLoadingMessagesChanged);
this.syncWith([AuthenticationStore], handleAuthStoreChanged);
this.syncWith([AppStateStore], handleAppStateUpdate);
NetworkUtils.addOfflineCallback(() => {
c8778_16 = true;
updateState();
});
NetworkUtils.addOnlineCallback(() => {
c8778_16 = false;
updateState();
});
c8778_16 = !NetworkUtils.isOnline();
isAuthenticated = AuthenticationStore.isAuthenticated();
updateState();
}
getState() {
return HIDDEN;
}
}
const connectivityIndicatorStateStore = new ConnectivityIndicatorStateStore(Dispatcher, {
CONNECTION_OPEN: function handleConnectionOpen() {
c8778_17 = true;
updateState();
return false;
},
CONNECTION_RESUMED: function handleConnectionResumed() {
c8778_17 = true;
updateState();
return false;
},
CONNECTION_CLOSED: handleConnectionClosed,
CONNECTION_INTERRUPTED: handleConnectionClosed
});
c8778_23 = connectivityIndicatorStateStore;
export default connectivityIndicatorStateStore;
export { c8778_9 as ConnectivityIndicatorState };
@@ -0,0 +1,87 @@
// Metro module 10692 (f10693).
import { View } from "react-native";
import ChannelStore from "../../../../stores/ChannelStore";
import GuildStore from "../../../../stores/GuildStore";
import RTCConnectionStore from "../../../../stores/RTCConnectionStore";
import SessionsStore from "../../../../stores/SessionsStore";
import { RTC_PANEL_HEIGHT } from "../ConnectivityConstants";
import { RTCConnectionStates } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import useVoiceStateForRemoteSession from "../../../game_console/hooks/useVoiceStateForRemoteSession";
import { useStateFromStoresObject } from "../../../../_bundle/Module589";
import useCanSpeakInChannel from "../../../stage_channels/useCanSpeakInChannel";
import useIsInvitedToSpeak from "../../../stage_channels/useIsInvitedToSpeak";
import * as _shared from "../../../../design/shared";
import useTheme from "../../../../hooks/useTheme";
import { useIsScreenLandscape } from "../../../screen/useIsScreenLandscape.native";
import { isModalOpen } from "../../../main_tabs_v2/helpers/NavigationRouteUtils.native";
import ChannelCallModal from "../../../video_calls/native/components/ChannelCallModal";
import { isAndroid } from "../../../../utils/PlatformUtils";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import StatusBar_android from "../../../status_bar/native/components/StatusBar.android";
import GlobalStageChannelStatus from "../../../stage_channels/native/components/GlobalStageChannelStatus";
const useStyles = createStyles({
bgNeutral: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST
},
bg: {
backgroundColor: Module712.unsafe_rawColors.GREEN_360
},
container: {
paddingHorizontal: 16,
minHeight: RTC_PANEL_HEIGHT,
alignItems: "center",
justifyContent: "center"
}
});
export default function ConnectivityGlobalStatusContent() {
const styles = useStyles();
const voiceStateForRemoteSession = useVoiceStateForRemoteSession();
let c18199_0 = voiceStateForRemoteSession;
const stateFromStoresObject = useStateFromStoresObject([RTCConnectionStore, GuildStore, ChannelStore, SessionsStore], () => {
let r10 = c18199_0?.channelId;
if (r10 == null) {
r10 = RTCConnectionStore.getChannelId();
}
const channel = ChannelStore.getChannel(r10);
const guild = GuildStore.getGuild(c18199_0 != null ? channel == null ? void 0 : channel.getGuildId() : RTCConnectionStore.getGuildId());
let r24 = c18199_0?.sessionId;
if (r24 == null) {
r24 = "";
}
const sessionById = SessionsStore.getSessionById(r24);
const remotePlatform = sessionById == null ? void 0 : sessionById.clientInfo.os;
return {
guild,
channel,
rtcConnectionState: c18199_0 != null ? RTCConnectionStates.RTC_CONNECTED : RTCConnectionStore.getState(),
remotePlatform
};
}, [voiceStateForRemoteSession]);
const { guild, channel, rtcConnectionState, remotePlatform } = stateFromStoresObject;
const r15 = channel == null ? void 0 : channel.isGuildStageVoice();
let r37 = useCanSpeakInChannel(channel?.id);
const isInvitedToSpeak = useIsInvitedToSpeak();
const hasRTCConnectivity = channel != null;
const isThemeDark = _shared.isThemeDark(useTheme());
let r47 = hasRTCConnectivity;
if (r15) {
if (!r37) {
r37 = isInvitedToSpeak;
}
r47 = r37;
}
let r51 = useIsScreenLandscape() && isModalOpen(ChannelCallModal) && isAndroid();
const top = useSafeAreaInsets_native().top;
const style = [r47 ? styles.bg : styles.bgNeutral, styles.container, {
paddingTop: r51 ? 0 : top
}];
if (r51) {
r51 = <StatusBar_android hidden />;
}
return <View style={style}>
{r51}
{r15 ? <GlobalStageChannelStatus channel={channel} guild={guild} hasRTCConnectivity={hasRTCConnectivity} isDarkTheme={isThemeDark} rtcConnectionState={rtcConnectionState} remotePlatform={remotePlatform} /> : null}
</View>;
};
@@ -0,0 +1,99 @@
// Metro module 10691 (f10692).
import { useCallback, useRef, useEffect, useMemo } from "react";
import * as _Module17 from "react-native";
import { StyleSheet, TouchableWithoutFeedback, View } from "react-native";
import ActionSheetStore from "../../../action_sheet/native/ActionSheetStore";
import ChannelRTCStore from "../../../calls/ChannelRTCStore";
import NativeMenuStore from "../../../native_menu/native/NativeMenuStore";
import ChannelStore from "../../../../stores/ChannelStore";
import RTCConnectionStore from "../../../../stores/RTCConnectionStore";
import useVoiceStateForRemoteSession from "../../../game_console/hooks/useVoiceStateForRemoteSession";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { useVoiceChatNavigationContext } from "../../../voice_chat/native/VoiceChatModalContext";
import { navigateToVoiceChannel } from "../../../../utils/native/PrivateChannelCallUtils";
import { intl, t } from "../../../../intl/index.native";
import GlobalStatusContent from "./GlobalStatusContent";
import { useSharedValue } from "../../../reanimated/ReanimatedRexport";
import { useGlobalStatusIndicatorState } from "../useGlobalStatusIndicatorState";
const { NativeEventEmitter, NativeModules } = _Module17;
let c7185_15 = new NativeEventEmitter(NativeModules.DCDStatusBarOverlayViewManager);
const GlobalStatusIndicatorWrapper = (props) => {
let stateFromStores2, openVoice, callback, ref;
const onPress = props.onPress;
stateFromStores2 = void 0;
openVoice = void 0;
callback = void 0;
ref = void 0;
const voiceStateForRemoteSession = useVoiceStateForRemoteSession();
let c18196_1 = voiceStateForRemoteSession;
const stateFromStores = useStateFromStores([RTCConnectionStore], () => {
let r5 = c18196_1?.channelId;
if (r5 == null) {
r5 = RTCConnectionStore.getChannelId();
}
return r5;
}, [voiceStateForRemoteSession]);
stateFromStores2 = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(stateFromStores), [stateFromStores]);
openVoice = useVoiceChatNavigationContext()?.openVoice;
callback = useCallback(() => {
if (stateFromStores2 != null) {
if (openVoice != null && ChannelRTCStore.getChatOpen(stateFromStores2.id)) {
openVoice();
} else {
navigateToVoiceChannel(stateFromStores2, "RTC Panel");
}
if (onPress != null) {
onPress();
}
}
}, [stateFromStores2, onPress, openVoice]);
ref = useRef(callback);
useEffect(() => {
ref.current = callback;
});
useEffect(() => {
let c26795_0 = c7185_15.addListener("StatusBarTapped", () => {
ref.current();
});
return () => {
if (c26795_0 != null) {
c26795_0.remove();
}
};
}, [stateFromStores]);
return <TouchableWithoutFeedback accessibilityRole={stateFromStores2 != null ? "button" : "text"} accessibilityHint={stateFromStores2 != null ? intl.string(t.GaCMgX) : void 0} onPress={callback}>
<View>
<GlobalStatusContent />
</View>
</TouchableWithoutFeedback>;
};
export default function GlobalStatusIndicator(a0) {
let height, c18197_4, stateFromStores3;
const { children, showWhenParticipantOnScreen = false, forceHide = false } = a0;
let c18197_1 = forceHide;
const onPress2 = a0.onPress;
height = void 0;
c18197_4 = void 0;
stateFromStores3 = void 0;
const globalStatusIndicatorState = useGlobalStatusIndicatorState(showWhenParticipantOnScreen);
const stateFromStores4 = useStateFromStores([ActionSheetStore], () => ActionSheetStore.getContent() != null);
const stateFromStores5 = useStateFromStores([NativeMenuStore], () => NativeMenuStore.isOpen());
height = globalStatusIndicatorState.height;
const r30 = globalStatusIndicatorState.isVisible && !forceHide;
c18197_4 = r30;
stateFromStores3 = stateFromStores4 || stateFromStores5;
return useMemo(() => <>
<View importantForAccessibility={stateFromStores3 ? "no-hide-descendants" : void 0} accessibilityElementsHidden={stateFromStores3} style={[StyleSheet.absoluteFill, {
marginTop: c18197_1 ? 0 : height,
overflow: "hidden"
}]}>{children}</View>
{c18197_4 ? <GlobalStatusIndicatorWrapper onPress={onPress2} /> : null}
</>, [children, stateFromStores3, r30, onPress2, height, forceHide]);
};
export function useGlobalStatusIndicatorHeightSharedValue(a0) {
const sharedValue = useSharedValue(a0.height);
useEffect(() => {
sharedValue.set(a0.height);
}, [a0.height, sharedValue]);
return sharedValue;
}
@@ -0,0 +1,73 @@
// Metro module 10687 (f10688).
import ChannelStore from "../../../stores/ChannelStore";
import RTCConnectionStore from "../../../stores/RTCConnectionStore";
import { RTC_PANEL_HEIGHT } from "./ConnectivityConstants";
import { EMPTY_STRING_SNOWFLAKE_ID } from "../../../Constants";
import { useHasPipParticipant } from "../../video_calls/native/usePipVideoOrStream";
import useVoiceStateForRemoteSession from "../../game_console/hooks/useVoiceStateForRemoteSession";
import { useStateFromStores } from "../../../_bundle/Module589";
import useIsInvitedToSpeak from "../../stage_channels/useIsInvitedToSpeak";
import { useGetStageRTCPanelHeight } from "../../stage_channels/StageChannelHeightHooks";
import { useOpenModalKey } from "../../main_tabs_v2/helpers/NavigationRouteUtils.native";
import { getVoiceChannelKey } from "../../../utils/native/PrivateChannelCallUtils";
import { useIsVoicePanelShowing } from "../../voice_panel/VoicePanelUtils.native";
import useMyCurrentStageChannel from "../../stage_channels/useMyCurrentStageChannel";
export function useGlobalStatusIndicatorState(r14 = false) {
let c18193_1;
c18193_1 = void 0;
let r13 = useHasPipParticipant({
isActivityViewFocused: false
});
const voiceStateForRemoteSession = useVoiceStateForRemoteSession();
const stateFromStores = useStateFromStores([RTCConnectionStore], () => RTCConnectionStore.getChannelId());
const isInvitedToSpeak = useIsInvitedToSpeak();
c18193_1 = isInvitedToSpeak;
const stateFromStores2 = useStateFromStores([ChannelStore], () => {
const channel = ChannelStore.getChannel(stateFromStores);
return (channel == null ? void 0 : channel.isGuildStageVoice()) && !c18193_1;
}, [stateFromStores, isInvitedToSpeak]);
const r4 = stateFromStores != null;
let height = useGetStageRTCPanelHeight(stateFromStores);
const openModalKey = useOpenModalKey();
let r1 = voiceStateForRemoteSession != null;
if (r1) {
let channelId = voiceStateForRemoteSession.channelId;
if (channelId == null) {
channelId = EMPTY_STRING_SNOWFLAKE_ID;
}
r1 = getVoiceChannelKey(channelId) !== openModalKey;
}
let r54 = useIsVoicePanelShowing();
const r58 = useMyCurrentStageChannel() != null;
if (!r54) {
let r59 = r1 ? !r1 : r58 ? !isInvitedToSpeak : !r58;
if (r59) {
let r61 = !r4;
if (r4) {
if (r13) {
r13 = !r14;
}
r61 = r13;
}
r59 = r61;
}
r54 = r59;
}
let isVisible = !r54;
if (!(!r54 && isInvitedToSpeak)) {
height = r54 ? 0 : RTC_PANEL_HEIGHT;
}
const r63 = {
height,
isVisible,
isCustomBackground: null
};
if (!r54) {
isVisible = r4;
}
if (isVisible) {
isVisible = !stateFromStores2;
}
r63.isCustomBackground = isVisible;
return r63;
}