fix: use v9 store status for deregistration login
This commit is contained in:
@@ -290,6 +290,8 @@ final class LoginViewController: BaseViewController {
|
||||
completeLogin(with: response, account: account)
|
||||
case .needsAccountSelection:
|
||||
break
|
||||
case let .needsDeregistrationConfirmation(confirmation):
|
||||
presentDeregistrationLoginConfirmation(confirmation)
|
||||
}
|
||||
} catch is CancellationError {
|
||||
return
|
||||
@@ -335,6 +337,31 @@ final class LoginViewController: BaseViewController {
|
||||
}
|
||||
}
|
||||
|
||||
private func presentDeregistrationLoginConfirmation(_ confirmation: DeregistrationLoginConfirmation) {
|
||||
let alert = makeDeregistrationLoginAlert(
|
||||
account: confirmation.account,
|
||||
onConfirm: { [weak self] in
|
||||
self?.confirmDeregistrationLogin(confirmation)
|
||||
}
|
||||
)
|
||||
present(alert, animated: true)
|
||||
}
|
||||
|
||||
private func confirmDeregistrationLogin(_ confirmation: DeregistrationLoginConfirmation) {
|
||||
Task {
|
||||
showLoading()
|
||||
defer { hideLoading() }
|
||||
do {
|
||||
let response = try await viewModel.confirmDeregistrationLogin(confirmation, authAPI: authAPI)
|
||||
completeLogin(with: response, account: confirmation.account)
|
||||
} catch is CancellationError {
|
||||
return
|
||||
} catch {
|
||||
showToast(error.localizedDescription)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func completeLogin(with response: V9AuthResponse, account: AccountSwitchAccount) {
|
||||
AuthSessionHelper.completeLogin(
|
||||
with: response,
|
||||
|
||||
Reference in New Issue
Block a user