feat: 新增相册自动修图与OTG状态预览

支持相册修图配置、模板选择和传输模式选择;上传后自动提交修图并展示状态角标及精修预览。补充接口文档与相关测试。
This commit is contained in:
2026-08-27 16:03:40 +08:00
parent 9fce6ef713
commit d04641b623
17 changed files with 2523 additions and 26 deletions
@@ -19,6 +19,13 @@ struct TravelAlbumOTGPhotoItem: Hashable, Sendable {
var errorMessage: String?
let localPath: String
var remoteUrl: String
var serverMaterialId: Int = 0
var autoRetouchState: TravelAlbumAutoRetouchState = .none
var autoRetouchTemplateId: Int? = nil
var autoRetouchClientRequestId: String = ""
var autoRetouchBatchId: Int = 0
var autoRetouchAttempt: Int = 0
var autoRetouchErrorMessage: String? = nil
/// 是否未上传完成。
var isNotUploaded: Bool {
@@ -31,6 +38,16 @@ struct TravelAlbumOTGPhotoItem: Hashable, Sendable {
}
}
/// OTG 照片自动修图阶段,与原图上传状态独立保存。
enum TravelAlbumAutoRetouchState: String, Codable, Sendable, Equatable, Hashable {
case none = "NONE"
case pendingSubmission = "PENDING_SUBMISSION"
case submitting = "SUBMITTING"
case processing = "PROCESSING"
case completed = "COMPLETED"
case failed = "FAILED"
}
/// OTG 传输页半小时维度时间槽。
struct TravelAlbumOTGTimeSlot: Hashable, Sendable {
let id: String
@@ -85,6 +102,14 @@ enum TravelAlbumOTGTransferMode: String, CaseIterable, Sendable {
self == .liveUpload
}
/// 模式选择 Sheet 的辅助说明。
var detailText: String {
switch self {
case .liveUpload: return "相机拍摄后,照片自动传输并上传到当前相册"
case .postTransfer: return "拍摄完成后,再选择照片批量传输"
}
}
/// 根据展示标题解析传输模式。
static func option(title: String) -> TravelAlbumOTGTransferMode? {
allCases.first { $0.title == title }
@@ -343,7 +368,14 @@ extension TravelAlbumOTGPhotoRecord {
progress: progress,
errorMessage: errorMessage,
localPath: localPath,
remoteUrl: remoteUrl
remoteUrl: remoteUrl,
serverMaterialId: serverMaterialId,
autoRetouchState: autoRetouchState,
autoRetouchTemplateId: autoRetouchTemplateId,
autoRetouchClientRequestId: autoRetouchClientRequestId,
autoRetouchBatchId: autoRetouchBatchId,
autoRetouchAttempt: autoRetouchAttempt,
autoRetouchErrorMessage: autoRetouchErrorMessage
)
}
}