diff --git a/src/components/main/Main.tsx b/src/components/main/Main.tsx index 37a922b62..f1322d6ff 100644 --- a/src/components/main/Main.tsx +++ b/src/components/main/Main.tsx @@ -24,12 +24,13 @@ import { dispatchHeavyAnimationEvent } from '../../hooks/useHeavyAnimationCheck' import buildClassName from '../../util/buildClassName'; import { fastRaf } from '../../util/schedulers'; import { waitForTransitionEnd } from '../../util/cssAnimationEndListeners'; +import { processDeepLink } from '../../util/deeplink'; +import windowSize from '../../util/windowSize'; import useShowTransition from '../../hooks/useShowTransition'; import useBackgroundMode from '../../hooks/useBackgroundMode'; import useBeforeUnload from '../../hooks/useBeforeUnload'; import useOnChange from '../../hooks/useOnChange'; import usePreventPinchZoomGesture from '../../hooks/usePreventPinchZoomGesture'; -import { processDeepLink } from '../../util/deeplink'; import { LOCATION_HASH } from '../../hooks/useHistoryBack'; import LeftColumn from '../left/LeftColumn'; @@ -167,6 +168,19 @@ const Main: FC = ({ } }, [lastSyncTime]); + // Prevent refresh by accidentally rotating device when listening to a voice chat + useEffect(() => { + if (!activeGroupCallId) { + return undefined; + } + + windowSize.disableRefresh(); + + return () => { + windowSize.enableRefresh(); + }; + }, [activeGroupCallId]); + const { transitionClassNames: middleColumnTransitionClassNames, } = useShowTransition(!isLeftColumnShown, undefined, true, undefined, shouldSkipHistoryAnimations);