Add Sign out of all accounts to Settings
This commit is contained in:
@@ -173,6 +173,7 @@ export function SettingsScreen({}: Props) {
|
|||||||
const {accounts, currentAccount} = useSession()
|
const {accounts, currentAccount} = useSession()
|
||||||
const {mutate: clearPreferences} = useClearPreferencesMutation()
|
const {mutate: clearPreferences} = useClearPreferencesMutation()
|
||||||
const {setShowLoggedOut} = useLoggedOutViewControls()
|
const {setShowLoggedOut} = useLoggedOutViewControls()
|
||||||
|
const {logoutEveryAccount} = useSessionApi()
|
||||||
const closeAllActiveElements = useCloseAllActiveElements()
|
const closeAllActiveElements = useCloseAllActiveElements()
|
||||||
const exportCarControl = useDialogControl()
|
const exportCarControl = useDialogControl()
|
||||||
const birthdayControl = useDialogControl()
|
const birthdayControl = useDialogControl()
|
||||||
@@ -237,6 +238,10 @@ export function SettingsScreen({}: Props) {
|
|||||||
openModal({name: 'delete-account'})
|
openModal({name: 'delete-account'})
|
||||||
}, [openModal])
|
}, [openModal])
|
||||||
|
|
||||||
|
const onPressLogoutEveryAccount = React.useCallback(() => {
|
||||||
|
logoutEveryAccount('Settings')
|
||||||
|
}, [logoutEveryAccount])
|
||||||
|
|
||||||
const onPressResetPreferences = React.useCallback(async () => {
|
const onPressResetPreferences = React.useCallback(async () => {
|
||||||
clearPreferences()
|
clearPreferences()
|
||||||
}, [clearPreferences])
|
}, [clearPreferences])
|
||||||
@@ -422,6 +427,27 @@ export function SettingsScreen({}: Props) {
|
|||||||
<Trans>Add account</Trans>
|
<Trans>Add account</Trans>
|
||||||
</Text>
|
</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
|
|
||||||
|
{accounts.length > 1 && (
|
||||||
|
<TouchableOpacity
|
||||||
|
style={[styles.linkCard, pal.view]}
|
||||||
|
onPress={
|
||||||
|
isSwitchingAccounts ? undefined : onPressLogoutEveryAccount
|
||||||
|
}
|
||||||
|
accessibilityRole="button"
|
||||||
|
accessibilityLabel={_(msg`Sign out of all accounts`)}
|
||||||
|
accessibilityHint={undefined}>
|
||||||
|
<View style={[styles.iconContainer, pal.btn]}>
|
||||||
|
<FontAwesomeIcon
|
||||||
|
icon="arrow-right-from-bracket"
|
||||||
|
style={pal.text as FontAwesomeIconStyle}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
<Text type="lg" style={pal.text}>
|
||||||
|
<Trans>Sign out of all accounts</Trans>
|
||||||
|
</Text>
|
||||||
|
</TouchableOpacity>
|
||||||
|
)}
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View style={styles.spacer20} />
|
<View style={styles.spacer20} />
|
||||||
|
|||||||
Reference in New Issue
Block a user