完善 OTG 相机有线传图:支持 Sony/Canon 自动识别,页面 detach 保持会话以便再次进入复连。
引入进程级 CameraTetheringSession 与共享 USB Browser;离开传图页仅取消 UI 回调,App 终止时再完整 shutdown 释放 PTP 与 Browser 资源。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@ -27,7 +27,17 @@ protocol CameraServiceProtocol: AnyObject {
|
||||
var onNewAsset: ((CameraAsset) -> Void)? { get set }
|
||||
|
||||
func connect() async
|
||||
func disconnect() async
|
||||
/// 页面离开:仅清空 UI 回调,不关闭相机会话。
|
||||
func detachFromUI()
|
||||
/// App 终止或物理断开:完整释放相机资源。
|
||||
func shutdown() async
|
||||
func listAssets() async throws -> [CameraAsset]
|
||||
func downloadAsset(_ asset: CameraAsset) async throws -> URL
|
||||
}
|
||||
|
||||
extension CameraServiceProtocol {
|
||||
/// 兼容旧调用,语义等同 `shutdown()`。
|
||||
func disconnect() async {
|
||||
await shutdown()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user