Move /platform/detection vars into /env (#9707)
* Add platform vars to env * Replace /platform/detection with /env
This commit is contained in:
@@ -7,7 +7,7 @@ import {
|
||||
} from 'react'
|
||||
|
||||
import {isFirefox, isSafari} from '#/lib/browser'
|
||||
import {isWeb} from '#/platform/detection'
|
||||
import {IS_WEB} from '#/env'
|
||||
|
||||
function fullscreenSubscribe(onChange: () => void) {
|
||||
document.addEventListener('fullscreenchange', onChange)
|
||||
@@ -15,7 +15,7 @@ function fullscreenSubscribe(onChange: () => void) {
|
||||
}
|
||||
|
||||
export function useFullscreen(ref?: React.RefObject<HTMLElement | null>) {
|
||||
if (!isWeb) throw new Error("'useFullscreen' is a web-only hook")
|
||||
if (!IS_WEB) throw new Error("'useFullscreen' is a web-only hook")
|
||||
const isFullscreen = useSyncExternalStore(fullscreenSubscribe, () =>
|
||||
Boolean(document.fullscreenElement),
|
||||
)
|
||||
|
||||
@@ -4,9 +4,9 @@ import {
|
||||
createStarterPackLinkFromAndroidReferrer,
|
||||
httpStarterPackUriToAtUri,
|
||||
} from '#/lib/strings/starter-pack'
|
||||
import {isAndroid} from '#/platform/detection'
|
||||
import {useHasCheckedForStarterPack} from '#/state/preferences/used-starter-packs'
|
||||
import {useSetActiveStarterPack} from '#/state/shell/starter-pack'
|
||||
import {IS_ANDROID} from '#/env'
|
||||
import {Referrer, SharedPrefs} from '../../../modules/expo-bluesky-swiss-army'
|
||||
|
||||
export function useStarterPackEntry() {
|
||||
@@ -32,7 +32,7 @@ export function useStarterPackEntry() {
|
||||
;(async () => {
|
||||
let uri: string | null | undefined
|
||||
|
||||
if (isAndroid) {
|
||||
if (IS_ANDROID) {
|
||||
const res = await Referrer.getGooglePlayReferrerInfoAsync()
|
||||
|
||||
if (res && res.installReferrer) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {useEffect, useState} from 'react'
|
||||
|
||||
import {isWeb} from '#/platform/detection'
|
||||
import {useSession} from '#/state/session'
|
||||
import {IS_WEB} from '#/env'
|
||||
|
||||
export function useWelcomeModal() {
|
||||
const {hasSession} = useSession()
|
||||
@@ -22,7 +22,7 @@ export function useWelcomeModal() {
|
||||
// 2. We're on the web (this is a web-only feature)
|
||||
// 3. We're on the homepage (path is '/' or '/home')
|
||||
// 4. User hasn't actively closed the modal in this session
|
||||
if (isWeb && !hasSession && typeof window !== 'undefined') {
|
||||
if (IS_WEB && !hasSession && typeof window !== 'undefined') {
|
||||
const currentPath = window.location.pathname
|
||||
const isHomePage = currentPath === '/'
|
||||
const hasUserClosedModal =
|
||||
|
||||
Reference in New Issue
Block a user