Allow cancel add account sheet even when no account

This commit is contained in:
Thomas Ricouard 2024-08-14 17:23:00 +02:00
parent a737ac19e5
commit 56869e3a2f

View file

@ -88,9 +88,7 @@ struct AddAccountView: View {
.scrollDismissesKeyboard(.immediately)
#endif
.toolbar {
if !appAccountsManager.availableAccounts.isEmpty {
CancelToolbarItem()
}
CancelToolbarItem()
}
.onAppear {
isInstanceURLFieldFocused = true
@ -290,6 +288,7 @@ struct AddAccountView: View {
let oauthToken = try await client.continueOauthFlow(url: url)
let client = Client(server: client.server, oauthToken: oauthToken)
let account: Account = try await client.get(endpoint: Accounts.verifyCredentials)
Telemetry.signal("account.added")
appAccountsManager.add(account: AppAccount(server: client.server,
accountName: "\(account.acct)@\(client.server)",
oauthToken: oauthToken))