Add scenic selection and cooperation order flows aligned with Android.

Upgrade scenic picker with search, location sorting, permission apply/status, and blocking home dialog; add cooperation order module and order source picker improvements with unit tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-07 10:48:43 +08:00
parent 3c4ca7eefb
commit 2bea05b1d9
50 changed files with 5603 additions and 191 deletions

View File

@ -0,0 +1,95 @@
//
// OrderSourcePersonCell.swift
// suixinkan
//
import SnapKit
import UIKit
/// cell Android `SourcePersonItem`
final class OrderSourcePersonCell: UITableViewCell {
static let reuseIdentifier = "OrderSourcePersonCell"
var onCallPhone: ((String) -> Void)?
private let cardView = UIView()
private let nameLabel = UILabel()
private let phoneLabel = UILabel()
private let callButton = UIButton(type: .system)
private let chevronView = UIImageView()
private var personPhone = ""
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
selectionStyle = .none
backgroundColor = .clear
contentView.backgroundColor = .clear
setupUI()
}
@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func configure(person: OrderSourcePerson, selected: Bool) {
nameLabel.text = person.name
phoneLabel.text = person.phone
personPhone = person.phone
cardView.layer.borderColor = (selected ? AppColor.primary : OrderTokens.sourceBorder).cgColor
cardView.backgroundColor = selected ? AppColor.primaryLight.withAlphaComponent(0.5) : .white
}
private func setupUI() {
cardView.layer.cornerRadius = AppRadius.sm
cardView.layer.borderWidth = 1
contentView.addSubview(cardView)
nameLabel.font = .systemFont(ofSize: 16, weight: .medium)
nameLabel.textColor = AppColor.text333
phoneLabel.font = .systemFont(ofSize: 14)
phoneLabel.textColor = AppColor.text666
callButton.backgroundColor = OrderTokens.phoneIconBackground
callButton.layer.cornerRadius = 16
callButton.tintColor = AppColor.primary
callButton.setImage(UIImage(systemName: "phone.fill"), for: .normal)
callButton.addTarget(self, action: #selector(callTapped), for: .touchUpInside)
chevronView.image = UIImage(systemName: "chevron.right")
chevronView.tintColor = AppColor.text666
chevronView.contentMode = .scaleAspectFit
cardView.addSubview(nameLabel)
cardView.addSubview(phoneLabel)
cardView.addSubview(callButton)
cardView.addSubview(chevronView)
cardView.snp.makeConstraints { make in
make.edges.equalToSuperview().inset(UIEdgeInsets(top: 0, left: 0, bottom: 10, right: 0))
}
nameLabel.snp.makeConstraints { make in
make.leading.top.equalToSuperview().inset(14)
make.trailing.lessThanOrEqualTo(callButton.snp.leading).offset(-8)
}
phoneLabel.snp.makeConstraints { make in
make.leading.equalTo(nameLabel)
make.top.equalTo(nameLabel.snp.bottom).offset(6)
make.bottom.equalToSuperview().inset(14)
}
chevronView.snp.makeConstraints { make in
make.trailing.equalToSuperview().inset(14)
make.centerY.equalToSuperview()
make.width.height.equalTo(20)
}
callButton.snp.makeConstraints { make in
make.trailing.equalTo(chevronView.snp.leading).offset(-8)
make.centerY.equalToSuperview()
make.width.height.equalTo(32)
}
}
@objc private func callTapped() {
onCallPhone?(personPhone)
}
}