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:
@ -22,6 +22,10 @@ final class ProfileInfoRowView: UIControl {
|
||||
private let divider = UIView()
|
||||
private let badgeContainer = UIView()
|
||||
private var badgeView: ProfileStatusBadgeView?
|
||||
private let rightStack = UIStackView()
|
||||
private let stackNameLabel = UILabel()
|
||||
private let stackTypeTag = UILabel()
|
||||
private var rowHeightConstraint: Constraint?
|
||||
|
||||
var showsDivider = true {
|
||||
didSet { divider.isHidden = !showsDivider }
|
||||
@ -44,6 +48,8 @@ final class ProfileInfoRowView: UIControl {
|
||||
accessory: AccessoryStyle = .none,
|
||||
badge: ProfileStatusBadgeView.Style? = nil
|
||||
) {
|
||||
setStackedModeEnabled(false)
|
||||
|
||||
valueLabel.text = value
|
||||
valueLabel.textColor = valueColor
|
||||
valueLabel.isHidden = badge != nil
|
||||
@ -73,6 +79,84 @@ final class ProfileInfoRowView: UIControl {
|
||||
accessoryLabel.isHidden = false
|
||||
chevronView.isHidden = false
|
||||
}
|
||||
|
||||
updateContentConstraints(for: accessory)
|
||||
}
|
||||
|
||||
/// 右侧竖排展示店铺名称与账号类型标识,可选右侧箭头。
|
||||
func configureAccountInfo(
|
||||
storeName: String,
|
||||
accountTypeLabel: String,
|
||||
isStoreAccount: Bool,
|
||||
showsChevron: Bool = true
|
||||
) {
|
||||
setStackedModeEnabled(true, showsChevron: showsChevron)
|
||||
|
||||
stackNameLabel.text = storeName
|
||||
stackTypeTag.text = accountTypeLabel
|
||||
if isStoreAccount {
|
||||
stackTypeTag.textColor = UIColor(hex: 0x0F9F6E)
|
||||
stackTypeTag.backgroundColor = UIColor(hex: 0xE8F8F1)
|
||||
} else {
|
||||
stackTypeTag.textColor = UIColor(hex: 0x7C3AED)
|
||||
stackTypeTag.backgroundColor = UIColor(hex: 0xF3ECFF)
|
||||
}
|
||||
|
||||
updateStackedConstraints(showsChevron: showsChevron)
|
||||
}
|
||||
|
||||
private func setStackedModeEnabled(_ enabled: Bool, showsChevron: Bool = false) {
|
||||
rightStack.isHidden = !enabled
|
||||
accessoryLabel.isHidden = true
|
||||
chevronView.isHidden = !enabled || !showsChevron
|
||||
|
||||
if enabled {
|
||||
valueLabel.isHidden = true
|
||||
badgeContainer.isHidden = true
|
||||
rowHeightConstraint?.update(offset: 64)
|
||||
} else {
|
||||
rowHeightConstraint?.update(offset: 52)
|
||||
}
|
||||
}
|
||||
|
||||
private func updateStackedConstraints(showsChevron: Bool) {
|
||||
rightStack.snp.remakeConstraints { make in
|
||||
make.centerY.equalToSuperview()
|
||||
make.leading.greaterThanOrEqualTo(titleLabel.snp.trailing).offset(8)
|
||||
if showsChevron {
|
||||
make.trailing.equalTo(chevronView.snp.leading).offset(-4)
|
||||
} else {
|
||||
make.trailing.equalToSuperview()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func updateContentConstraints(for accessory: AccessoryStyle) {
|
||||
valueLabel.snp.remakeConstraints { make in
|
||||
make.leading.greaterThanOrEqualTo(titleLabel.snp.trailing).offset(8)
|
||||
make.centerY.equalToSuperview()
|
||||
switch accessory {
|
||||
case .action:
|
||||
make.trailing.equalTo(accessoryLabel.snp.leading).offset(-8)
|
||||
case .chevron:
|
||||
make.trailing.equalTo(chevronView.snp.leading).offset(-4)
|
||||
case .none:
|
||||
make.trailing.equalToSuperview()
|
||||
}
|
||||
}
|
||||
|
||||
badgeContainer.snp.remakeConstraints { make in
|
||||
make.leading.equalTo(titleLabel.snp.trailing).offset(8)
|
||||
make.centerY.equalToSuperview()
|
||||
switch accessory {
|
||||
case .action:
|
||||
make.trailing.lessThanOrEqualTo(accessoryLabel.snp.leading).offset(-8)
|
||||
case .chevron:
|
||||
make.trailing.lessThanOrEqualTo(chevronView.snp.leading).offset(-8)
|
||||
case .none:
|
||||
make.trailing.lessThanOrEqualToSuperview()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func setupUI() {
|
||||
@ -83,13 +167,36 @@ final class ProfileInfoRowView: UIControl {
|
||||
valueLabel.font = .systemFont(ofSize: 14)
|
||||
valueLabel.textAlignment = .right
|
||||
valueLabel.numberOfLines = 1
|
||||
valueLabel.lineBreakMode = .byTruncatingTail
|
||||
valueLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
|
||||
|
||||
accessoryLabel.font = .systemFont(ofSize: 14)
|
||||
accessoryLabel.textColor = AppColor.primary
|
||||
accessoryLabel.setContentHuggingPriority(.required, for: .horizontal)
|
||||
accessoryLabel.setContentCompressionResistancePriority(.required, for: .horizontal)
|
||||
|
||||
chevronView.image = UIImage(systemName: "chevron.right")
|
||||
chevronView.tintColor = AppColor.text666
|
||||
chevronView.contentMode = .scaleAspectFit
|
||||
chevronView.setContentHuggingPriority(.required, for: .horizontal)
|
||||
|
||||
stackNameLabel.font = .systemFont(ofSize: 14)
|
||||
stackNameLabel.textColor = AppColor.text333
|
||||
stackNameLabel.textAlignment = .right
|
||||
stackNameLabel.numberOfLines = 1
|
||||
stackNameLabel.lineBreakMode = .byTruncatingTail
|
||||
|
||||
stackTypeTag.font = .systemFont(ofSize: 11, weight: .semibold)
|
||||
stackTypeTag.textAlignment = .center
|
||||
stackTypeTag.layer.cornerRadius = 4
|
||||
stackTypeTag.clipsToBounds = true
|
||||
|
||||
rightStack.axis = .vertical
|
||||
rightStack.alignment = .trailing
|
||||
rightStack.spacing = 4
|
||||
rightStack.addArrangedSubview(stackNameLabel)
|
||||
rightStack.addArrangedSubview(stackTypeTag)
|
||||
rightStack.isHidden = true
|
||||
|
||||
divider.backgroundColor = UIColor(hex: 0xE5E7EB)
|
||||
|
||||
@ -98,10 +205,11 @@ final class ProfileInfoRowView: UIControl {
|
||||
addSubview(badgeContainer)
|
||||
addSubview(accessoryLabel)
|
||||
addSubview(chevronView)
|
||||
addSubview(rightStack)
|
||||
addSubview(divider)
|
||||
|
||||
snp.makeConstraints { make in
|
||||
make.height.equalTo(52)
|
||||
rowHeightConstraint = make.height.equalTo(52).constraint
|
||||
}
|
||||
titleLabel.snp.makeConstraints { make in
|
||||
make.leading.equalToSuperview()
|
||||
@ -117,16 +225,16 @@ final class ProfileInfoRowView: UIControl {
|
||||
make.trailing.equalTo(chevronView.snp.leading).offset(-4)
|
||||
make.centerY.equalToSuperview()
|
||||
}
|
||||
valueLabel.snp.makeConstraints { make in
|
||||
rightStack.snp.makeConstraints { make in
|
||||
make.trailing.equalToSuperview()
|
||||
make.centerY.equalToSuperview()
|
||||
make.leading.greaterThanOrEqualTo(titleLabel.snp.trailing).offset(8)
|
||||
make.trailing.equalTo(chevronView.snp.leading).offset(-4)
|
||||
make.centerY.equalToSuperview()
|
||||
}
|
||||
badgeContainer.snp.makeConstraints { make in
|
||||
make.leading.equalTo(titleLabel.snp.trailing).offset(8)
|
||||
make.centerY.equalToSuperview()
|
||||
make.trailing.lessThanOrEqualTo(chevronView.snp.leading).offset(-8)
|
||||
stackTypeTag.snp.makeConstraints { make in
|
||||
make.height.equalTo(22)
|
||||
make.width.greaterThanOrEqualTo(56)
|
||||
}
|
||||
updateContentConstraints(for: .none)
|
||||
divider.snp.makeConstraints { make in
|
||||
make.leading.trailing.bottom.equalToSuperview()
|
||||
make.height.equalTo(0.5)
|
||||
|
||||
Reference in New Issue
Block a user