58 lines
1.6 KiB
Swift
58 lines
1.6 KiB
Swift
//
|
|
// PrivacyPolicyVC.swift
|
|
// QuickLocation
|
|
//
|
|
// Created by 八条 on 2026/6/11.
|
|
//
|
|
|
|
import UIKit
|
|
import RxSwift
|
|
import RxCocoa
|
|
import RxDataSources
|
|
|
|
struct PrivacyPolicyItem {
|
|
let name: String
|
|
let url: String
|
|
}
|
|
|
|
class PrivacyPolicyVC: BaseViewController {
|
|
|
|
fileprivate var rootView: PrivacyPolicyView!
|
|
|
|
override func loadView() {
|
|
rootView = PrivacyPolicyView(frame: UIScreen.main.bounds)
|
|
view = rootView
|
|
}
|
|
|
|
private let list: [PrivacyPolicyItem] = [
|
|
PrivacyPolicyItem(name: "用户协议", url: URLManager.shared.userAgreementUrl),
|
|
PrivacyPolicyItem(name: "隐私政策", url: URLManager.shared.privacyPolicyUrl),
|
|
PrivacyPolicyItem(name: "儿童隐私政策", url: URLManager.shared.kidsPrivacyUrl)
|
|
]
|
|
|
|
override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
|
|
bindList()
|
|
rootView.tableView.layoutChain.height(CGFloat(list.count * 52))
|
|
}
|
|
|
|
private func bindList() {
|
|
// 绑定数据到 tableView
|
|
Observable.just(list)
|
|
.bind(to: rootView.tableView.rx.items) { tableView, index, item in
|
|
let cell: PrivacyPolicyCell = tableView.dequeueReusableCell(for: IndexPath(row: index, section: 0))
|
|
cell.configure(item)
|
|
return cell
|
|
}
|
|
.disposed(by: disposeBag)
|
|
|
|
// 点击跳转
|
|
rootView.tableView.rx.modelSelected(PrivacyPolicyItem.self)
|
|
.subscribe(onNext: { item in
|
|
AppRouter.push(Route.web, userInfo: ["url": item.url])
|
|
})
|
|
.disposed(by: disposeBag)
|
|
}
|
|
}
|