Move /platform/detection vars into /env (#9707)
* Add platform vars to env * Replace /platform/detection with /env
This commit is contained in:
@@ -13,7 +13,6 @@ import {getTabState, TabState} from '#/lib/routes/helpers'
|
||||
import {type NavigationProp} from '#/lib/routes/types'
|
||||
import {sanitizeHandle} from '#/lib/strings/handles'
|
||||
import {colors} from '#/lib/styles'
|
||||
import {isWeb} from '#/platform/detection'
|
||||
import {emitSoftReset} from '#/state/events'
|
||||
import {useKawaiiMode} from '#/state/preferences/kawaii'
|
||||
import {useUnreadNotifications} from '#/state/queries/notifications/unread'
|
||||
@@ -55,6 +54,7 @@ import {InlineLinkText} from '#/components/Link'
|
||||
import {Text} from '#/components/Typography'
|
||||
import {useSimpleVerificationState} from '#/components/verification'
|
||||
import {VerificationCheck} from '#/components/verification/VerificationCheck'
|
||||
import {IS_WEB} from '#/env'
|
||||
|
||||
const iconWidth = 26
|
||||
|
||||
@@ -165,7 +165,7 @@ let DrawerContent = ({}: React.PropsWithoutRef<{}>): React.ReactNode => {
|
||||
(tab: 'Home' | 'Search' | 'Messages' | 'Notifications' | 'MyProfile') => {
|
||||
const state = navigation.getState()
|
||||
setDrawerOpen(false)
|
||||
if (isWeb) {
|
||||
if (IS_WEB) {
|
||||
// hack because we have flat navigator for web and MyProfile does not exist on the web navigator -ansh
|
||||
if (tab === 'MyProfile') {
|
||||
navigation.navigate('Profile', {name: currentAccount!.handle})
|
||||
|
||||
@@ -27,7 +27,6 @@ import {
|
||||
|
||||
import {PWI_ENABLED} from '#/lib/build-flags'
|
||||
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
||||
import {isNative, isWeb} from '#/platform/detection'
|
||||
import {useSession} from '#/state/session'
|
||||
import {useOnboardingState} from '#/state/shell'
|
||||
import {
|
||||
@@ -39,6 +38,7 @@ import {Onboarding} from '#/screens/Onboarding'
|
||||
import {SignupQueued} from '#/screens/SignupQueued'
|
||||
import {atoms as a, useLayoutBreakpoints} from '#/alf'
|
||||
import {PolicyUpdateOverlay} from '#/components/PolicyUpdateOverlay'
|
||||
import {IS_NATIVE, IS_WEB} from '#/env'
|
||||
import {BottomBarWeb} from './bottom-bar/BottomBarWeb'
|
||||
import {DesktopLeftNav} from './desktop/LeftNav'
|
||||
import {DesktopRightNav} from './desktop/RightNav'
|
||||
@@ -115,7 +115,7 @@ function NativeStackNavigator({
|
||||
const {setShowLoggedOut} = useLoggedOutViewControls()
|
||||
const {isMobile} = useWebMediaQueries()
|
||||
const {leftNavMinimal} = useLayoutBreakpoints()
|
||||
if (!hasSession && (!PWI_ENABLED || activeRouteRequiresAuth || isNative)) {
|
||||
if (!hasSession && (!PWI_ENABLED || activeRouteRequiresAuth || IS_NATIVE)) {
|
||||
return <LoggedOut />
|
||||
}
|
||||
if (hasSession && currentAccount?.signupQueued) {
|
||||
@@ -158,7 +158,7 @@ function NativeStackNavigator({
|
||||
describe={describe}
|
||||
/>
|
||||
</View>
|
||||
{isWeb && (
|
||||
{IS_WEB && (
|
||||
<>
|
||||
{showBottomBar ? <BottomBarWeb /> : <DesktopLeftNav />}
|
||||
{!isMobile && <DesktopRightNav routeName={activeRoute.name} />}
|
||||
|
||||
@@ -11,7 +11,6 @@ import {useIntentHandler} from '#/lib/hooks/useIntentHandler'
|
||||
import {useNotificationsHandler} from '#/lib/hooks/useNotificationHandler'
|
||||
import {useNotificationsRegistration} from '#/lib/notifications/notifications'
|
||||
import {isStateAtTabRoot} from '#/lib/routes/helpers'
|
||||
import {isAndroid, isIOS} from '#/platform/detection'
|
||||
import {useDialogFullyExpandedCountContext} from '#/state/dialogs'
|
||||
import {useSession} from '#/state/session'
|
||||
import {
|
||||
@@ -43,6 +42,7 @@ import {Outlet as PortalOutlet} from '#/components/Portal'
|
||||
import {useAgeAssurance} from '#/ageAssurance'
|
||||
import {NoAccessScreen} from '#/ageAssurance/components/NoAccessScreen'
|
||||
import {RedirectOverlay} from '#/ageAssurance/components/RedirectOverlay'
|
||||
import {IS_ANDROID, IS_IOS} from '#/env'
|
||||
import {RoutesContainer, TabsNavigator} from '#/Navigation'
|
||||
import {BottomSheetOutlet} from '../../../modules/bottom-sheet'
|
||||
import {updateActiveViewAsync} from '../../../modules/expo-bluesky-swiss-army/src/VisibilityView'
|
||||
@@ -60,7 +60,7 @@ function ShellInner() {
|
||||
useNotificationsHandler()
|
||||
|
||||
useEffect(() => {
|
||||
if (isAndroid) {
|
||||
if (IS_ANDROID) {
|
||||
const listener = BackHandler.addEventListener('hardwareBackPress', () => {
|
||||
return closeAnyActiveElement()
|
||||
})
|
||||
@@ -80,7 +80,7 @@ function ShellInner() {
|
||||
const navigation = useNavigation()
|
||||
const dedupe = useDedupe(1000)
|
||||
useEffect(() => {
|
||||
if (!isAndroid) return
|
||||
if (!IS_ANDROID) return
|
||||
const onFocusOrBlur = () => {
|
||||
setTimeout(() => {
|
||||
dedupe(updateActiveViewAsync)
|
||||
@@ -190,11 +190,13 @@ function DrawerLayout({children}: {children: React.ReactNode}) {
|
||||
swipeEdgeWidth={winDim.width}
|
||||
swipeMinVelocity={100}
|
||||
swipeMinDistance={10}
|
||||
drawerType={isIOS ? 'slide' : 'front'}
|
||||
drawerType={IS_IOS ? 'slide' : 'front'}
|
||||
overlayStyle={{
|
||||
backgroundColor: select(t.name, {
|
||||
light: 'rgba(0, 57, 117, 0.1)',
|
||||
dark: isAndroid ? 'rgba(16, 133, 254, 0.1)' : 'rgba(1, 82, 168, 0.1)',
|
||||
dark: IS_ANDROID
|
||||
? 'rgba(16, 133, 254, 0.1)'
|
||||
: 'rgba(1, 82, 168, 0.1)',
|
||||
dim: 'rgba(10, 13, 16, 0.8)',
|
||||
}),
|
||||
}}>
|
||||
@@ -220,7 +222,7 @@ export function Shell() {
|
||||
<SystemBars
|
||||
style={{
|
||||
statusBar:
|
||||
t.name !== 'light' || (isIOS && fullyExpandedCount > 0)
|
||||
t.name !== 'light' || (IS_IOS && fullyExpandedCount > 0)
|
||||
? 'light'
|
||||
: 'dark',
|
||||
navigationBar: t.name !== 'light' ? 'light' : 'dark',
|
||||
|
||||
Reference in New Issue
Block a user