feat: 接入拍摄任务实时订阅并完善日志与封面

This commit is contained in:
2026-11-03 09:06:38 +08:00
parent 687088326c
commit 980d16da9b
27 changed files with 1790 additions and 64 deletions
@@ -108,6 +108,7 @@ final class DronePreparationPointCell: UICollectionViewCell {
thumbnail.backgroundColor = DroneDockStyle.background
thumbnail.layer.cornerRadius = 5
thumbnail.clipsToBounds = true
thumbnail.accessibilityIdentifier = "drone.preparation.point.cover"
nameLabel.numberOfLines = 0
nameLabel.lineBreakMode = .byWordWrapping
nameLabel.accessibilityIdentifier = "drone.preparation.point.name"
@@ -148,6 +149,7 @@ final class DronePreparationPointCell: UICollectionViewCell {
/// 展示点位名称与次数,已拍摄的点位仍保持可选择。
func apply(point: DroneShootingPoint, selected: Bool) {
thumbnail.kf.cancelDownloadTask()
thumbnail.kf.setImage(with: nil as URL?)
contentView.alpha = 1
nameLabel.text = point.name
thumbnail.contentMode = .scaleAspectFill
@@ -164,14 +166,11 @@ final class DronePreparationPointCell: UICollectionViewCell {
func apply(spot: DroneDockPurchasedSpot, selected: Bool) {
nameLabel.text = spot.name
thumbnail.kf.cancelDownloadTask()
thumbnail.image = UIImage(systemName: "photo")
thumbnail.contentMode = .center
let coverURL = spot.displayCoverURL
thumbnail.contentMode = coverURL == nil ? .center : .scaleAspectFill
thumbnail.tintColor = DroneDockStyle.secondary
if let text = spot.coverURL, let url = URL(string: text),
let scheme = url.scheme?.lowercased(), ["https", "http"].contains(scheme), url.host != nil {
thumbnail.contentMode = .scaleAspectFill
thumbnail.kf.setImage(with: url, placeholder: UIImage(systemName: "photo"))
}
// nil 也交给 Kingfisher,撤销旧图片标识,防止复用后的迟到结果覆盖占位图。
thumbnail.kf.setImage(with: coverURL, placeholder: UIImage(systemName: "photo"))
if spot.available != true {
countLabel.text = spot.available == false ? "拍摄点不可用" : "可用性待确认"
} else {
@@ -189,7 +188,7 @@ final class DronePreparationPointCell: UICollectionViewCell {
override func prepareForReuse() {
super.prepareForReuse()
thumbnail.kf.cancelDownloadTask()
thumbnail.image = nil
thumbnail.kf.setImage(with: nil as URL?)
}
}