updates for polling

This commit is contained in:
Pfeil, Scott Robert 2020-10-15 10:37:36 -04:00
parent c44ce8e068
commit 7612b33225

View File

@ -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
}
}