diff --git a/Mlem/Views/Shared/Accounts/Accounts Page.swift b/Mlem/Views/Shared/Accounts/Accounts Page.swift index 68686bf92..9d39a3ba3 100644 --- a/Mlem/Views/Shared/Accounts/Accounts Page.swift +++ b/Mlem/Views/Shared/Accounts/Accounts Page.swift @@ -33,15 +33,14 @@ struct AccountsPage: View { Section(header: Text(instance)) { ForEach(accountsTracker.accountsByInstance[instance] ?? []) { account in Button(account.nickname) { - dismiss() setFlow(using: account) + dismiss() } .disabled(isActiveAccount(account)) .swipeActions { Button("Remove", role: .destructive) { - dismiss() accountsTracker.removeAccount(account: account) - if account == appState.currentActiveAccount { + if isActiveAccount(account) { // if we just deleted the current account we (currently!) have a decision to make if let first = accountsTracker.savedAccounts.first { // if we have another account available, go to that... @@ -55,6 +54,8 @@ struct AccountsPage: View { // no accounts, so go to onboarding setFlow(using: nil) } + + dismiss() } } } @@ -100,14 +101,11 @@ struct AccountsPage: View { } private func setFlow(using account: SavedAccount?) { - // this tiny delay prevents the modal dismiss animation from being cancelled - DispatchQueue.main.asyncAfter(deadline: .now() + 0.03) { - if let account { - setFlow(.account(account)) - return - } - - setFlow(.onboarding) + if let account { + setFlow(.account(account)) + return } + + setFlow(.onboarding) } } diff --git a/Mlem/Views/Shared/Accounts/Add Account View.swift b/Mlem/Views/Shared/Accounts/Add Account View.swift index db51ccc79..419f861f0 100644 --- a/Mlem/Views/Shared/Accounts/Add Account View.swift +++ b/Mlem/Views/Shared/Accounts/Add Account View.swift @@ -112,6 +112,7 @@ struct AddSavedInstanceView: View { } } .navigationTitle(Text(onboarding ? "Log in" : "")) + .navigationBarTitleDisplayMode(.inline) } var isReadyToSubmit: Bool { @@ -331,13 +332,11 @@ struct AddSavedInstanceView: View { AppConstants.keychain["\(newAccount.id)_accessToken"] = response.jwt accountsTracker.addAccount(account: newAccount) + setFlow(.account(newAccount)) + if !onboarding { dismiss() } - - DispatchQueue.main.asyncAfter(deadline: .now() + 0.01) { - setFlow(.account(newAccount)) - } } catch { handle(error) } diff --git a/Mlem/Views/Shared/Accounts/Instance Picker View.swift b/Mlem/Views/Shared/Accounts/Instance Picker View.swift index 4aaec8a32..8e25896d0 100644 --- a/Mlem/Views/Shared/Accounts/Instance Picker View.swift +++ b/Mlem/Views/Shared/Accounts/Instance Picker View.swift @@ -30,10 +30,6 @@ struct InstancePickerView: View { var body: some View { ScrollView { LazyVStack(spacing: 0) { - // Text("Instances") - // .bold() - // .padding() - if onboarding { Text(pickInstance) .frame(maxWidth: .infinity)