bugfixes for delegate, logging, and legacy

This commit is contained in:
Scott Pfeil 2023-04-18 18:21:57 -04:00
parent ba14681a39
commit e61b9ed8f1

View File

@ -25,7 +25,6 @@ public class AlertOperation: MVMCoreOperation {
} }
private var properties = Properties() private var properties = Properties()
//private var observer: NSKeyValueObservation?
private var cancellable: Cancellable? private var cancellable: Cancellable?
public let alertController: AlertController public let alertController: AlertController
@ -89,8 +88,10 @@ public class AlertOperation: MVMCoreOperation {
stopObservingAlertView() stopObservingAlertView()
cancellable = alertController.publisher(for: \AlertController.visible).sink() { [weak self] visible in cancellable = alertController.publisher(for: \AlertController.visible).sink() { [weak self] visible in
guard let self = self else { return } guard let self = self else { return }
Task { @MainActor in Task {
guard await self.properties.getIsDisplayed() != visible else { return }
await self.properties.set(displayed: visible) await self.properties.set(displayed: visible)
Task { @MainActor in
if visible { if visible {
self.alertObject.alertDelegate?.alertShown(self.alertController) self.alertObject.alertDelegate?.alertShown(self.alertController)
} else { } else {
@ -102,13 +103,10 @@ public class AlertOperation: MVMCoreOperation {
} }
} }
} }
// observer = alertController.observe(\AlertController.visible, options: [.old, .new]) { [weak self] (object, change) in }
//
// }
} }
private func stopObservingAlertView() { private func stopObservingAlertView() {
//observer?.invalidate()
cancellable?.cancel() cancellable?.cancel()
} }
} }