//
//  AppDelegate.swift
//  WallpaperHD_Live
//
//  Created by 忆海16 on 2024/7/22.
//

import UIKit
import IQKeyboardManagerSwift
@main
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?
    let hasLaunchedBeforeKey = "hasLaunchedBefore"
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        IQKeyboardManager.shared.enable = true
        window = UIWindow(frame: UIScreen.main.bounds)
//        WP_TabbarCommon.TabBarController()
        // 强制设置浅色模式
        if #available(iOS 13.0, *) {
            window?.overrideUserInterfaceStyle = .light
            
        }
       
        
        let userDefaults = UserDefaults.standard
        if userDefaults.bool(forKey: hasLaunchedBeforeKey){
            if userDefaults.bool(forKey: "islock"){
                let vc = WP_LockVC()
                self.window?.rootViewController = WP_RootNAV(rootViewController: vc)
            }else{
                WP_TabbarCommon.TabBarController()
            }
            
            
        }else{
            // 第一次启动
            userDefaults.set(true, forKey: hasLaunchedBeforeKey)
            userDefaults.set(false, forKey: "islock")
            WP_TabbarCommon.TabBarController()
        }
        self.window?.makeKeyAndVisible()
        return true
    }

}

