Cleanup
This commit is contained in:
+5
-2
@@ -70,6 +70,11 @@ import {AudioCategory, PlatformInfo} from '../modules/expo-bluesky-swiss-army'
|
|||||||
|
|
||||||
SplashScreen.preventAutoHideAsync()
|
SplashScreen.preventAutoHideAsync()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Begin geolocation ASAP
|
||||||
|
*/
|
||||||
|
beginResolveGeolocation()
|
||||||
|
|
||||||
function InnerApp() {
|
function InnerApp() {
|
||||||
const [isReady, setIsReady] = React.useState(false)
|
const [isReady, setIsReady] = React.useState(false)
|
||||||
const {currentAccount} = useSession()
|
const {currentAccount} = useSession()
|
||||||
@@ -90,7 +95,6 @@ function InnerApp() {
|
|||||||
await initialize()
|
await initialize()
|
||||||
await tryFetchGates(undefined, 'prefer-fresh-gates')
|
await tryFetchGates(undefined, 'prefer-fresh-gates')
|
||||||
}
|
}
|
||||||
await ensureGeolocationResolved()
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.error(`session: resume failed`, {message: e})
|
logger.error(`session: resume failed`, {message: e})
|
||||||
} finally {
|
} finally {
|
||||||
@@ -164,7 +168,6 @@ function App() {
|
|||||||
const [isReady, setReady] = useState(false)
|
const [isReady, setReady] = useState(false)
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
beginResolveGeolocation()
|
|
||||||
PlatformInfo.setAudioCategory(AudioCategory.Ambient)
|
PlatformInfo.setAudioCategory(AudioCategory.Ambient)
|
||||||
PlatformInfo.setAudioActive(false)
|
PlatformInfo.setAudioActive(false)
|
||||||
Promise.all([initPersistedState(), ensureGeolocationResolved()]).then(() =>
|
Promise.all([initPersistedState(), ensureGeolocationResolved()]).then(() =>
|
||||||
|
|||||||
+5
-2
@@ -55,6 +55,11 @@ import {useStarterPackEntry} from '#/components/hooks/useStarterPackEntry'
|
|||||||
import {Provider as PortalProvider} from '#/components/Portal'
|
import {Provider as PortalProvider} from '#/components/Portal'
|
||||||
import {BackgroundNotificationPreferencesProvider} from '../modules/expo-background-notification-handler/src/BackgroundNotificationHandlerProvider'
|
import {BackgroundNotificationPreferencesProvider} from '../modules/expo-background-notification-handler/src/BackgroundNotificationHandlerProvider'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Begin geolocation ASAP
|
||||||
|
*/
|
||||||
|
beginResolveGeolocation()
|
||||||
|
|
||||||
function InnerApp() {
|
function InnerApp() {
|
||||||
const [isReady, setIsReady] = React.useState(false)
|
const [isReady, setIsReady] = React.useState(false)
|
||||||
const {currentAccount} = useSession()
|
const {currentAccount} = useSession()
|
||||||
@@ -76,7 +81,6 @@ function InnerApp() {
|
|||||||
} finally {
|
} finally {
|
||||||
setIsReady(true)
|
setIsReady(true)
|
||||||
}
|
}
|
||||||
await ensureGeolocationResolved()
|
|
||||||
}
|
}
|
||||||
const account = readLastActiveAccount()
|
const account = readLastActiveAccount()
|
||||||
onLaunch(account)
|
onLaunch(account)
|
||||||
@@ -145,7 +149,6 @@ function App() {
|
|||||||
const [isReady, setReady] = useState(false)
|
const [isReady, setReady] = useState(false)
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
beginResolveGeolocation()
|
|
||||||
Promise.all([initPersistedState(), ensureGeolocationResolved()]).then(() =>
|
Promise.all([initPersistedState(), ensureGeolocationResolved()]).then(() =>
|
||||||
setReady(true),
|
setReady(true),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import {MMKV} from 'react-native-mmkv'
|
import {MMKV} from 'react-native-mmkv'
|
||||||
|
|
||||||
|
import {IS_DEV} from '#/env'
|
||||||
import {Device} from '#/storage/schema'
|
import {Device} from '#/storage/schema'
|
||||||
|
|
||||||
export * from '#/storage/schema'
|
export * from '#/storage/schema'
|
||||||
@@ -72,3 +73,10 @@ export class Storage<Scopes extends unknown[], Schema> {
|
|||||||
* `device.set([key], true)`
|
* `device.set([key], true)`
|
||||||
*/
|
*/
|
||||||
export const device = new Storage<[], Device>({id: 'bsky_device'})
|
export const device = new Storage<[], Device>({id: 'bsky_device'})
|
||||||
|
|
||||||
|
if (IS_DEV && typeof window !== 'undefined') {
|
||||||
|
// @ts-ignore
|
||||||
|
window.bsky_storage = {
|
||||||
|
device,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user