feat(drone-dock): 接通任务召唤与状态页并固定拍摄布局
接入 plane-status、tasks/create、shoot 与 shooting,保持同一任务 ID 串接、重复提交保护和只读单次刷新。拍摄任务页固定顶部参数与底部安全控制,中间状态区域适配小屏且不滚动;同步接口记录、脱敏响应及相关测试。
This commit is contained in:
@@ -6,6 +6,22 @@ import UIKit
|
||||
enum DroneDockPreview {
|
||||
/// 启动参数存在时返回预览导航,正常冷启动继续使用原业务根页面。
|
||||
static func navigationController(arguments: [String]) -> UINavigationController? {
|
||||
// 仅打开已存在任务进行只读联调;不经过创建或召唤流程。
|
||||
if let taskArgument = arguments.first(where: { $0.hasPrefix("--dock-task-live=") }),
|
||||
let taskID = Int(taskArgument.dropFirst("--dock-task-live=".count)), taskID > 0,
|
||||
let orderArgument = arguments.first(where: { $0.hasPrefix("--dock-task-order=") }),
|
||||
AppStore.shared.session.isLoggedIn {
|
||||
let number = String(orderArgument.dropFirst("--dock-task-order=".count)).trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
if !number.isEmpty,
|
||||
let data = try? JSONEncoder().encode(["order_number": number]),
|
||||
let order = try? JSONDecoder().decode(DroneDockHomeOrder.self, from: data) {
|
||||
let task = DroneDockShootingTaskEntry.makeController(taskID: taskID, order: order,
|
||||
context: DroneDockHomeViewController.currentContext())
|
||||
let navigation = UINavigationController()
|
||||
navigation.setViewControllers([DroneDockHomeViewController(), task], animated: false)
|
||||
return navigation
|
||||
}
|
||||
}
|
||||
if let argument = arguments.first(where: { $0.hasPrefix("--dock-delivery-live=") }), AppStore.shared.session.isLoggedIn {
|
||||
let number = String(argument.dropFirst("--dock-delivery-live=".count))
|
||||
if let data = try? JSONEncoder().encode(["order_number": number]),
|
||||
@@ -29,6 +45,18 @@ enum DroneDockPreview {
|
||||
return navigation
|
||||
}
|
||||
if arguments.contains("--dock-home-live"), AppStore.shared.session.isLoggedIn {
|
||||
// 显式联调既有任务,只读取 shooting,避免为检查响应额外创建订单任务。
|
||||
if let argument = arguments.first(where: { $0.hasPrefix("--dock-shooting-probe=") }),
|
||||
let taskID = Int(argument.dropFirst("--dock-shooting-probe=".count)), taskID > 0 {
|
||||
Task { @MainActor in
|
||||
do {
|
||||
_ = try await DroneDockShootingAPI(client: NetworkServices.shared.apiClient)
|
||||
.shooting(taskID: taskID, liveBattery: true)
|
||||
} catch {
|
||||
print("[DroneDockShooting] Existing task read failed: \(error.localizedDescription)")
|
||||
}
|
||||
}
|
||||
}
|
||||
return UINavigationController(rootViewController: DroneDockHomeViewController())
|
||||
}
|
||||
let entryFlags = ["--dock-ui-preview", "--dock-ui-orders-preview", "--dock-ui-preparation-preview", "--dock-ui-task-preview", "--dock-ui-materials-preview", "--dock-ui-delivery-preview", "--dock-ui-delivery-review-preview"]
|
||||
|
||||
Reference in New Issue
Block a user