feat(drone-dock): 接入图传与重召唤的本地模拟流程

新增 live 接口、状态展示和本地视频预览;支持同任务重新召唤、单次回查和防重,保留禁飞拦截。同步测试、模拟证据、后端接口确认文档及景区空境库范围约定。

验证:168 个相关用例最终均通过;最后复跑 38 项零失败。真实设备指令未发送。
This commit is contained in:
2026-11-02 09:49:17 +08:00
parent 2913273e35
commit c1fd2d0859
33 changed files with 3246 additions and 84 deletions
@@ -1,11 +1,13 @@
import SnapKit
import UIKit
/// 对齐体验网页的任务失败组合:警示、原因、排查提示、重召占位及设备提示。
/// 对齐体验网页的任务失败组合:警示、原因、排查提示、重召或刷新操作及设备提示。
@MainActor
final class DroneDockTaskFailureView: UIView {
/// 点击原因区域查看完整后端说明,页面无需额外占用一个详情按钮。
var onDetails: (() -> Void)?
/// 将重召唤或结果核对操作交给任务页,视图不直接发送请求。
var onPrimaryAction: (() -> Void)?
/// 内部排版参考比例,不对视图或点击区域使用整体缩放。
private(set) var effectiveScale: CGFloat = 1
/// 当前是否使用适配固定小高度的紧凑排版。
@@ -44,13 +46,16 @@ final class DroneDockTaskFailureView: UIView {
required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") }
/// 更新真实失败原因及不可重召原因,不把开始拍摄许可当作重召许可。
func apply(_ value: DroneDockTaskPresentation) {
func apply(_ value: DroneDockTaskPresentation, isRefreshing: Bool = false) {
presentation = value
titleLabel.text = value.title
let reason = DroneDockHomeMetric.usableText(value.message).flatMap { $0 == "—" ? nil : $0 }
?? "服务端暂未提供具体原因"
reasonLabel.text = reason.hasPrefix("失败原因:") ? reason : "失败原因:\(reason)"
noteLabel.text = value.actionNote ?? "暂不可重新召唤,请返回准备页确认设备状态"
noteLabel.text = value.actionNote ?? (value.action == .refresh ? "请核对原任务状态,勿重复召唤" : "")
retryButton.configuration?.title = value.actionTitle
retryButton.configuration?.image = UIImage(systemName: value.action == .refresh ? "arrow.clockwise" : "arrow.triangle.2.circlepath")
retryButton.isEnabled = value.isActionEnabled && !isRefreshing
notice.accessibilityLabel = [value.title, reasonLabel.text, adviceLabel.text].compactMap { $0 }.joined(separator: "。")
setNeedsLayout()
}
@@ -107,11 +112,12 @@ final class DroneDockTaskFailureView: UIView {
configuration.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 8, bottom: 0, trailing: 8)
retryButton.configuration = configuration
retryButton.configurationUpdateHandler = { button in
button.configuration?.baseForegroundColor = UIColor(hex: 0x939CB0)
button.configuration?.background.backgroundColor = UIColor(hex: 0xE8EBF1)
button.configuration?.baseForegroundColor = button.isEnabled ? .white : UIColor(hex: 0x939CB0)
button.configuration?.background.backgroundColor = button.isEnabled ? DroneDockStyle.primary : UIColor(hex: 0xE8EBF1)
}
retryButton.isEnabled = false
retryButton.accessibilityIdentifier = "drone.task.remote.failureRetry"
retryButton.addTarget(self, action: #selector(primaryTapped), for: .touchUpInside)
}
private func setupConstraints() {
@@ -205,4 +211,9 @@ final class DroneDockTaskFailureView: UIView {
}
@objc private func showDetails() { onDetails?() }
@objc private func primaryTapped() {
guard retryButton.isEnabled else { return }
onPrimaryAction?()
}
}