Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

[Session] Base (#3541)

* Add readLastActiveAccount to use accounts[] as source of truth

* Add public service constant, use

authored by

Eric Bailey and committed by
GitHub
6aded4f2 5b82b150

+14 -5
+2 -2
src/App.native.tsx
··· 16 16 17 17 import {Provider as StatsigProvider} from '#/lib/statsig/statsig' 18 18 import {init as initPersistedState} from '#/state/persisted' 19 - import * as persisted from '#/state/persisted' 20 19 import {Provider as LabelDefsProvider} from '#/state/preferences/label-defs' 20 + import {readLastActiveAccount} from '#/state/session/util/readLastActiveAccount' 21 21 import {useIntentHandler} from 'lib/hooks/useIntentHandler' 22 22 import {useNotificationsListener} from 'lib/notifications/notifications' 23 23 import {QueryProvider} from 'lib/react-query' ··· 64 64 Toast.show(_(msg`Sorry! Your session expired. Please log in again.`)) 65 65 }) 66 66 67 - const account = persisted.get('session').currentAccount 67 + const account = readLastActiveAccount() 68 68 resumeSession(account) 69 69 }, [resumeSession, _]) 70 70
+2 -2
src/App.web.tsx
··· 7 7 8 8 import {Provider as StatsigProvider} from '#/lib/statsig/statsig' 9 9 import {init as initPersistedState} from '#/state/persisted' 10 - import * as persisted from '#/state/persisted' 11 10 import {Provider as LabelDefsProvider} from '#/state/preferences/label-defs' 11 + import {readLastActiveAccount} from '#/state/session/util/readLastActiveAccount' 12 12 import {useIntentHandler} from 'lib/hooks/useIntentHandler' 13 13 import {QueryProvider} from 'lib/react-query' 14 14 import {ThemeProvider} from 'lib/ThemeContext' ··· 42 42 43 43 // init 44 44 useEffect(() => { 45 - const account = persisted.get('session').currentAccount 45 + const account = readLastActiveAccount() 46 46 resumeSession(account) 47 47 }, [resumeSession]) 48 48
+1
src/lib/constants.ts
··· 4 4 Platform.OS === 'android' ? 'http://10.0.2.2:2583' : 'http://localhost:2583' 5 5 export const STAGING_SERVICE = 'https://staging.bsky.dev' 6 6 export const BSKY_SERVICE = 'https://bsky.social' 7 + export const PUBLIC_BSKY_SERVICE = 'https://public.api.bsky.app' 7 8 export const DEFAULT_SERVICE = BSKY_SERVICE 8 9 const HELP_DESK_LANG = 'en-us' 9 10 export const HELP_DESK_URL = `https://blueskyweb.zendesk.com/hc/${HELP_DESK_LANG}`
+3 -1
src/state/queries/index.ts
··· 1 1 import {BskyAgent} from '@atproto/api' 2 2 3 + import {PUBLIC_BSKY_SERVICE} from '#/lib/constants' 4 + 3 5 export const PUBLIC_BSKY_AGENT = new BskyAgent({ 4 - service: 'https://public.api.bsky.app', 6 + service: PUBLIC_BSKY_SERVICE, 5 7 }) 6 8 7 9 export const STALE = {
+6
src/state/session/util/readLastActiveAccount.ts
··· 1 + import * as persisted from '#/state/persisted' 2 + 3 + export function readLastActiveAccount() { 4 + const {currentAccount, accounts} = persisted.get('session') 5 + return accounts.find(a => a.did === currentAccount?.did) 6 + }