QSLAppInfoController.swift 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. //
  2. // QSLAppInfoController.swift
  3. // QuickSearchLocation
  4. //
  5. // Created by Destiny on 2024/12/9.
  6. //
  7. import UIKit
  8. import YYText
  9. class QSLAppInfoController: QSLBaseController {
  10. // let photoClassifier = PhotoClassifier()
  11. lazy var appIcon: UIImageView = {
  12. let imageView = UIImageView()
  13. imageView.image = UIImage(named: "mine_about_logo")
  14. return imageView
  15. }()
  16. lazy var appTitle: UILabel = {
  17. let label = UILabel()
  18. label.text("手机关爱定位")
  19. label.font(15)
  20. label.textColor = QSLColor.Color_202020
  21. return label
  22. }()
  23. lazy var versionLabel: UILabel = {
  24. let label = UILabel()
  25. label.text("当前版本:\(QSLApi.appVersionName)")
  26. label.font(13)
  27. label.textColor = .hexStringColor(hexString: "#A7A7A7")
  28. return label
  29. }()
  30. lazy var serviceLabel: YYLabel = {
  31. let label = YYLabel()
  32. let attr = NSMutableAttributedString()
  33. let blankAttr = NSMutableAttributedString(string: " ")
  34. blankAttr.font(12)
  35. let privacyHL = YYTextHighlight()
  36. var privacyStr = "《隐私权政策》"
  37. let privacyText = NSMutableAttributedString(string: privacyStr)
  38. privacyText.font(12)
  39. privacyText.color(.hexStringColor(hexString: "#2F79FF"))
  40. privacyText.yy_setTextHighlight(privacyHL, range: NSRange(location: 0, length: privacyStr.count))
  41. privacyHL.tapAction = { [weak self] containerView, text, range, rect in
  42. self?.privacyAction()
  43. }
  44. attr.append(privacyText)
  45. attr.append(blankAttr)
  46. let andAttr = NSMutableAttributedString(string: "和")
  47. andAttr.font(12)
  48. andAttr.color(.hexStringColor(hexString: "#A7A7A7"))
  49. attr.append(andAttr)
  50. attr.append(blankAttr)
  51. let serviceHL = YYTextHighlight()
  52. var serviceStr = "《用户协议》"
  53. let serviceText = NSMutableAttributedString(string: serviceStr)
  54. serviceText.font(12)
  55. serviceText.color(.hexStringColor(hexString: "#2F79FF"))
  56. serviceText.yy_setTextHighlight(serviceHL, range: NSRange(location: 0, length: serviceStr.count))
  57. serviceHL.tapAction = { [weak self] containerView, text, range, rect in
  58. self?.serviceAction()
  59. }
  60. attr.append(serviceText)
  61. label.attributedText = attr
  62. return label
  63. }()
  64. override func viewDidLoad() {
  65. super.viewDidLoad()
  66. initView()
  67. // let loadingVC = LoadingViewController()
  68. // present(loadingVC, animated: true)
  69. // photoClassifier.classifyPhotos { result in
  70. // // 处理截图
  71. // print("找到 \(result.screenshots.count) 张截图")
  72. //
  73. // // 处理地点分组
  74. // for (location, assets) in result.locations {
  75. // print("\(location): \(assets.count) 张照片")
  76. // }
  77. //
  78. // // 处理人物分组
  79. // for (person, assets) in result.people {
  80. // print("\(person): \(assets.count) 张照片")
  81. // }
  82. // }
  83. }
  84. override func viewWillAppear(_ animated:Bool) {
  85. // super.viewWillAppear(animated)
  86. self.navigationController?.setNavigationBarHidden(false, animated: animated)
  87. }
  88. @objc func privacyAction() {
  89. let vc = QSLWebViewController()
  90. vc.webUrl = QSLConfig.AppPrivacyAgreementLink
  91. vc.title = "隐私政策"
  92. self.navigationController?.pushViewController(vc, animated: true)
  93. }
  94. @objc func serviceAction() {
  95. let vc = QSLWebViewController()
  96. vc.webUrl = QSLConfig.AppServiceAgreementLink
  97. vc.title = "服务协议"
  98. self.navigationController?.pushViewController(vc, animated: true)
  99. }
  100. }
  101. extension QSLAppInfoController {
  102. func initView() {
  103. self.view.backgroundColor = .white
  104. self.view.addSubview(appIcon)
  105. appIcon.snp.makeConstraints { make in
  106. make.size.equalTo(CGSize(width: 72.rpx, height: 72.rpx))
  107. make.centerX.equalToSuperview()
  108. make.top.equalTo(73.rpx)
  109. }
  110. self.view.addSubview(appTitle)
  111. appTitle.snp.makeConstraints { make in
  112. make.centerX.equalToSuperview()
  113. make.top.equalTo(appIcon.snp.bottom).offset(12.rpx)
  114. }
  115. self.view.addSubview(versionLabel)
  116. versionLabel.snp.makeConstraints { make in
  117. make.centerX.equalToSuperview()
  118. make.top.equalTo(appTitle.snp.bottom).offset(2.rpx)
  119. }
  120. self.view.addSubview(serviceLabel)
  121. serviceLabel.snp.makeConstraints { make in
  122. make.bottom.equalTo(-30.rpx)
  123. make.centerX.equalToSuperview()
  124. }
  125. }
  126. }