1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Refine account switching

Part of #663
This commit is contained in:
xmflsct
2023-01-16 22:11:41 +01:00
parent 74e794a215
commit 196f51bfca
6 changed files with 89 additions and 142 deletions

View File

@ -193,10 +193,12 @@ const ComponentInstance: React.FC<Props> = ({
}
})
const scopes = featureCheck('deprecate_auth_follow')
? ['read', 'write', 'push']
: ['read', 'write', 'follow', 'push']
const processUpdate = useCallback(() => {
const scopes = () =>
featureCheck('deprecate_auth_follow', instanceQuery.data?.version)
? ['read', 'write', 'push']
: ['read', 'write', 'follow', 'push']
if (domain) {
const accounts = getGlobalStorage.object('accounts')
if (accounts?.filter(account => account.startsWith(`${domain}/`)).length) {
@ -210,15 +212,15 @@ const ComponentInstance: React.FC<Props> = ({
},
{
text: t('common:buttons.continue'),
onPress: () => appsMutation.mutate({ domain, scopes })
onPress: () => appsMutation.mutate({ domain, scopes: scopes() })
}
]
)
} else {
appsMutation.mutate({ domain, scopes })
appsMutation.mutate({ domain, scopes: scopes() })
}
}
}, [domain])
}, [domain, instanceQuery.data?.version])
return (
<KeyboardAvoidingView