新增ai修图
This commit is contained in:
@ -52,6 +52,12 @@ struct TravelAlbumOTGPhotoSection: Hashable, Sendable {
|
||||
let photos: [TravelAlbumOTGPhotoItem]
|
||||
}
|
||||
|
||||
/// 有线传输照片预览上下文,保存可预览照片顺序和点击照片位置。
|
||||
struct TravelAlbumOTGPhotoPreviewContext: Equatable, Sendable {
|
||||
let photos: [TravelAlbumOTGPhotoItem]
|
||||
let initialIndex: Int
|
||||
}
|
||||
|
||||
/// OTG 传输页 Tab。
|
||||
enum TravelAlbumOTGTransferTab: Int, CaseIterable, Sendable {
|
||||
case all
|
||||
@ -80,6 +86,16 @@ enum TravelAlbumOTGTransferMode: String, CaseIterable, Sendable {
|
||||
}
|
||||
}
|
||||
|
||||
/// 模式选择弹窗中的业务说明。
|
||||
var detailText: String {
|
||||
switch self {
|
||||
case .liveUpload:
|
||||
return "相机拍摄后,照片自动传输并上传到当前相册"
|
||||
case .postTransfer:
|
||||
return "拍摄完成后,再选择照片批量传输"
|
||||
}
|
||||
}
|
||||
|
||||
/// 是否在新照片导入 App 后自动上传。
|
||||
var shouldAutoUploadNewImports: Bool {
|
||||
self == .liveUpload
|
||||
@ -113,6 +129,18 @@ extension TravelAlbumOTGPhotoItem {
|
||||
}
|
||||
|
||||
extension Array where Element == TravelAlbumOTGPhotoItem {
|
||||
/// 按当前列表顺序生成预览上下文,不可预览照片不会占用左右滑动页码。
|
||||
func previewContext(startingWith photoID: String) -> TravelAlbumOTGPhotoPreviewContext? {
|
||||
let previewablePhotos = filter { $0.thumbnailURL != nil }
|
||||
guard let initialIndex = previewablePhotos.firstIndex(where: { $0.id == photoID }) else {
|
||||
return nil
|
||||
}
|
||||
return TravelAlbumOTGPhotoPreviewContext(
|
||||
photos: previewablePhotos,
|
||||
initialIndex: initialIndex
|
||||
)
|
||||
}
|
||||
|
||||
/// 按 Android OTG 页规则构造半小时照片分段。
|
||||
func buildPhotoSections() -> [TravelAlbumOTGPhotoSection] {
|
||||
let pairs = compactMap { photo -> (slotStart: Date, photo: TravelAlbumOTGPhotoItem)? in
|
||||
|
||||
Reference in New Issue
Block a user