fix(drone-dock): 完善云端成片上传并调整素材库展示

This commit is contained in:
2026-10-30 17:24:02 +08:00
parent fad2ed8a50
commit e0da4728e5
16 changed files with 583 additions and 69 deletions
@@ -119,7 +119,7 @@ final class DroneDockMaterialRecordCell: UICollectionViewCell {
let record = task.sequence.map { String(format: "记录%02d", $0) } ?? "记录序号待确认"
metadataLabel.text = "\(usable(task.airLineName, fallback: "航线待确认")) · \(shortDate(task.createdAt)) · \(record)"
var configuration = UIButton.Configuration.plain()
configuration.title = task.film == nil ? "交付成片" : "替换成片"
configuration.title = "交付成片"
configuration.image = UIImage(systemName: "play.rectangle")
configuration.imagePadding = 5
configuration.contentInsets = .zero
@@ -134,7 +134,7 @@ final class DroneDockMaterialRecordCell: UICollectionViewCell {
deliveryButton.accessibilityIdentifier = "drone.materials.remote.delivery.\(task.id)"
self.action = action
emptyPanel.isHidden = !task.materials.isEmpty
separator.isHidden = !task.materials.isEmpty || task.film != nil
separator.isHidden = !task.materials.isEmpty
let state: (String, String, String, UIColor) = switch task.materialStatus {
case 0: ("素材待上传", "拍摄完成后将自动上传,请稍后刷新", "icloud.and.arrow.up", DroneDockStyle.secondary)
case 1: ("暂无可用原素材", "素材记录尚未返回,请刷新查看", "photo.on.rectangle", DroneDockStyle.secondary)
@@ -146,8 +146,7 @@ final class DroneDockMaterialRecordCell: UICollectionViewCell {
emptyTitle.textColor = state.3
emptyIcon.image = UIImage(systemName: state.2)
emptyIcon.tintColor = state.3
let film = task.film == nil ? " · 暂无视频成片" : ""
emptyDetail.text = "\(flightTitle(task.flightStatus))\(film)\n\(state.1)"
emptyDetail.text = "\(flightTitle(task.flightStatus))\n\(state.1)"
accessibilityIdentifier = "drone.materials.remote.task.\(task.id)"
}
@@ -266,21 +265,6 @@ final class DroneDockMaterialMediaCell: UICollectionViewCell {
previewButton.accessibilityHint = file.uploadStatus == 3 ? DroneDockHomeMetric.usableText(file.failureReason) : nil
}
/// 已交付成片独立标记且不参与原素材全选。
func apply(film: DroneDockMaterialFilm, taskID: Int, localImage: UIImage?, allowsRemoteImage: Bool,
preview: @escaping () -> Void) {
let ready = film.previewURL != nil
apply(title: DroneDockHomeMetric.usableText(film.fileName) ?? "视频成片", state: ready ? "视频成片 · 点击播放" : "视频成片 · 暂不可预览",
color: ready ? DroneDockStyle.success : DroneDockStyle.secondary, cover: film.coverURL, fallback: nil,
video: true, enabled: ready, failed: false, localImage: localImage, allowsRemoteImage: allowsRemoteImage,
identifier: "drone.materials.remote.film.\(taskID).\(film.id)")
selectionButton.isHidden = true
selectionAction = nil
previewAction = preview
previewButton.accessibilityHint = nil
thumbnail.layer.borderColor = UIColor.clear.cgColor
}
private func apply(title: String, state: String, color: UIColor, cover: String?, fallback: URL?, video: Bool,
enabled: Bool, failed: Bool, localImage: UIImage?, allowsRemoteImage: Bool, identifier: String) {
thumbnail.kf.cancelDownloadTask()