feat(drone-dock): 完善真实联调、状态轮询与准备页反馈
开放 Release 真实操作并保留 Debug 拦截;恢复前台 shooting 串行轮询;统一打印机巢请求与完整原值响应;优化长点位名称、未拍摄文案、报备失败及已结束任务提示,移除成功回执 UI。补充相关测试、离线策略检查和联调说明。
This commit is contained in:
@@ -108,21 +108,24 @@ final class DronePreparationPointCell: UICollectionViewCell {
|
||||
thumbnail.backgroundColor = DroneDockStyle.background
|
||||
thumbnail.layer.cornerRadius = 5
|
||||
thumbnail.clipsToBounds = true
|
||||
[thumbnail, nameLabel, countLabel].forEach(contentView.addSubview)
|
||||
nameLabel.numberOfLines = 0
|
||||
nameLabel.lineBreakMode = .byWordWrapping
|
||||
nameLabel.accessibilityIdentifier = "drone.preparation.point.name"
|
||||
let labels = UIStackView(arrangedSubviews: [nameLabel, countLabel])
|
||||
labels.axis = .vertical
|
||||
labels.spacing = 6
|
||||
[thumbnail, labels].forEach(contentView.addSubview)
|
||||
thumbnail.snp.makeConstraints { make in
|
||||
make.leading.equalToSuperview().offset(8)
|
||||
make.centerY.equalToSuperview()
|
||||
make.size.equalTo(48)
|
||||
}
|
||||
nameLabel.snp.makeConstraints { make in
|
||||
make.bottom.equalTo(contentView.snp.centerY).offset(-3)
|
||||
labels.snp.makeConstraints { make in
|
||||
make.centerY.equalToSuperview()
|
||||
make.top.greaterThanOrEqualToSuperview().offset(8)
|
||||
make.bottom.lessThanOrEqualToSuperview().inset(8)
|
||||
make.leading.equalTo(thumbnail.snp.trailing).offset(8)
|
||||
make.trailing.equalToSuperview().inset(6)
|
||||
}
|
||||
countLabel.snp.makeConstraints { make in
|
||||
make.top.equalTo(contentView.snp.centerY).offset(3)
|
||||
make.leading.equalTo(nameLabel)
|
||||
make.trailing.equalToSuperview().inset(5)
|
||||
make.trailing.equalToSuperview().inset(8)
|
||||
}
|
||||
isAccessibilityElement = true
|
||||
}
|
||||
@@ -130,6 +133,18 @@ final class DronePreparationPointCell: UICollectionViewCell {
|
||||
@available(*, unavailable)
|
||||
required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") }
|
||||
|
||||
/// 横向同组卡片采用最长名称所需的高度,名称完整换行且不压缩字号。
|
||||
static func preferredHeight(names: [String], width: CGFloat) -> CGFloat {
|
||||
let label = DroneDockStyle.label(size: 13, weight: .semibold)
|
||||
label.numberOfLines = 0
|
||||
let nameWidth = max(1, width - 72)
|
||||
let nameHeight = names.map { name -> CGFloat in
|
||||
label.text = name
|
||||
return label.sizeThatFits(CGSize(width: nameWidth, height: .greatestFiniteMagnitude)).height
|
||||
}.max() ?? 0
|
||||
return max(64, ceil(nameHeight) + 6 + ceil(UIFont.systemFont(ofSize: 11).lineHeight) + 16)
|
||||
}
|
||||
|
||||
/// 展示点位名称与次数,已拍摄的点位仍保持可选择。
|
||||
func apply(point: DroneShootingPoint, selected: Bool) {
|
||||
thumbnail.kf.cancelDownloadTask()
|
||||
@@ -145,7 +160,7 @@ final class DronePreparationPointCell: UICollectionViewCell {
|
||||
accessibilityIdentifier = "drone.preparation.point.\(point.id)"
|
||||
}
|
||||
|
||||
/// 展示已购点位与可用性;点位已拍次数缺失时保持未知占位。
|
||||
/// 展示已购点位与可用性;无拍摄记录时显示“未拍摄”。
|
||||
func apply(spot: DroneDockPurchasedSpot, selected: Bool) {
|
||||
nameLabel.text = spot.name
|
||||
thumbnail.kf.cancelDownloadTask()
|
||||
@@ -160,7 +175,7 @@ final class DronePreparationPointCell: UICollectionViewCell {
|
||||
if spot.available != true {
|
||||
countLabel.text = spot.available == false ? "拍摄点不可用" : "可用性待确认"
|
||||
} else {
|
||||
countLabel.text = "已拍摄 — 次"
|
||||
countLabel.text = "未拍摄"
|
||||
}
|
||||
contentView.backgroundColor = selected ? DroneDockStyle.primary.withAlphaComponent(0.07) : .white
|
||||
contentView.layer.borderColor = (selected ? DroneDockStyle.primary : DroneDockStyle.border).cgColor
|
||||
@@ -331,13 +346,16 @@ final class DronePreparationHeadingView: UICollectionReusableView {
|
||||
stack.axis = .horizontal
|
||||
stack.alignment = .firstBaseline
|
||||
stack.spacing = 12
|
||||
titleLabel.numberOfLines = 0
|
||||
titleLabel.accessibilityIdentifier = "drone.preparation.heading.title"
|
||||
addSubview(stack)
|
||||
stack.snp.makeConstraints { make in
|
||||
make.leading.equalToSuperview().offset(4)
|
||||
make.trailing.equalToSuperview()
|
||||
make.centerY.equalToSuperview().offset(3)
|
||||
}
|
||||
titleLabel.setContentCompressionResistancePriority(.required, for: .horizontal)
|
||||
titleLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
|
||||
detailLabel.setContentCompressionResistancePriority(.required, for: .horizontal)
|
||||
accessibilityTraits = .header
|
||||
isAccessibilityElement = true
|
||||
}
|
||||
@@ -352,6 +370,16 @@ final class DronePreparationHeadingView: UICollectionReusableView {
|
||||
detailLabel.isHidden = detail == nil
|
||||
accessibilityLabel = [title, detail].compactMap { $0 }.joined(separator: ",")
|
||||
}
|
||||
|
||||
/// 为长点位名称预留完整标题高度,右侧航线数量保持可见。
|
||||
static func preferredHeight(title: String, detail: String, width: CGFloat) -> CGFloat {
|
||||
let label = DroneDockStyle.label(size: 18, weight: .semibold)
|
||||
label.numberOfLines = 0
|
||||
label.text = title
|
||||
let detailWidth = (detail as NSString).size(withAttributes: [.font: UIFont.systemFont(ofSize: 13)]).width
|
||||
let titleWidth = max(1, width - 4 - ceil(detailWidth) - 24)
|
||||
return max(64, ceil(label.sizeThatFits(CGSize(width: titleWidth, height: .greatestFiniteMagnitude)).height) + 26)
|
||||
}
|
||||
}
|
||||
|
||||
/// 无点位或无航线时保留就地提示,不增加额外的选择弹窗。
|
||||
|
||||
Reference in New Issue
Block a user