feat: 完善机巢模拟调试与素材交付交互
增加禁飞期间的设备指令拦截及本地模拟拍摄流程;适配订单素材库和景区空境库,完善素材筛选、预览与下载;订单交付入口改为方式选择弹窗并复用云端上传。补充单元测试、接口记录和模拟器截图。
This commit is contained in:
@@ -70,12 +70,21 @@ struct ScenicMaterialClip: Hashable, Sendable {
|
||||
let resolution: String
|
||||
/// 本地演示封面资源名。
|
||||
let coverAssetName: String
|
||||
/// 正式素材原片地址;预览素材为空。
|
||||
let remoteURL: URL?
|
||||
/// 正式素材封面地址。
|
||||
let coverURL: URL?
|
||||
/// 后端返回的片段名称。
|
||||
let fileLabel: String?
|
||||
/// 是否来自正式接口,缺失地址时禁止回退到演示视频。
|
||||
let isRemote: Bool
|
||||
/// 文件是否仍可预览和下载;不可用文件仍可展示其元数据。
|
||||
let isAvailable: Bool
|
||||
|
||||
/// 创建片段元数据,不读取本地相册或请求网络。
|
||||
init(id: String, groupID: String, ordinal: Int, durationSeconds: Int, fileSizeBytes: Int64,
|
||||
resolution: String, coverAssetName: String, isAvailable: Bool = true) {
|
||||
resolution: String, coverAssetName: String, isAvailable: Bool = true,
|
||||
remoteURL: URL? = nil, coverURL: URL? = nil, fileLabel: String? = nil, isRemote: Bool = false) {
|
||||
self.id = id
|
||||
self.groupID = groupID
|
||||
self.ordinal = ordinal
|
||||
@@ -84,16 +93,22 @@ struct ScenicMaterialClip: Hashable, Sendable {
|
||||
self.resolution = resolution
|
||||
self.coverAssetName = coverAssetName
|
||||
self.isAvailable = isAvailable
|
||||
self.remoteURL = remoteURL
|
||||
self.coverURL = coverURL
|
||||
self.fileLabel = fileLabel
|
||||
self.isRemote = isRemote
|
||||
}
|
||||
|
||||
/// 用于封面与预览信息的分秒时长。
|
||||
var durationText: String {
|
||||
guard durationSeconds >= 0 else { return "时长未知" }
|
||||
let value = max(durationSeconds, 0)
|
||||
return String(format: "%02d:%02d", value / 60, value % 60)
|
||||
}
|
||||
|
||||
/// 使用十进制 MB 展示片段大小,避免将原文件与本地示例文件混淆。
|
||||
var sizeText: String {
|
||||
guard fileSizeBytes >= 0 else { return "大小未知" }
|
||||
let megabytes = Double(max(fileSizeBytes, 0)) / 1_000_000
|
||||
return megabytes.rounded() == megabytes ? String(format: "%.0fMB", megabytes) : String(format: "%.1fMB", megabytes)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user