MoviaBox/Thimra/Class/Mine/Controller/SPAboutUsViewController.swift
2025-04-24 11:14:21 +08:00

114 lines
3.6 KiB
Swift

//
// SPAboutUsViewController.swift
// Thimra
//
// Created by Overseas on 2025/4/19.
//
import UIKit
class SPAboutUsViewController: SPViewController {
private lazy var dataArr: [SPMineItem] = {
let arr = [
SPMineItem(type: .userAgreement, title: "User Agreement".localized),
SPMineItem(type: .privacyPolicy, title: "Privacy Policy".localized),
SPMineItem(type: .informationProtection, title: "Child Personal Information Protection Rules".localized),
SPMineItem(type: .civizatioConvention, title: "Youth Civilization Convention".localized),
SPMineItem(type: .informationSharing, title: "List of Third-Party Sharing of Personal Information".localized),
SPMineItem(type: .persoInforDisclosure, title: "Explicit List of Personal Information Collection".localized),
]
return arr
}()
private lazy var tableView: SPTableView = {
let tableView = SPTableView(frame: .zero, style: .plain)
tableView.delegate = self
tableView.dataSource = self
tableView.rowHeight = 50
SPAboutUsCell.registerCell(tableView: tableView)
return tableView
}()
private lazy var headerView: SPAboutUsHeaderView = {
let view = SPAboutUsHeaderView(frame: .init(x: 0, y: 0, width: kSPScreenWidth, height: 200))
return view
}()
override func viewDidLoad() {
super.viewDidLoad()
self.title = "About Us".localized
_setupUI()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.navigationController?.setNavigationBarHidden(false, animated: true)
setNavigationNormalStyle()
}
override func setBgImageView() {
self.view.backgroundColor = .backgroundColor()
}
}
extension SPAboutUsViewController {
private func _setupUI() {
self.tableView.tableHeaderView = self.headerView
view.addSubview(tableView)
tableView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
}
}
//MARK: -------------- UITableViewDelegate & UITableViewDataSource --------------
extension SPAboutUsViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = SPAboutUsCell.dequeueReusableCell(tableView: tableView, indexPath: indexPath)
cell.item = dataArr[indexPath.row]
return cell
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return dataArr.count
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let item = dataArr[indexPath.row]
var urlStr: String?
switch item.type {
case .userAgreement:
urlStr = SPUserAgreementWebUrl
case.privacyPolicy:
urlStr = SPPrivacyPolicyWebUrl
case.informationProtection:
urlStr = SPInformationProtectionWebUrl
case.civizatioConvention:
urlStr = SPCivizatioConventionWebUrl
case.informationSharing:
urlStr = SPInformationSharingWebUrl
case.persoInforDisclosure:
urlStr = SPPersoInforDisclosureWebUrl
default: break
}
let vc = SPWebViewController()
vc.urlStr = urlStr
self.navigationController?.pushViewController(vc, animated: true)
}
}