67 lines
2.9 KiB
TypeScript
67 lines
2.9 KiB
TypeScript
// Metro module 10509 (f10510).
|
|
import { useMemo, createContext, useEffect } from "react";
|
|
import ActionSheetStore from "../../../action_sheet/native/ActionSheetStore";
|
|
import GameConsoleStore from "../../../game_console/GameConsoleStore";
|
|
import { focusTimeout, resetFocusTimer, useChannelCallStore, useIsVoiceChatFocused } from "../ChannelCallStore";
|
|
import { useStateFromStores } from "../../../../_bundle/Module589";
|
|
import useIsPrivateAudioOnlyCall from "../useIsPrivateAudioOnlyCall";
|
|
import useIsActivityFocused from "../../../activities/useIsActivityFocused";
|
|
import { isIOS } from "../../../../utils/PlatformUtils";
|
|
import useTheme from "../../../../hooks/useTheme";
|
|
import StatusBar_android from "../../../status_bar/native/components/StatusBar.android";
|
|
import HomeIndicator from "../../../voice_panel/native/HomeIndicator";
|
|
let context;
|
|
const useRevealProviderValue = function useRevealProviderValue(channelCallStore, channel) {
|
|
let r7 = channelCallStore;
|
|
const stateFromStores2 = useStateFromStores([ActionSheetStore], () => ActionSheetStore.getKey() != null);
|
|
const isPrivateAudioOnlyCall = useIsPrivateAudioOnlyCall(channel);
|
|
const isVoiceChatFocused = useIsVoiceChatFocused();
|
|
const stateFromStores3 = useStateFromStores([GameConsoleStore], () => GameConsoleStore.getAwaitingRemoteSessionInfo() != null);
|
|
const isActivityFocused = useIsActivityFocused(channel.id);
|
|
if (!channelCallStore) {
|
|
r7 = stateFromStores2;
|
|
}
|
|
if (!r7) {
|
|
r7 = isPrivateAudioOnlyCall;
|
|
}
|
|
if (!r7) {
|
|
r7 = channel === null;
|
|
}
|
|
if (!r7) {
|
|
r7 = isVoiceChatFocused;
|
|
}
|
|
if (!r7) {
|
|
r7 = stateFromStores3;
|
|
}
|
|
const stateFromStores = r7;
|
|
const prefersDeferringSystemGestures = !!isIOS() && isActivityFocused;
|
|
return useMemo(() => ({
|
|
reveal: stateFromStores,
|
|
prefersDeferringSystemGestures
|
|
}), [stateFromStores, prefersDeferringSystemGestures]);
|
|
};
|
|
context = createContext({
|
|
reveal: true
|
|
});
|
|
export default function RevealProvider(props) {
|
|
const { channel, children, showStatus = false, useThemedBarStyle = false } = props;
|
|
const channelCallStore = useChannelCallStore((a0) => a0.focus);
|
|
const revealProviderValue = useRevealProviderValue(channelCallStore, channel);
|
|
const { reveal, prefersDeferringSystemGestures: prefersDeferringSystemGestures2 } = revealProviderValue;
|
|
useEffect(() => {
|
|
if (channelCallStore) {
|
|
resetFocusTimer();
|
|
} else {
|
|
focusTimeout.stop();
|
|
}
|
|
}, [channelCallStore]);
|
|
const theme = useTheme();
|
|
return <context.Provider value={revealProviderValue}>
|
|
<StatusBar_android hidden={reveal ? !reveal : !showStatus} animated barStyle={useThemedBarStyle ? theme !== "dark" ? "dark-content" : "light-content" : "light-content"} />
|
|
{children}
|
|
<HomeIndicator prefersHidden={reveal ? !reveal : !prefersDeferringSystemGestures2} prefersDeferringSystemGestures={prefersDeferringSystemGestures2} />
|
|
</context.Provider>;
|
|
};
|
|
export { context as RevealContext };
|
|
export { useRevealProviderValue };
|