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
+5 -5
View File
@@ -11,7 +11,6 @@ import {
} from '#/lib/hooks/usePermissions'
import {openCamera, openUnifiedPicker} from '#/lib/media/picker'
import {logger} from '#/logger'
import {isNative} from '#/platform/detection'
import {useCurrentAccountProfile} from '#/state/queries/useCurrentAccountProfile'
import {MAX_IMAGES} from '#/view/com/composer/state/composer'
import {UserAvatar} from '#/view/com/util/UserAvatar'
@@ -22,6 +21,7 @@ import {Camera_Stroke2_Corner0_Rounded as CameraIcon} from '#/components/icons/C
import {Image_Stroke2_Corner0_Rounded as ImageIcon} from '#/components/icons/Image'
import {SubtleHover} from '#/components/SubtleHover'
import {Text} from '#/components/Typography'
import {IS_NATIVE} from '#/env'
export function ComposerPrompt() {
const {_} = useLingui()
@@ -43,7 +43,7 @@ export function ComposerPrompt() {
logger.metric('composerPrompt:gallery:press', {})
// On web, open the composer with the gallery picker auto-opening
if (!isNative) {
if (!IS_NATIVE) {
openComposer({openGallery: true})
return
}
@@ -105,7 +105,7 @@ export function ComposerPrompt() {
return
}
if (isNative && Keyboard.isVisible()) {
if (IS_NATIVE && Keyboard.isVisible()) {
Keyboard.dismiss()
}
@@ -122,7 +122,7 @@ export function ComposerPrompt() {
]
openComposer({
imageUris: isNative ? imageUris : undefined,
imageUris: IS_NATIVE ? imageUris : undefined,
})
} catch (err: any) {
if (!String(err).toLowerCase().includes('cancel')) {
@@ -189,7 +189,7 @@ export function ComposerPrompt() {
<Trans>What's up?</Trans>
</Text>
<View style={[a.flex_row, a.gap_md]}>
{isNative && (
{IS_NATIVE && (
<Button
onPress={e => {
e.stopPropagation()
+4 -4
View File
@@ -20,7 +20,6 @@ import {getRootNavigation, getTabState, TabState} from '#/lib/routes/helpers'
import {type AllNavigatorParams} from '#/lib/routes/types'
import {logEvent} from '#/lib/statsig/statsig'
import {s} from '#/lib/styles'
import {isNative} from '#/platform/detection'
import {listenSoftReset} from '#/state/events'
import {FeedFeedbackProvider, useFeedFeedback} from '#/state/feed-feedback'
import {useSetHomeBadge} from '#/state/home-badge'
@@ -34,6 +33,7 @@ import {truncateAndInvalidate} from '#/state/queries/util'
import {useSession} from '#/state/session'
import {useSetMinimalShellMode} from '#/state/shell'
import {useHeaderOffset} from '#/components/hooks/useHeaderOffset'
import {IS_NATIVE} from '#/env'
import {PostFeed} from '../posts/PostFeed'
import {FAB} from '../util/fab/FAB'
import {type ListMethods} from '../util/List'
@@ -80,7 +80,7 @@ export function FeedPage({
const feedIsVideoMode =
feedInfo.contentMode === AppBskyFeedDefs.CONTENTMODEVIDEO
const _isVideoFeed = isBskyVideoFeed || feedIsVideoMode
return isNative && _isVideoFeed
return IS_NATIVE && _isVideoFeed
}, [feedInfo])
useEffect(() => {
@@ -91,7 +91,7 @@ export function FeedPage({
const scrollToTop = useCallback(() => {
scrollElRef.current?.scrollToOffset({
animated: isNative,
animated: IS_NATIVE,
offset: -headerOffset,
})
setMinimalShellMode(false)
@@ -136,7 +136,7 @@ export function FeedPage({
})
}, [scrollToTop, feed, queryClient])
const shouldPrefetch = isNative && isPageAdjacent
const shouldPrefetch = IS_NATIVE && isPageAdjacent
const isDiscoverFeed = feedInfo.uri === DISCOVER_FEED_URI
return (
<View
+3 -3
View File
@@ -4,7 +4,6 @@ import {msg, Trans} from '@lingui/macro'
import {useLingui} from '@lingui/react'
import {cleanError} from '#/lib/strings/errors'
import {isNative, isWeb} from '#/platform/detection'
import {useModerationOpts} from '#/state/preferences/moderation-opts'
import {getFeedTypeFromUri} from '#/state/queries/feed'
import {useProfileQuery} from '#/state/queries/profile'
@@ -15,6 +14,7 @@ import {Divider} from '#/components/Divider'
import {Warning_Stroke2_Corner0_Rounded as WarningIcon} from '#/components/icons/Warning'
import * as ProfileCard from '#/components/ProfileCard'
import {Text} from '#/components/Typography'
import {IS_NATIVE, IS_WEB} from '#/env'
export function MissingFeed({
style,
@@ -83,7 +83,7 @@ export function MissingFeed({
a.italic,
]}
numberOfLines={1}>
{isWeb ? (
{IS_WEB ? (
<Trans>Click for information</Trans>
) : (
<Trans>Tap for information</Trans>
@@ -205,7 +205,7 @@ function DialogInner({
</>
)}
</View>
{isNative && (
{IS_NATIVE && (
<Button
label={_(msg`Close`)}
onPress={() => control.close()}
+4 -4
View File
@@ -20,7 +20,6 @@ import {useQueryClient} from '@tanstack/react-query'
import {cleanError} from '#/lib/strings/errors'
import {logger} from '#/logger'
import {isIOS, isNative, isWeb} from '#/platform/detection'
import {usePreferencesQuery} from '#/state/queries/preferences'
import {RQKEY, useProfileFeedgensQuery} from '#/state/queries/profile-feedgens'
import {useSession} from '#/state/session'
@@ -33,6 +32,7 @@ import {atoms as a, ios, useTheme} from '#/alf'
import * as FeedCard from '#/components/FeedCard'
import {HashtagWide_Stroke1_Corner0_Rounded as HashtagWideIcon} from '#/components/icons/Hashtag'
import {ListFooter} from '#/components/Lists'
import {IS_IOS, IS_NATIVE, IS_WEB} from '#/env'
const LOADING = {_reactKey: '__loading__'}
const EMPTY = {_reactKey: '__empty__'}
@@ -111,7 +111,7 @@ export function ProfileFeedgens({
const onScrollToTop = useCallback(() => {
scrollElRef.current?.scrollToOffset({
animated: isNative,
animated: IS_NATIVE,
offset: -headerOffset,
})
queryClient.invalidateQueries({queryKey: RQKEY(did)})
@@ -194,7 +194,7 @@ export function ProfileFeedgens({
return (
<View
style={[
(index !== 0 || isWeb) && a.border_t,
(index !== 0 || IS_WEB) && a.border_t,
t.atoms.border_contrast_low,
a.px_lg,
a.py_lg,
@@ -218,7 +218,7 @@ export function ProfileFeedgens({
)
useEffect(() => {
if (isIOS && enabled && scrollElRef.current) {
if (IS_IOS && enabled && scrollElRef.current) {
const nativeTag = findNodeHandle(scrollElRef.current)
setScrollViewTag(nativeTag)
}