feat(drone-dock): 接入已购套餐快照并固定首页无人机占位

准备页改用 project-info 购买快照,校验订单与项目身份,并按可用性选择已购点位和航线。首页在加载、空数据及失败时保留等高无人机卡片。同步相关测试与接口联调记录、响应和截图。

验证:iPhone 18 Pro 模拟器上 81 项相关测试通过。
This commit is contained in:
2026-10-28 16:50:35 +08:00
parent d01d18d5b3
commit 2793f6b113
58 changed files with 3890 additions and 717 deletions
@@ -5,6 +5,7 @@ import UIKit
final class DroneDockDeviceCardView: UIView {
private let nameLabel = DroneDockStyle.label(size: 15, weight: .semibold)
private let statusLabel = DroneDockDeviceStatusView()
private let detailLabel = DroneDockStyle.label(size: 11, color: DroneDockStyle.secondary)
private let batteryView = DroneDockBatteryView()
private let signalValue = DroneDockStyle.label(size: 19, weight: .semibold)
private let satelliteValue = DroneDockStyle.label(size: 19, weight: .semibold)
@@ -28,6 +29,7 @@ final class DroneDockDeviceCardView: UIView {
/// 未知读数由模型提供破折号,不以零代替未知。
func apply(device: DroneDockDevice) {
detailLabel.isHidden = true
nameLabel.text = device.name
statusLabel.apply(title: device.state.title, tone: device.state.tone)
batteryView.apply(telemetry: device.telemetry)
@@ -42,6 +44,7 @@ final class DroneDockDeviceCardView: UIView {
/// 展示 home 返回的机巢名称、工作状态及格式化读数,不根据展示状态推断起飞许可。
func apply(airport: DroneDockHomeAirport) {
detailLabel.isHidden = true
nameLabel.text = airport.name
statusLabel.apply(title: airport.statusTitle, tone: airport.statusTone)
batteryView.apply(text: airport.metricText(for: "battery"), progress: airport.batteryProgress)
@@ -54,13 +57,31 @@ final class DroneDockDeviceCardView: UIView {
accessibilityLabel = "\(airport.name),\(airport.statusTitle)"
}
/// 没有设备快照时保留完整遥测卡,读数保持未知并展示当前加载结果。
func applyPlaceholder(status: String, detail: String) {
nameLabel.text = "暂无无人机"
statusLabel.apply(title: status, tone: .gray)
detailLabel.text = detail
detailLabel.isHidden = false
batteryView.apply(telemetry: .unknown)
signalValue.text = "—"
satelliteValue.text = "—"
temperatureValue.text = "—"
windValue.text = "—"
rainValue.text = "—"
accessibilityIdentifier = "drone.device.empty"
accessibilityLabel = "暂无无人机,\(status),\(detail)"
}
private func setupUI() {
temperatureValue.accessibilityIdentifier = "drone.metric.env_temp"
windValue.accessibilityIdentifier = "drone.metric.wind_speed"
rainValue.accessibilityIdentifier = "drone.metric.rainfall"
signalValue.accessibilityIdentifier = "drone.metric.signal"
satelliteValue.accessibilityIdentifier = "drone.metric.satellite"
[nameLabel, statusLabel, batteryView].forEach(addSubview)
detailLabel.isHidden = true
detailLabel.lineBreakMode = .byTruncatingMiddle
[nameLabel, statusLabel, detailLabel, batteryView].forEach(addSubview)
nameLabel.snp.makeConstraints { make in
make.top.leading.equalToSuperview().inset(16)
make.trailing.lessThanOrEqualTo(statusLabel.snp.leading).offset(-8)
@@ -69,6 +90,10 @@ final class DroneDockDeviceCardView: UIView {
make.centerY.equalTo(nameLabel)
make.trailing.equalToSuperview().inset(16)
}
detailLabel.snp.makeConstraints { make in
make.top.equalTo(nameLabel.snp.bottom).offset(2)
make.leading.trailing.equalToSuperview().inset(16)
}
batteryView.snp.makeConstraints { make in
make.leading.equalToSuperview().inset(20)
make.top.equalTo(nameLabel.snp.bottom).offset(16)