//
//  MaintaiTipsAlertView.swift
//  PhoneManager
//
//  Created by edy on 2025/5/13.
//

import UIKit

class MaintaiTipsAlertView: UIView {
    
    var confirmBlock:(() ->Void)?
    
    var cancelBlock:(() ->Void)?

    override func awakeFromNib() {
        super.awakeFromNib()
        frame = CGRectMake(0, ScreenH, ScreenW, ScreenH)
    }

    @IBAction func confirmClick(_ sender: Any) {
        confirmBlock?()
    }
    
    @IBAction func cancelClick(_ sender: Any) {
        disMiss()
    }
    
    func disMiss(){
        cancelBlock?()
        UIView.animate(withDuration: AniDuration) {
            self.frame = CGRectMake(0, ScreenH, ScreenW, ScreenH)
        } completion: { su in
            if su {
                self.removeFromSuperview()
            }
        }
    }
    
    func show(){
        KEYWINDOW()?.addSubview(self)
        UIView.animate(withDuration: AniDuration) {
            self.frame = CGRectMake(0, 0, ScreenW, ScreenH)
        }
    }
}
