// // ViewController.swift // QuickSearchLocation // // Created by mac on 2024/4/10. // import UIKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() let isNotAgreePrivacyKey = UserDefaults.standard.bool(forKey: "isNotAgreePrivacyKey") // 是否同意隐私政策 if !isNotAgreePrivacyKey { QSLPrivacyAlertView.alert(view: view) { self.intoMain() UserDefaults.standard.set(true, forKey: "isNotAgreePrivacyKey") } serviceCloure: { self.agreementAction() } privacyClosure: { self.privacyAction() } } else { intoMain() } } func intoMain() { QSLBaseManager.shared.initConfig() // 是否通过引导页 let isShowGuideKey = UserDefaults.standard.bool(forKey: "isShowGuideKey") if !isShowGuideKey { // 引导页 UserDefaults.standard.set(true, forKey: "isShowGuideKey") if let sceneDelegate = UIApplication.shared.connectedScenes.first?.delegate as? SceneDelegate { sceneDelegate.window?.rootViewController = QSLGuideController() sceneDelegate.window?.makeKeyAndVisible() } } else { // 主页 if let sceneDelegate = UIApplication.shared.connectedScenes.first?.delegate as? SceneDelegate { sceneDelegate.window?.rootViewController = CustomTabBarController() sceneDelegate.window?.makeKeyAndVisible() } } } // 用户协议跳转 func agreementAction() { let vc = QSLWebViewController() vc.webUrl = QSLConfig.AppServiceAgreementLink vc.title = "用户协议" vc.isShowTop = true self.present(vc, animated: true) } // 隐私协议跳转 func privacyAction() { let vc = QSLWebViewController() vc.webUrl = QSLConfig.AppPrivacyAgreementLink vc.title = "隐私政策" vc.isShowTop = true self.present(vc, animated: true) } }