feat: 完善机巢任务状态展示与景区空境库入口

拍摄任务刷新时保留上次成功数据,失败状态按产品网页展示原因和不可召唤提示;新增受权限控制的景区空境库入口,使用当前景区空态。同步测试与接口说明。

验证:模拟器机巢相关 65 项测试、空境库及首页菜单相关 30 项测试通过。
This commit is contained in:
2026-10-29 17:47:28 +08:00
parent 1173207756
commit e827bf8725
18 changed files with 1055 additions and 98 deletions
@@ -172,13 +172,14 @@ final class DroneDockShootingTaskViewController: BaseViewController {
let telemetry = viewModel.telemetry
telemetryView.apply(values: [telemetry.batteryText, telemetry.temperatureText, telemetry.windText,
telemetry.rainText, telemetry.signalText, telemetry.satelliteText],
isStale: loading || viewModel.isTelemetryStale, accessibilityPrefix: "drone.task.remote.metric")
let value = loading ? DroneDockTaskPresentation(
isStale: viewModel.isTelemetryStale, accessibilityPrefix: "drone.task.remote.metric")
let value = loading && viewModel.response == nil ? DroneDockTaskPresentation(
phase: .loading, title: "正在获取任务状态", message: "正在读取当前拍摄任务",
deviceStatus: "—", action: .none, actionTitle: nil, isActionEnabled: false) : viewModel.presentation
statusView.apply(value)
statusView.apply(value, isRefreshing: loading)
statusView.isUserInteractionEnabled = isPageVisible && isApplicationActive && !loading
navigationItem.rightBarButtonItem?.isEnabled = isPageVisible && isApplicationActive && !loading
navigationItem.rightBarButtonItem?.accessibilityValue = loading ? "正在刷新" : nil
}
private func primaryActionTriggered() {
@@ -191,7 +192,7 @@ final class DroneDockShootingTaskViewController: BaseViewController {
case .materials:
guard let navigationController, navigationController.topViewController === self else { return }
navigationController.pushViewController(materialsControllerFactory(viewModel.order, viewModel.context), animated: true)
case .start, .resume, .none:
case .start, .resume, .retry, .none:
break
}
}
@@ -199,7 +200,10 @@ final class DroneDockShootingTaskViewController: BaseViewController {
private func showStatusDetails() {
guard isPageVisible, isApplicationActive, presentedViewController == nil else { return }
let state = viewModel.presentation
let texts = [state.title, state.message, state.deviceStatus].filter { !$0.isEmpty && $0 != "—" }
var texts = [state.title, state.message, state.deviceStatus].filter { !$0.isEmpty && $0 != "—" }
if viewModel.response != nil, let error = viewModel.errorMessage {
texts.append("刷新失败,当前显示上次数据:\(error)")
}
var distinct: [String] = []
for text in texts where !distinct.contains(text) { distinct.append(text) }
let alert = UIAlertController(title: "任务状态详情", message: distinct.joined(separator: "\n\n"), preferredStyle: .alert)
@@ -222,6 +226,9 @@ final class DroneDockShootingTaskViewController: BaseViewController {
self.refreshTask = nil
self.isRequesting = false
self.applySnapshot()
if self.viewModel.response != nil, let error = self.viewModel.errorMessage {
self.showToast("刷新失败,当前显示上次数据:\(error)")
}
}
}
@@ -230,7 +237,7 @@ final class DroneDockShootingTaskViewController: BaseViewController {
refreshTask?.cancel()
refreshTask = nil
isRequesting = false
viewModel.invalidate()
viewModel.invalidate(preservingSnapshot: true)
applySnapshot()
}