From 2288efc11366d5ce5f616568210e270009303628 Mon Sep 17 00:00:00 2001 From: CMK Date: Tue, 26 Apr 2022 16:48:06 +0800 Subject: [PATCH] fix: sign up error alert missing issue --- .../MastodonRegisterViewController.swift | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController.swift b/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController.swift index 26060c2c..903c9fbc 100644 --- a/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController.swift +++ b/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController.swift @@ -208,22 +208,22 @@ extension MastodonRegisterViewController { // self.reasonErrorPromptLabel.attributedText = prompt // } // .store(in: &disposeBag) -// viewModel.error -// .receive(on: DispatchQueue.main) -// .sink { [weak self] error in -// guard let self = self else { return } -// guard let error = error as? Mastodon.API.Error else { return } -// let alertController = UIAlertController(for: error, title: "Sign Up Failure", preferredStyle: .alert) -// let okAction = UIAlertAction(title: L10n.Common.Controls.Actions.ok, style: .default, handler: nil) -// alertController.addAction(okAction) -// self.coordinator.present( -// scene: .alertController(alertController: alertController), -// from: nil, -// transition: .alertController(animated: true, completion: nil) -// ) -// } -// .store(in: &disposeBag) -// + + viewModel.$error + .receive(on: DispatchQueue.main) + .sink { [weak self] error in + guard let self = self else { return } + guard let error = error as? Mastodon.API.Error else { return } + let alertController = UIAlertController(for: error, title: "Sign Up Failure", preferredStyle: .alert) + let okAction = UIAlertAction(title: L10n.Common.Controls.Actions.ok, style: .default, handler: nil) + alertController.addAction(okAction) + self.coordinator.present( + scene: .alertController(alertController: alertController), + from: nil, + transition: .alertController(animated: true, completion: nil) + ) + } + .store(in: &disposeBag) viewModel.avatarMediaMenuActionPublisher .receive(on: DispatchQueue.main)