Move /platform/detection vars into /env (#9707)

* Add platform vars to env

* Replace /platform/detection with /env
This commit is contained in:
Eric Bailey
2026-01-16 16:28:17 -06:00
committed by GitHub
parent bd510d8468
commit 0589bd7d9e
244 changed files with 789 additions and 789 deletions
+4 -4
View File
@@ -16,7 +16,6 @@ import {
} from '#/lib/routes/types'
import {cleanError} from '#/lib/strings/errors'
import {s} from '#/lib/styles'
import {isNative, isWeb} from '#/platform/detection'
import {
type SavedFeedItem,
useGetPopularFeedsQuery,
@@ -46,6 +45,7 @@ import {SettingsGear2_Stroke2_Corner0_Rounded as Gear} from '#/components/icons/
import * as Layout from '#/components/Layout'
import {Link} from '#/components/Link'
import * as ListCard from '#/components/ListCard'
import {IS_NATIVE, IS_WEB} from '#/env'
type Props = NativeStackScreenProps<CommonNavigatorParams, 'Feeds'>
@@ -385,7 +385,7 @@ export function FeedsScreen(_props: Props) {
const onChangeSearchFocus = React.useCallback(
(focus: boolean) => {
if (focus && searchBarIndex > -1) {
if (isNative) {
if (IS_NATIVE) {
// scrollToIndex scrolls the exact right amount, so use if available
listRef.current?.scrollToIndex({
index: searchBarIndex,
@@ -681,7 +681,7 @@ function FeedsSavedHeader() {
return (
<View
style={
isWeb
IS_WEB
? [
a.flex_row,
a.px_md,
@@ -717,7 +717,7 @@ function FeedsAboutHeader() {
return (
<View
style={
isWeb
IS_WEB
? [a.flex_row, a.px_md, a.pt_lg, a.pb_lg, a.gap_md]
: [{flexDirection: 'row-reverse'}, a.p_lg, a.gap_md]
}>
+2 -2
View File
@@ -12,7 +12,6 @@ import {
type NativeStackScreenProps,
} from '#/lib/routes/types'
import {logEvent} from '#/lib/statsig/statsig'
import {isWeb} from '#/platform/detection'
import {emitSoftReset} from '#/state/events'
import {
type SavedFeedSourceInfo,
@@ -37,6 +36,7 @@ import {FollowingEmptyState} from '#/view/com/posts/FollowingEmptyState'
import {FollowingEndOfFeed} from '#/view/com/posts/FollowingEndOfFeed'
import {NoFeedsPinned} from '#/screens/Home/NoFeedsPinned'
import * as Layout from '#/components/Layout'
import {IS_WEB} from '#/env'
import {useDemoMode} from '#/storage/hooks/demo-mode'
type Props = NativeStackScreenProps<HomeTabNavigatorParams, 'Home' | 'Start'>
@@ -48,7 +48,7 @@ export function HomeScreen(props: Props) {
usePinnedFeedsInfos()
React.useEffect(() => {
if (isWeb && !currentAccount) {
if (IS_WEB && !currentAccount) {
const getParams = new URLSearchParams(window.location.search)
const splash = getParams.get('splash')
if (splash === 'true') {
+3 -3
View File
@@ -14,7 +14,6 @@ import {
} from '#/lib/routes/types'
import {s} from '#/lib/styles'
import {logger} from '#/logger'
import {isNative} from '#/platform/detection'
import {emitSoftReset, listenSoftReset} from '#/state/events'
import {RQKEY as NOTIFS_RQKEY} from '#/state/queries/notifications/feed'
import {useNotificationSettingsQuery} from '#/state/queries/notifications/settings'
@@ -39,6 +38,7 @@ import {SettingsGear2_Stroke2_Corner0_Rounded as SettingsIcon} from '#/component
import * as Layout from '#/components/Layout'
import {InlineLinkText, Link} from '#/components/Link'
import {Loader} from '#/components/Loader'
import {IS_NATIVE} from '#/env'
// We don't currently persist this across reloads since
// you gotta visit All to clear the badge anyway.
@@ -197,7 +197,7 @@ function NotificationsTab({
// event handlers
// =
const scrollToTop = useCallback(() => {
scrollElRef.current?.scrollToOffset({animated: isNative, offset: 0})
scrollElRef.current?.scrollToOffset({animated: IS_NATIVE, offset: 0})
setMinimalShellMode(false)
}, [scrollElRef, setMinimalShellMode])
@@ -227,7 +227,7 @@ function NotificationsTab({
// on focus, check for latest, but only invalidate if the user
// isnt scrolled down to avoid moving content underneath them
let currentIsScrolledDown
if (isNative) {
if (IS_NATIVE) {
currentIsScrolledDown = isScrolledDown
} else {
// On the web, this isn't always updated in time so