//
//  DDProgressHUD.swift
//  DDProgressHUDKit_Private
//
//  Created by 中道 on 2023/8/7.
//

import Foundation
//import DDCategoryKit_Private
//import YYImage
//import SnapKit

extension UIView {
    public func dd_showHUD() {
        let viewHud = MBProgressHUD.forView(self)

        if viewHud == nil {
            let hud = MBProgressHUD.showAdded(to: self, animated: true)
            hud.bezelView.color = UIColor.white
            hud.bezelView.style = .solidColor
            hud.contentColor = UIColor.black
            hud.show(animated: true)
        }
    
//        if viewHud == nil {
//            let hud = MBProgressHUD.showAdded(to: self, animated: true)
//            hud.mode = MBProgressHUDMode.customView
//            hud.customView = HudCustomView.init()
//            hud.minSize = CGSize(width: 60, height: 60)
//            hud.show(animated: true)
//        }
    }
    
    public func dd_hideHUD() {
        let hud = MBProgressHUD.forView(self)
        hud?.hide(animated: true)
    }
}

//class HudCustomView : UIView {
//    override init(frame: CGRect) {
//        super.init(frame: frame)
//        let data = UIImage.dd_imageGifNamed("networking_loading", bundleName: "ProgressHud", aClass: HudCustomView.self)
//        let animatedImageView = YYAnimatedImageView.init(image: YYImage.init(data: data ?? Data.init(),scale: 1))
//        addSubview(animatedImageView)
//        animatedImageView.snp.makeConstraints { make in
//            make.width.height.equalTo(60)
//            make.center.equalToSuperview()
//        }
//    }
//
//    required init?(coder: NSCoder) {
//        fatalError("init(coder:) has not been implemented")
//    }
//
//}
