From dd549593af63b998bafbf259117af1d75db65db2 Mon Sep 17 00:00:00 2001 From: Scott Pfeil Date: Fri, 30 Jun 2023 13:07:21 -0400 Subject: [PATCH] CXTDT-431466: Fix for notification handler update. --- .../Notification/NotificationContainerView.swift | 13 +------------ MVMCoreUI/Notification/NotificationHandler.swift | 5 +++-- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/MVMCoreUI/Notification/NotificationContainerView.swift b/MVMCoreUI/Notification/NotificationContainerView.swift index f55fd5a2..62d05a9d 100644 --- a/MVMCoreUI/Notification/NotificationContainerView.swift +++ b/MVMCoreUI/Notification/NotificationContainerView.swift @@ -12,7 +12,6 @@ import MVMCore /// A simple container view that shows and hides a notification. public class NotificationContainerView: UIView { - public var currentModel: NotificationModel? public var currentNotificationView: UIView? lazy private var height = heightAnchor.constraint(equalToConstant: 0) @@ -82,17 +81,7 @@ extension NotificationContainerView: NotificationTransitionDelegateProtocol { @MainActor public func update(with model: NotificationModel, delegateObject: MVMCoreUIDelegateObject?) { - guard let currentModel = currentModel, - currentModel.type == model.type else { return } - guard let molecule = currentNotificationView as? MoleculeViewProtocol, - currentModel.molecule.moleculeName == model.molecule.moleculeName else { - // Log that we couldn't update. - if let errorObject = MVMCoreErrorObject(title: nil, message: nil, messageToLog: nil, code: ErrorCode.parsingJSON.rawValue, domain: ErrorDomainNative, location: "TopNotification update \(String(describing: model.type))") { - MVMCoreUILoggingHandler.addError(toLog: errorObject) - } - return - } - + guard let molecule = currentNotificationView as? MoleculeViewProtocol else { return } // Update molecule molecule.reset() molecule.set(with: model.molecule, delegateObject, nil) diff --git a/MVMCoreUI/Notification/NotificationHandler.swift b/MVMCoreUI/Notification/NotificationHandler.swift index 8a84227e..ff9d90ad 100644 --- a/MVMCoreUI/Notification/NotificationHandler.swift +++ b/MVMCoreUI/Notification/NotificationHandler.swift @@ -563,8 +563,9 @@ extension NotificationOperation { !isCancelled else { return } self.log(message: "Operation Updated") updateStopTimer() - Task { @MainActor in - transitionDelegate.update(with: notificationModel, delegateObject: delegateObject) + Task { + await transitionDelegate.update(with: notificationModel, delegateObject: delegateObject) + NotificationHandler.shared()?.onNotificationUpdated.send((notification, notificationModel)) } }