新增线下收款记录和 ai 修图优化
This commit is contained in:
@@ -273,12 +273,53 @@ final class LoginViewController: BaseViewController {
|
||||
|
||||
do {
|
||||
let resolution = try await viewModel.login(authAPI: authAPI)
|
||||
switch resolution {
|
||||
case let .completed(response, account):
|
||||
completeLogin(with: response, account: account)
|
||||
case .needsAccountSelection:
|
||||
break
|
||||
}
|
||||
handleLoginResolution(resolution)
|
||||
} catch is CancellationError {
|
||||
return
|
||||
} catch {
|
||||
showToast(error.localizedDescription)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func handleLoginResolution(_ resolution: LoginResolution) {
|
||||
switch resolution {
|
||||
case let .completed(response, account):
|
||||
completeLogin(with: response, account: account)
|
||||
case .needsAccountSelection:
|
||||
break
|
||||
case let .accountDeletionPending(response, request):
|
||||
presentAccountDeletionRecovery(response: response, request: request)
|
||||
}
|
||||
}
|
||||
|
||||
private func presentAccountDeletionRecovery(
|
||||
response: V9AuthResponse,
|
||||
request: AccountDeletionRequest
|
||||
) {
|
||||
let deletionTime = AccountDeletionDateFormatter.displayText(request.scheduledDeletionAt)
|
||||
let alert = UIAlertController(
|
||||
title: "账号正在注销中",
|
||||
message: "账号将在 \(deletionTime) 永久注销。继续登录将取消本次注销申请。",
|
||||
preferredStyle: .alert
|
||||
)
|
||||
alert.addAction(UIAlertAction(title: "暂不登录", style: .cancel))
|
||||
alert.addAction(UIAlertAction(title: "恢复账号并登录", style: .default) { [weak self] _ in
|
||||
self?.resumeLoginAfterCancelingDeletion(response: response)
|
||||
})
|
||||
present(alert, animated: true)
|
||||
}
|
||||
|
||||
private func resumeLoginAfterCancelingDeletion(response: V9AuthResponse) {
|
||||
Task {
|
||||
showLoading()
|
||||
defer { hideLoading() }
|
||||
do {
|
||||
let resolution = try await viewModel.resumeLoginAfterCancelingDeletion(
|
||||
verifiedResponse: response,
|
||||
authAPI: authAPI
|
||||
)
|
||||
handleLoginResolution(resolution)
|
||||
} catch is CancellationError {
|
||||
return
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user