Move /platform/detection vars into /env (#9707)
* Add platform vars to env * Replace /platform/detection with /env
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import React from 'react'
|
||||
|
||||
import {isWeb} from '#/platform/detection'
|
||||
import {useSession} from '#/state/session'
|
||||
import {useActiveStarterPack} from '#/state/shell/starter-pack'
|
||||
import {IS_WEB} from '#/env'
|
||||
|
||||
type State = {
|
||||
showLoggedOut: boolean
|
||||
@@ -55,7 +55,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
|
||||
const [state, setState] = React.useState<State>({
|
||||
showLoggedOut: shouldShowStarterPack,
|
||||
requestedAccountSwitchTo: shouldShowStarterPack
|
||||
? isWeb
|
||||
? IS_WEB
|
||||
? 'starterpack'
|
||||
: 'new'
|
||||
: undefined,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import {createContext, useCallback, useContext, useState} from 'react'
|
||||
|
||||
import {isWeb} from '#/platform/detection'
|
||||
import {type FeedDescriptor} from '#/state/queries/post-feed'
|
||||
import {useSession} from '#/state/session'
|
||||
import {IS_WEB} from '#/env'
|
||||
import {account} from '#/storage'
|
||||
|
||||
type StateContext = FeedDescriptor | null
|
||||
@@ -14,7 +14,7 @@ const setContext = createContext<SetContext>((_: string) => {})
|
||||
setContext.displayName = 'SelectedFeedSetContext'
|
||||
|
||||
function getInitialFeed(did?: string): FeedDescriptor | null {
|
||||
if (isWeb) {
|
||||
if (IS_WEB) {
|
||||
if (window.location.pathname === '/') {
|
||||
const params = new URLSearchParams(window.location.search)
|
||||
const feedFromUrl = params.get('feed')
|
||||
@@ -49,7 +49,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
|
||||
const saveState = useCallback(
|
||||
(feed: FeedDescriptor) => {
|
||||
setState(feed)
|
||||
if (isWeb) {
|
||||
if (IS_WEB) {
|
||||
try {
|
||||
sessionStorage.setItem('lastSelectedHomeFeed', feed)
|
||||
} catch {}
|
||||
|
||||
Reference in New Issue
Block a user