Move single account Sign Out below as well

This commit is contained in:
Dan Abramov
2024-08-15 02:26:49 +01:00
parent ba884ce659
commit 16f9939d15
+4 -28
View File
@@ -57,7 +57,6 @@ import {DeactivateAccountDialog} from '#/screens/Settings/components/DeactivateA
import {atoms as a, useTheme} from '#/alf' import {atoms as a, useTheme} from '#/alf'
import {useDialogControl} from '#/components/Dialog' import {useDialogControl} from '#/components/Dialog'
import {BirthDateSettingsDialog} from '#/components/dialogs/BirthDateSettings' import {BirthDateSettingsDialog} from '#/components/dialogs/BirthDateSettings'
import {navigate, resetToTab} from '#/Navigation'
import {Email2FAToggle} from './Email2FAToggle' import {Email2FAToggle} from './Email2FAToggle'
import {ExportCarDialog} from './ExportCarDialog' import {ExportCarDialog} from './ExportCarDialog'
@@ -77,7 +76,6 @@ function SettingsAccountCard({
const {_} = useLingui() const {_} = useLingui()
const t = useTheme() const t = useTheme()
const {currentAccount} = useSession() const {currentAccount} = useSession()
const {logoutCurrentAccount} = useSessionApi()
const {data: profile} = useProfileQuery({did: account.did}) const {data: profile} = useProfileQuery({did: account.did})
const isCurrentAccount = account.did === currentAccount?.did const isCurrentAccount = account.did === currentAccount?.did
@@ -103,31 +101,7 @@ function SettingsAccountCard({
{account.handle} {account.handle}
</Text> </Text>
</View> </View>
{isCurrentAccount ? (
<TouchableOpacity
testID="signOutBtn"
onPress={() => {
if (isNative) {
logoutCurrentAccount('Settings')
resetToTab('HomeTab')
} else {
navigate('Home').then(() => {
logoutCurrentAccount('Settings')
})
}
}}
accessibilityRole="button"
accessibilityLabel={_(msg`Sign out`)}
accessibilityHint={`Signs ${profile?.displayName} out of Bluesky`}
activeOpacity={0.8}>
<Text type="lg" style={pal.link}>
<Trans>Sign out</Trans>
</Text>
</TouchableOpacity>
) : (
<AccountDropdownBtn account={account} /> <AccountDropdownBtn account={account} />
)}
</View> </View>
) )
@@ -428,7 +402,6 @@ export function SettingsScreen({}: Props) {
</Text> </Text>
</TouchableOpacity> </TouchableOpacity>
{accounts.length > 1 && (
<TouchableOpacity <TouchableOpacity
style={[styles.linkCard, pal.view]} style={[styles.linkCard, pal.view]}
onPress={ onPress={
@@ -444,10 +417,13 @@ export function SettingsScreen({}: Props) {
/> />
</View> </View>
<Text type="lg" style={pal.text}> <Text type="lg" style={pal.text}>
{accounts.length > 1 ? (
<Trans>Sign out of all accounts</Trans> <Trans>Sign out of all accounts</Trans>
) : (
<Trans>Sign out</Trans>
)}
</Text> </Text>
</TouchableOpacity> </TouchableOpacity>
)}
</View> </View>
<View style={styles.spacer20} /> <View style={styles.spacer20} />