diff options
Diffstat (limited to 'src/view/shell')
-rw-r--r-- | src/view/shell/createNativeStackNavigatorWithAuth.tsx | 10 | ||||
-rw-r--r-- | src/view/shell/index.tsx | 11 | ||||
-rw-r--r-- | src/view/shell/index.web.tsx | 2 |
3 files changed, 12 insertions, 11 deletions
diff --git a/src/view/shell/createNativeStackNavigatorWithAuth.tsx b/src/view/shell/createNativeStackNavigatorWithAuth.tsx index 0f240ea00..938213c31 100644 --- a/src/view/shell/createNativeStackNavigatorWithAuth.tsx +++ b/src/view/shell/createNativeStackNavigatorWithAuth.tsx @@ -101,7 +101,7 @@ function NativeStackNavigator({ const onboardingState = useOnboardingState() const {showLoggedOut} = useLoggedOutView() const {setShowLoggedOut} = useLoggedOutViewControls() - const {isMobile} = useWebMediaQueries() + const {isMobile, isTabletOrMobile} = useWebMediaQueries() if ((!PWI_ENABLED || activeRouteRequiresAuth) && !hasSession) { return <LoggedOut /> } @@ -134,6 +134,10 @@ function NativeStackNavigator({ } } + // Show the bottom bar if we have a session only on mobile web. If we don't have a session, we want to show it + // on both tablet and mobile web so that we see the sign up CTA. + const showBottomBar = hasSession ? isMobile : isTabletOrMobile + return ( <NavigationContent> <NativeStackView @@ -142,8 +146,8 @@ function NativeStackNavigator({ navigation={navigation} descriptors={newDescriptors} /> - {isWeb && isMobile && <BottomBarWeb />} - {isWeb && !isMobile && ( + {isWeb && showBottomBar && <BottomBarWeb />} + {isWeb && !showBottomBar && ( <> <DesktopLeftNav /> <DesktopRightNav routeName={activeRoute.name} /> diff --git a/src/view/shell/index.tsx b/src/view/shell/index.tsx index 5320aebfc..6b0cc6808 100644 --- a/src/view/shell/index.tsx +++ b/src/view/shell/index.tsx @@ -52,6 +52,8 @@ function ShellInner() { const canGoBack = useNavigationState(state => !isStateAtTabRoot(state)) const {hasSession, currentAccount} = useSession() const closeAnyActiveElement = useCloseAnyActiveElement() + // start undefined + const currentAccountDid = React.useRef<string | undefined>(undefined) React.useEffect(() => { let listener = {remove() {}} @@ -66,13 +68,10 @@ function ShellInner() { }, [closeAnyActiveElement]) React.useEffect(() => { - if (currentAccount) { + // only runs when did changes + if (currentAccount && currentAccountDid.current !== currentAccount.did) { + currentAccountDid.current = currentAccount.did notifications.requestPermissionsAndRegisterToken(currentAccount) - } - }, [currentAccount]) - - React.useEffect(() => { - if (currentAccount) { const unsub = notifications.registerTokenChangeHandler(currentAccount) return unsub } diff --git a/src/view/shell/index.web.tsx b/src/view/shell/index.web.tsx index 76f4f5c9b..97c065502 100644 --- a/src/view/shell/index.web.tsx +++ b/src/view/shell/index.web.tsx @@ -11,7 +11,6 @@ import {DrawerContent} from './Drawer' import {useWebMediaQueries} from '../../lib/hooks/useWebMediaQueries' import {useNavigation} from '@react-navigation/native' import {NavigationProp} from 'lib/routes/types' -import {useAuxClick} from 'lib/hooks/useAuxClick' import {t} from '@lingui/macro' import {useIsDrawerOpen, useSetDrawerOpen} from '#/state/shell' import {useCloseAllActiveElements} from '#/state/util' @@ -26,7 +25,6 @@ function ShellInner() { const closeAllActiveElements = useCloseAllActiveElements() useWebBodyScrollLock(isDrawerOpen) - useAuxClick() useEffect(() => { const unsubscribe = navigator.addListener('state', () => { |