Fixes issue with (#2119)

* Allow going directly to password input screen when switching accounts and password is required

* Revise state handling

* Handle logged out states, enable clearing requestedAccount

---------

Co-authored-by: Eric Bailey <git@esb.lol>
This commit is contained in:
Ansh 2023-12-07 16:53:50 -08:00 committed by GitHub
parent afca4bf701
commit 9d51886e43
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 108 additions and 22 deletions

View file

@ -11,7 +11,7 @@ export function useAccountSwitcher() {
const {track} = useAnalytics()
const {selectAccount, clearCurrentAccount} = useSessionApi()
const closeAllActiveElements = useCloseAllActiveElements()
const {setShowLoggedOut} = useLoggedOutViewControls()
const {requestSwitchToAccount} = useLoggedOutViewControls()
const onPressSwitchAccount = useCallback(
async (account: SessionAccount) => {
@ -34,7 +34,7 @@ export function useAccountSwitcher() {
}, 100)
} else {
closeAllActiveElements()
setShowLoggedOut(true)
requestSwitchToAccount({requestedAccount: account.did})
Toast.show(
`Please sign in as @${account.handle}`,
'circle-exclamation',
@ -50,7 +50,7 @@ export function useAccountSwitcher() {
clearCurrentAccount,
selectAccount,
closeAllActiveElements,
setShowLoggedOut,
requestSwitchToAccount,
],
)