ViewController.swift 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. //
  2. // ViewController.swift
  3. // QuickSearchLocation
  4. //
  5. // Created by mac on 2024/4/10.
  6. //
  7. import UIKit
  8. class ViewController: UIViewController {
  9. override func viewDidLoad() {
  10. super.viewDidLoad()
  11. let isNotAgreePrivacyKey = UserDefaults.standard.bool(forKey: "isNotAgreePrivacyKey")
  12. // 是否同意隐私政策
  13. if !isNotAgreePrivacyKey {
  14. QSLPrivacyAlertView.alert(view: view) {
  15. self.intoMain()
  16. UserDefaults.standard.set(true, forKey: "isNotAgreePrivacyKey")
  17. } serviceCloure: {
  18. self.agreementAction()
  19. } privacyClosure: {
  20. self.privacyAction()
  21. }
  22. } else {
  23. intoMain()
  24. }
  25. }
  26. func intoMain() {
  27. QSLBaseManager.shared.initConfig()
  28. // 是否通过引导页
  29. let isShowGuideKey = UserDefaults.standard.bool(forKey: "isShowGuideKey")
  30. if !isShowGuideKey {
  31. // 引导页
  32. UserDefaults.standard.set(true, forKey: "isShowGuideKey")
  33. if let sceneDelegate = UIApplication.shared.connectedScenes.first?.delegate as? SceneDelegate {
  34. sceneDelegate.window?.rootViewController = QSLGuideController()
  35. sceneDelegate.window?.makeKeyAndVisible()
  36. }
  37. } else {
  38. // 主页
  39. if let sceneDelegate = UIApplication.shared.connectedScenes.first?.delegate as? SceneDelegate {
  40. sceneDelegate.window?.rootViewController = CustomTabBarController()
  41. sceneDelegate.window?.makeKeyAndVisible()
  42. }
  43. }
  44. }
  45. // 用户协议跳转
  46. func agreementAction() {
  47. let vc = QSLWebViewController()
  48. vc.webUrl = QSLConfig.AppServiceAgreementLink
  49. vc.title = "用户协议"
  50. vc.isShowTop = true
  51. self.present(vc, animated: true)
  52. }
  53. // 隐私协议跳转
  54. func privacyAction() {
  55. let vc = QSLWebViewController()
  56. vc.webUrl = QSLConfig.AppPrivacyAgreementLink
  57. vc.title = "隐私政策"
  58. vc.isShowTop = true
  59. self.present(vc, animated: true)
  60. }
  61. }