feat: 完善机巢任务实时状态、双路图传与继续查看入口
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import UIKit
|
||||
@testable import suixinkan
|
||||
|
||||
/// 继续查看入口的隔离任务页,只允许 MockURLSession 接收同任务 shooting,不配置图传或飞控。
|
||||
@MainActor
|
||||
enum DroneDockActiveTaskViewFixtures {
|
||||
/// 构造时不读接口;页面显示后才发出携带 active_task_id 的只读请求。
|
||||
static func controller(taskID: Int, order: DroneDockHomeOrder, context: DroneDockHomeContext) throws
|
||||
-> (DroneDockShootingTaskViewController, MockURLSession) {
|
||||
let data: [String: Any] = [
|
||||
"order_flight_task_id": taskID,
|
||||
"order_flight_task": ["id": taskID, "order_number": order.orderID, "scenic_id": context.scenicID],
|
||||
"task": ["id": taskID, "status": 20], "ui": ["phase": "shooting", "title": "模拟拍摄中"]
|
||||
]
|
||||
let body = try JSONSerialization.data(withJSONObject: ["code": 100000, "msg": "success", "data": data])
|
||||
let session = MockURLSession(responses: [body])
|
||||
let client = APIClient(environment: .testing, session: session, notificationCenter: NotificationCenter())
|
||||
let model = DroneDockShootingTaskViewModel(context: context, taskID: taskID, order: order,
|
||||
service: DroneDockShootingAPI(client: client), currentContext: { context })
|
||||
let live = DroneDockLiveViewModel(context: context, taskID: taskID, currentContext: { context })
|
||||
return (DroneDockShootingTaskViewController(viewModel: model, liveViewModel: live), session)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user