//
//  AppDelegate.swift
//  PrivateBrowser
//
//  Created by MAC on 2022/6/9.
//

import UIKit
import AppTrackingTransparency

@main
class AppDelegate: UIResponder, UIApplicationDelegate {
    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        self.initAppearance()
        
        
        let root = UIStoryboard.main().initController(id: "LLQ_RootViewController") as! LLQ_RootViewController
        let nav = LLQ_BaseNavigationController.init(rootViewController: root)

        window = UIWindow.init(frame: UIScreen.main.bounds)
        window?.rootViewController = nav
        window?.makeKeyAndVisible()
        
        return true
    }

    
    // MARK: - UIAppearance
    private func initAppearance() {
        if #available(iOS 15.0, *) {

            
        } else {
            // navigationBar text、item default color
            UINavigationBar.appearance().tintColor = UIColor.init(hexString: "#333333")

            // clear black line
            UINavigationBar.appearance().shadowImage = UIImage()

            // set background color
            UINavigationBar.appearance().barTintColor = UIColor.white
            
            UINavigationBar.appearance().setBackgroundImage(UIImage.init(color: UIColor.init(hexString: "#ffffff")!), for: .default)

            // set title color
            UINavigationBar.appearance().titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.init(hexString: "#333333")!]
        }

    }
    
//    func applicationDidBecomeActive(_ application: UIApplication) {
//        self.requestIDFA()
//    }
//    
//    private func requestIDFA(){
//        if #available(iOS 14, *) {
//            ATTrackingManager.requestTrackingAuthorization { status in
//                
//            }
//        } else {
//            
//        }
//    }
}

