feat: 完善机巢任务实时状态、双路图传与继续查看入口

This commit is contained in:
2026-11-03 13:37:06 +08:00
parent 5d48e37cd7
commit 0ed0077ec4
28 changed files with 1326 additions and 213 deletions
@@ -9,6 +9,7 @@ final class DroneDockHomeViewController: BaseViewController {
private let preparationControllerFactory: ((DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController)?
private let materialsControllerFactory: ((DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController)?
private let confirmationControllerFactory: (DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController
private let taskControllerFactory: (Int, DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController
private var refreshTask: Task<Void, Never>?
private var loadMoreTask: Task<Void, Never>?
private var isRefreshing = false
@@ -36,12 +37,14 @@ final class DroneDockHomeViewController: BaseViewController {
init(viewModel: DroneDockHomeViewModel, paymentControllerFactory: (() -> UIViewController)? = nil,
preparationControllerFactory: ((DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController)? = nil,
materialsControllerFactory: ((DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController)? = nil,
confirmationControllerFactory: ((DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController)? = nil) {
confirmationControllerFactory: ((DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController)? = nil,
taskControllerFactory: ((Int, DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController)? = nil) {
self.viewModel = viewModel
self.paymentControllerFactory = paymentControllerFactory
self.preparationControllerFactory = preparationControllerFactory
self.materialsControllerFactory = materialsControllerFactory
self.confirmationControllerFactory = confirmationControllerFactory ?? DroneDockConfirmationEntry.makeController
self.taskControllerFactory = taskControllerFactory ?? DroneDockShootingTaskEntry.makeController
super.init(nibName: nil, bundle: nil)
hidesBottomBarWhenPushed = true
}
@@ -299,7 +302,8 @@ final class DroneDockHomeViewController: BaseViewController {
private func openAllOrders() {
let controller = DroneDockOrdersViewController(
viewModel: viewModel.makeOrdersViewModel(), preparationControllerFactory: preparationFactory,
materialsControllerFactory: materialsFactory, confirmationControllerFactory: confirmationControllerFactory)
materialsControllerFactory: materialsFactory, confirmationControllerFactory: confirmationControllerFactory,
taskControllerFactory: taskControllerFactory)
navigationController?.pushViewController(controller, animated: true)
}
@@ -340,6 +344,12 @@ final class DroneDockHomeViewController: BaseViewController {
private func openPrimaryAction(orderID: String) {
guard !isRefreshing, let order = viewModel.orders.first(where: { $0.orderID == orderID }) else { return }
if let taskID = order.activeTaskID {
guard let navigationController, navigationController.topViewController === self,
presentedViewController == nil else { return }
navigationController.pushViewController(taskControllerFactory(taskID, order, viewModel.context), animated: true)
return
}
if order.primaryAction == "confirm_delivery" {
openConfirmation(order: order)
return