//
//  LauchVC.swift
//  PhoneManager
//
//  Created by zxhy on 2025/3/19.
//

import UIKit
import Lottie

class LauchVC:UIViewController {
    
    @IBOutlet weak var backView: UIView!
    
//    private lazy var LaunchingView:LottieAnimationView = {
//        let animationView = LottieAnimationView(name: "AppLauncher")
//        animationView.loopMode = .playOnce
//        animationView.play()
//        return animationView
//    }()
    
    private lazy var LaunchingLoop: LottieAnimationView = {
        let animationView = LottieAnimationView(name: "launch_loaing")
        animationView.loopMode = .loop
        animationView.play()
        return animationView
    }()
    
    override func viewDidLoad() {
        
        super.viewDidLoad()
        view.addSubview(LaunchingLoop)

        LaunchingLoop.snp.makeConstraints { make in
            make.centerX.equalToSuperview()
            make.width.height.equalTo(150)
            make.bottom.equalToSuperview().offset(-60 * RScreenH())
        }
        DispatchQueue.main.asyncAfter(deadline: .now() + 3, execute: {
            self.dismiss(animated: false)
//            var vc:UIViewController?
//            if (UserDef.shard.isShowLanding) {
//                vc = HomeViewController()
//            }else {
//                let Ssoryboard = UIStoryboard(name: "PermissionVC", bundle: nil)
//                if  let current = Ssoryboard.instantiateViewController(identifier: "PermissionVCID") as? PermissionVC {
//                    vc = current
//                }
//            }
//            guard let vc else {return}
//            let nav = BaseNavViewController(rootViewController: vc)
//            cWindow?.rootViewController = nav
//            let transition = CATransition()
//            transition.duration = 0.5
//            transition.subtype = CATransitionSubtype.fromRight // 从左侧推入
//            transition.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
//            cWindow?.layer.add(transition, forKey: kCATransition)
//            cWindow?.makeKeyAndVisible()
        })
    }
}
