feat: 完善机巢任务状态展示与景区空境库入口
拍摄任务刷新时保留上次成功数据,失败状态按产品网页展示原因和不可召唤提示;新增受权限控制的景区空境库入口,使用当前景区空态。同步测试与接口说明。 验证:模拟器机巢相关 65 项测试、空境库及首页菜单相关 30 项测试通过。
This commit is contained in:
@@ -22,6 +22,7 @@ final class DroneDockTaskStatusView: UIView {
|
||||
private let actionRow = UIView()
|
||||
private let primaryButton = UIButton(type: .system)
|
||||
private let detailsButton = UIButton(type: .system)
|
||||
private let failureView = DroneDockTaskFailureView()
|
||||
private var presentation: DroneDockTaskPresentation?
|
||||
private var contentTop: Constraint?
|
||||
private var contentLeading: Constraint?
|
||||
@@ -47,9 +48,17 @@ final class DroneDockTaskStatusView: UIView {
|
||||
CGSize(width: UIView.noIntrinsicMetric, height: UIView.noIntrinsicMetric)
|
||||
}
|
||||
|
||||
/// 更新真实状态文案与动作许可,不补造百分比或自行推导飞行阶段。
|
||||
func apply(_ presentation: DroneDockTaskPresentation) {
|
||||
/// 更新真实状态与动作许可;刷新期间保留内容,只暂时禁用主操作。
|
||||
func apply(_ presentation: DroneDockTaskPresentation, isRefreshing: Bool = false) {
|
||||
self.presentation = presentation
|
||||
let isFailure = presentation.phase == .failed
|
||||
contentStack.isHidden = isFailure
|
||||
failureView.isHidden = !isFailure
|
||||
if isFailure {
|
||||
failureView.apply(presentation)
|
||||
setNeedsLayout()
|
||||
return
|
||||
}
|
||||
titleLabel.text = presentation.title
|
||||
messageLabel.text = presentation.message
|
||||
deviceLabel.text = presentation.deviceStatus
|
||||
@@ -59,7 +68,7 @@ final class DroneDockTaskStatusView: UIView {
|
||||
let actionTitle = DroneDockHomeMetric.usableText(presentation.actionTitle)
|
||||
primaryButton.isHidden = presentation.action == .none || actionTitle == nil
|
||||
primaryButton.setTitle(actionTitle, for: .normal)
|
||||
primaryButton.isEnabled = presentation.isActionEnabled && !primaryButton.isHidden
|
||||
primaryButton.isEnabled = presentation.isActionEnabled && !primaryButton.isHidden && !isRefreshing
|
||||
primaryButton.backgroundColor = primaryButton.isEnabled
|
||||
? DroneDockStyle.primary : DroneDockStyle.primary.withAlphaComponent(0.35)
|
||||
primaryButton.accessibilityIdentifier = presentation.action == .refresh
|
||||
@@ -69,12 +78,22 @@ final class DroneDockTaskStatusView: UIView {
|
||||
|
||||
/// 尺寸改变时仅重排内部内容,保留至少 44 点操作区域,不使用 transform 缩放。
|
||||
override func layoutSubviews() {
|
||||
if presentation?.phase == .failed {
|
||||
super.layoutSubviews()
|
||||
failureView.layoutIfNeeded()
|
||||
effectiveScale = failureView.effectiveScale
|
||||
usesCompactLayout = failureView.usesCompactLayout
|
||||
return
|
||||
}
|
||||
updateContentLayout()
|
||||
super.layoutSubviews()
|
||||
}
|
||||
|
||||
private func setupUI() {
|
||||
backgroundColor = .white
|
||||
addSubview(failureView)
|
||||
failureView.isHidden = true
|
||||
failureView.onDetails = { [weak self] in self?.onDetails?() }
|
||||
contentStack.axis = .vertical
|
||||
contentStack.alignment = .fill
|
||||
contentStack.spacing = 10
|
||||
@@ -115,6 +134,7 @@ final class DroneDockTaskStatusView: UIView {
|
||||
}
|
||||
|
||||
private func setupConstraints() {
|
||||
failureView.snp.makeConstraints { make in make.edges.equalToSuperview() }
|
||||
contentStack.snp.makeConstraints { make in
|
||||
contentTop = make.top.equalToSuperview().offset(12).constraint
|
||||
contentLeading = make.leading.equalToSuperview().offset(16).constraint
|
||||
|
||||
Reference in New Issue
Block a user