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
extension UIViewController {
var isVisible: Bool { isViewLoaded && view.window != nil && presentedViewController == nil }
var isVisible: Bool { isViewLoaded && view.window != nil }
func present(alertItem: AlertItem) {
let alertController = UIAlertController(

View File

@ -423,7 +423,7 @@ private extension TableViewController {
viewModel.alertItems
.compactMap { $0 }
.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)
}