CXTDT-431466: Fix for notification handler update.

This commit is contained in:
Scott Pfeil 2023-06-30 13:07:21 -04:00
parent 198a45c1c4
commit dd549593af
2 changed files with 4 additions and 14 deletions

View File

@ -12,7 +12,6 @@ import MVMCore
/// A simple container view that shows and hides a notification. /// A simple container view that shows and hides a notification.
public class NotificationContainerView: UIView { public class NotificationContainerView: UIView {
public var currentModel: NotificationModel?
public var currentNotificationView: UIView? public var currentNotificationView: UIView?
lazy private var height = heightAnchor.constraint(equalToConstant: 0) lazy private var height = heightAnchor.constraint(equalToConstant: 0)
@ -82,17 +81,7 @@ extension NotificationContainerView: NotificationTransitionDelegateProtocol {
@MainActor @MainActor
public func update(with model: NotificationModel, delegateObject: MVMCoreUIDelegateObject?) { public func update(with model: NotificationModel, delegateObject: MVMCoreUIDelegateObject?) {
guard let currentModel = currentModel, guard let molecule = currentNotificationView as? MoleculeViewProtocol else { return }
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
}
// Update molecule // Update molecule
molecule.reset() molecule.reset()
molecule.set(with: model.molecule, delegateObject, nil) molecule.set(with: model.molecule, delegateObject, nil)

View File

@ -563,8 +563,9 @@ extension NotificationOperation {
!isCancelled else { return } !isCancelled else { return }
self.log(message: "Operation Updated") self.log(message: "Operation Updated")
updateStopTimer() updateStopTimer()
Task { @MainActor in Task {
transitionDelegate.update(with: notificationModel, delegateObject: delegateObject) await transitionDelegate.update(with: notificationModel, delegateObject: delegateObject)
NotificationHandler.shared()?.onNotificationUpdated.send((notification, notificationModel))
} }
} }