Change visibility logic

This commit is contained in:
Justin Mazzocchi 2021-03-08 20:40:22 -08:00
parent d6b4a7eabd
commit c10934f32b
No known key found for this signature in database
GPG key ID: E223E6937AAFB01C
2 changed files with 2 additions and 2 deletions

View file

@ -5,7 +5,7 @@ import UIKit
import ViewModels import ViewModels
extension UIViewController { extension UIViewController {
var isVisible: Bool { isViewLoaded && view.window != nil && presentedViewController == nil } var isVisible: Bool { isViewLoaded && view.window != nil }
func present(alertItem: AlertItem) { func present(alertItem: AlertItem) {
let alertController = UIAlertController( let alertController = UIAlertController(

View file

@ -423,7 +423,7 @@ private extension TableViewController {
viewModel.alertItems viewModel.alertItems
.compactMap { $0 } .compactMap { $0 }
.sink { [weak self] in .sink { [weak self] in
guard let self = self, self.isVisible else { return } guard let self = self, self.isVisible, self.presentedViewController == nil else { return }
self.present(alertItem: $0) self.present(alertItem: $0)
} }