Move /platform/detection vars into /env (#9707)
* Add platform vars to env * Replace /platform/detection with /env
This commit is contained in:
@@ -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]
|
||||
}>
|
||||
|
||||
@@ -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') {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user