//
//  ActionDismissNotificationHandler.swift
//  MVMCoreUI
//
//  Created by Scott Pfeil on 7/28/22.
//  Copyright © 2022 Verizon Wireless. All rights reserved.
//

import Foundation
import MVMCore

/// Collapse the current top notification.
open class ActionDismissNotificationHandler: MVMCoreActionHandlerProtocol {
    required public init() {}
    
    open func execute(with model: ActionModelProtocol, delegateObject: DelegateObject?, additionalData: [AnyHashable : Any]?) async throws {
        await withCheckedContinuation { continuation in
            CoreUIObject.sharedInstance()?.globalTopAlertDelegate?.getTopAlertView?().hideAlertView?(true, completionHandler: { finished in
                continuation.resume()
            }) ?? continuation.resume()
        }
    }
}
