Move /platform/detection vars into /env (#9707)
* Add platform vars to env * Replace /platform/detection with /env
This commit is contained in:
@@ -4,7 +4,6 @@ import {useSafeAreaInsets} from 'react-native-safe-area-context'
|
||||
import {msg, Trans} from '@lingui/macro'
|
||||
import {useLingui} from '@lingui/react'
|
||||
|
||||
import {isAndroid, isWeb} from '#/platform/detection'
|
||||
import {useOnboardingDispatch} from '#/state/shell'
|
||||
import {useOnboardingInternalState} from '#/screens/Onboarding/state'
|
||||
import {
|
||||
@@ -21,6 +20,7 @@ import {ArrowLeft_Stroke2_Corner0_Rounded as ArrowLeft} from '#/components/icons
|
||||
import {HEADER_SLOT_SIZE} from '#/components/Layout'
|
||||
import {createPortalGroup} from '#/components/Portal'
|
||||
import {P, Text} from '#/components/Typography'
|
||||
import {IS_ANDROID, IS_WEB} from '#/env'
|
||||
import {IS_INTERNAL} from '#/env'
|
||||
|
||||
const ONBOARDING_COL_WIDTH = 420
|
||||
@@ -58,7 +58,7 @@ export function Layout({children}: React.PropsWithChildren<{}>) {
|
||||
aria-label={dialogLabel}
|
||||
accessibilityLabel={dialogLabel}
|
||||
accessibilityHint={_(msg`Customizes your Bluesky experience`)}
|
||||
style={[isWeb ? a.fixed : a.absolute, a.inset_0, a.flex_1, t.atoms.bg]}>
|
||||
style={[IS_WEB ? a.fixed : a.absolute, a.inset_0, a.flex_1, t.atoms.bg]}>
|
||||
{!gtMobile ? (
|
||||
<View
|
||||
style={[
|
||||
@@ -151,7 +151,7 @@ export function Layout({children}: React.PropsWithChildren<{}>) {
|
||||
paddingTop: gtMobile ? 40 : headerHeight,
|
||||
paddingBottom: footerHeight,
|
||||
}}
|
||||
showsVerticalScrollIndicator={!isAndroid}
|
||||
showsVerticalScrollIndicator={!IS_ANDROID}
|
||||
scrollIndicatorInsets={{bottom: footerHeight - insets.bottom}}
|
||||
// @ts-expect-error web only --prf
|
||||
dataSet={{'stable-gutters': 1}}
|
||||
@@ -167,14 +167,14 @@ export function Layout({children}: React.PropsWithChildren<{}>) {
|
||||
<View
|
||||
onLayout={evt => setFooterHeight(evt.nativeEvent.layout.height)}
|
||||
style={[
|
||||
isWeb ? a.fixed : a.absolute,
|
||||
IS_WEB ? a.fixed : a.absolute,
|
||||
{bottom: 0, left: 0, right: 0},
|
||||
t.atoms.bg,
|
||||
t.atoms.border_contrast_low,
|
||||
a.border_t,
|
||||
a.align_center,
|
||||
gtMobile ? a.px_5xl : a.px_xl,
|
||||
isWeb
|
||||
IS_WEB
|
||||
? a.py_2xl
|
||||
: {
|
||||
paddingTop: tokens.space.md,
|
||||
|
||||
@@ -22,7 +22,6 @@ import {
|
||||
import {useRequestNotificationsPermission} from '#/lib/notifications/notifications'
|
||||
import {logEvent, useGate} from '#/lib/statsig/statsig'
|
||||
import {logger} from '#/logger'
|
||||
import {isWeb} from '#/platform/detection'
|
||||
import {useSetHasCheckedForStarterPack} from '#/state/preferences/used-starter-packs'
|
||||
import {getAllListMembers} from '#/state/queries/list-members'
|
||||
import {preferencesQueryKey} from '#/state/queries/preferences'
|
||||
@@ -47,6 +46,7 @@ import {atoms as a, useBreakpoints} from '#/alf'
|
||||
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
|
||||
import {ArrowRight_Stroke2_Corner0_Rounded as ArrowRight} from '#/components/icons/Arrow'
|
||||
import {Loader} from '#/components/Loader'
|
||||
import {IS_WEB} from '#/env'
|
||||
import * as bsky from '#/types/bsky'
|
||||
import {ValuePropositionPager} from './ValuePropositionPager'
|
||||
|
||||
@@ -305,7 +305,7 @@ function ValueProposition({
|
||||
|
||||
<OnboardingControls.Portal>
|
||||
<View style={gtMobile && [a.gap_md, a.flex_row]}>
|
||||
{gtMobile && (isWeb ? subStep !== 2 : true) && (
|
||||
{gtMobile && (IS_WEB ? subStep !== 2 : true) && (
|
||||
<Button
|
||||
disabled={saving}
|
||||
color="secondary"
|
||||
|
||||
@@ -17,7 +17,6 @@ import {useRequestNotificationsPermission} from '#/lib/notifications/notificatio
|
||||
import {logEvent, useGate} from '#/lib/statsig/statsig'
|
||||
import {isCancelledError} from '#/lib/strings/errors'
|
||||
import {logger} from '#/logger'
|
||||
import {isNative, isWeb} from '#/platform/detection'
|
||||
import {
|
||||
OnboardingControls,
|
||||
OnboardingDescriptionText,
|
||||
@@ -38,6 +37,7 @@ import * as Dialog from '#/components/Dialog'
|
||||
import {useSheetWrapper} from '#/components/Dialog/sheet-wrapper'
|
||||
import {CircleInfo_Stroke2_Corner0_Rounded} from '#/components/icons/CircleInfo'
|
||||
import {Text} from '#/components/Typography'
|
||||
import {IS_NATIVE, IS_WEB} from '#/env'
|
||||
import {type AvatarColor, avatarColors, type Emoji, emojiItems} from './types'
|
||||
|
||||
export interface Avatar {
|
||||
@@ -183,7 +183,7 @@ export function StepProfile() {
|
||||
let image = items[0]
|
||||
if (!image) return
|
||||
|
||||
if (!isWeb) {
|
||||
if (!IS_WEB) {
|
||||
try {
|
||||
image = await openCropper({
|
||||
imageUri: image.path,
|
||||
@@ -200,7 +200,7 @@ export function StepProfile() {
|
||||
|
||||
// If we are on mobile, prefetching the image will load the image into memory before we try and display it,
|
||||
// stopping any brief flickers.
|
||||
if (isNative) {
|
||||
if (IS_NATIVE) {
|
||||
await ExpoImage.prefetch(image.path)
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ import {wait} from '#/lib/async/wait'
|
||||
import {popularInterests, useInterestsDisplayNames} from '#/lib/interests'
|
||||
import {isBlockedOrBlocking, isMuted} from '#/lib/moderation/blocked-and-muted'
|
||||
import {logger} from '#/logger'
|
||||
import {isWeb} from '#/platform/detection'
|
||||
import {updateProfileShadow} from '#/state/cache/profile-shadow'
|
||||
import {useLanguagePrefs} from '#/state/preferences'
|
||||
import {useModerationOpts} from '#/state/preferences/moderation-opts'
|
||||
@@ -31,6 +30,7 @@ import {boostInterests, InterestTabs} from '#/components/InterestTabs'
|
||||
import {Loader} from '#/components/Loader'
|
||||
import * as ProfileCard from '#/components/ProfileCard'
|
||||
import * as toast from '#/components/Toast'
|
||||
import {IS_WEB} from '#/env'
|
||||
import type * as bsky from '#/types/bsky'
|
||||
import {bulkWriteFollows} from '../util'
|
||||
|
||||
@@ -161,7 +161,7 @@ export function StepSuggestedAccounts() {
|
||||
style={[
|
||||
a.overflow_hidden,
|
||||
a.mt_sm,
|
||||
isWeb
|
||||
IS_WEB
|
||||
? [a.max_w_full, web({minHeight: '100vh'})]
|
||||
: {marginHorizontal: tokens.space.xl * -1},
|
||||
a.flex_1,
|
||||
@@ -213,7 +213,7 @@ export function StepSuggestedAccounts() {
|
||||
a.mt_md,
|
||||
a.border_y,
|
||||
t.atoms.border_contrast_low,
|
||||
isWeb && [a.border_x, a.rounded_sm, a.overflow_hidden],
|
||||
IS_WEB && [a.border_x, a.rounded_sm, a.overflow_hidden],
|
||||
]}>
|
||||
{suggestedUsers?.actors.map((user, index) => (
|
||||
<SuggestedProfileCard
|
||||
@@ -324,7 +324,7 @@ function TabBar({
|
||||
...interestsDisplayNames,
|
||||
}
|
||||
}
|
||||
gutterWidth={isWeb ? 0 : tokens.space.xl}
|
||||
gutterWidth={IS_WEB ? 0 : tokens.space.xl}
|
||||
/>
|
||||
)
|
||||
}
|
||||
@@ -350,7 +350,7 @@ function SuggestedProfileCard({
|
||||
const node = cardRef.current
|
||||
if (!node || hasTrackedRef.current) return
|
||||
|
||||
if (isWeb && typeof IntersectionObserver !== 'undefined') {
|
||||
if (IS_WEB && typeof IntersectionObserver !== 'undefined') {
|
||||
const observer = new IntersectionObserver(
|
||||
entries => {
|
||||
if (entries[0]?.isIntersecting && !hasTrackedRef.current) {
|
||||
|
||||
@@ -4,7 +4,6 @@ import * as bcp47Match from 'bcp-47-match'
|
||||
|
||||
import {useEnableKeyboardControllerScreen} from '#/lib/hooks/useEnableKeyboardController'
|
||||
import {useGate} from '#/lib/statsig/statsig'
|
||||
import {isNative} from '#/platform/detection'
|
||||
import {useLanguagePrefs} from '#/state/preferences'
|
||||
import {
|
||||
Layout,
|
||||
@@ -24,6 +23,7 @@ import {useIsFindContactsFeatureEnabledBasedOnGeolocation} from '#/components/co
|
||||
import {useFindContactsFlowState} from '#/components/contacts/state'
|
||||
import {Portal} from '#/components/Portal'
|
||||
import {ScreenTransition} from '#/components/ScreenTransition'
|
||||
import {IS_NATIVE} from '#/env'
|
||||
import {ENV} from '#/env'
|
||||
import {StepFindContacts} from './StepFindContacts'
|
||||
import {StepFindContactsIntro} from './StepFindContactsIntro'
|
||||
@@ -50,7 +50,7 @@ export function Onboarding() {
|
||||
useIsFindContactsFeatureEnabledBasedOnGeolocation()
|
||||
const showFindContacts =
|
||||
ENV !== 'e2e' &&
|
||||
isNative &&
|
||||
IS_NATIVE &&
|
||||
findContactsEnabled &&
|
||||
!gate('disable_onboarding_find_contacts')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user