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

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

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

}

