diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler+Extension.swift b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler+Extension.swift index ff79aa7..c0d2cd8 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler+Extension.swift +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler+Extension.swift @@ -63,4 +63,28 @@ public extension MVMCoreAlertHandler { } } } + + /// Checks for existing same top alert objects and update it. + func checkAndUpdateExisting(with topAlertObject: MVMCoreTopAlertObject) -> Bool { + for case let operation as MVMCoreTopAlertOperation in topAlertQueue.operations { + guard topAlertObject.json != nil, + operation.topAlertObject.type == topAlertObject.type else { continue } + guard !operation.isCancelled else { + // old is already cancelled, add new + operation.reAddAfterCancel = false + return false + } + guard operation.isExecuting else { + // not currently executing... cancel old, add new + operation.cancel() + return false + } + // update existing and view + // how to update dismiss time? + // how to update view? what if molecule is different? + + + } + return false + } }