将 otg_swift OTG 引擎迁入 Core/CameraOTG,并接入旅拍有线传图与历史导入。
恢复 USB 相机连接、边拍边传、三品牌驱动与 SwiftUI 历史导入页,通过适配层对接现有本地上传与 OSS 管道。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
43
suixinkan/Core/CameraOTG/Bridge/OTGPhotoSink.swift
Normal file
43
suixinkan/Core/CameraOTG/Bridge/OTGPhotoSink.swift
Normal file
@ -0,0 +1,43 @@
|
||||
import Foundation
|
||||
|
||||
/// 边拍边传与历史导入落盘后的照片信息。
|
||||
struct SavedOTGPhoto: Equatable {
|
||||
let assetID: String
|
||||
let relativeLocalPath: String
|
||||
let filename: String
|
||||
let capturedAt: Date
|
||||
}
|
||||
|
||||
/// 边拍边传目标相册上下文,由旅拍有线传图页在 start 前注入 ConnectionManager。
|
||||
struct OTGLiveTransferContext: Equatable {
|
||||
let albumId: Int
|
||||
let accountKey: String
|
||||
weak var photoSink: OTGPhotoSink?
|
||||
|
||||
static func == (lhs: OTGLiveTransferContext, rhs: OTGLiveTransferContext) -> Bool {
|
||||
lhs.albumId == rhs.albumId && lhs.accountKey == rhs.accountKey
|
||||
}
|
||||
}
|
||||
|
||||
/// OTG 照片落盘协议:品牌 LiveCapture 与历史导入均通过此接口写入业务存储。
|
||||
@MainActor
|
||||
protocol OTGPhotoSink: AnyObject {
|
||||
/// 保存边拍边传下载的图像数据。
|
||||
func saveLiveShot(
|
||||
data: Data,
|
||||
filename: String,
|
||||
capturedAt: Date,
|
||||
cameraObjectID: String
|
||||
) async throws -> SavedOTGPhoto
|
||||
|
||||
/// 保存历史导入已下载到本地的文件。
|
||||
func saveDownloadedFile(
|
||||
at url: URL,
|
||||
filename: String,
|
||||
capturedAt: Date,
|
||||
cameraObjectID: String
|
||||
) async throws -> SavedOTGPhoto
|
||||
|
||||
/// 当前相册已导入的相机对象 ID,用于历史导入去重。
|
||||
func existingCameraObjectIDs() async -> Set<String>
|
||||
}
|
||||
Reference in New Issue
Block a user