优化有线传图页设备展示,并缓存传输模式选项。
未连接状态改为「未连接相机」;设备型号映射为可读名称而非 iPhone12,1 等内部代号;边拍边传/拍后传输按账号持久化并在下次进入时恢复。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@ -16,6 +16,31 @@ final class WiredTransferPhotoStore {
|
||||
private static let keyPrefix = "wired_transfer_photos_"
|
||||
private static let deletedSuffix = "_deleted"
|
||||
private static let bindingsSuffix = "_photo_bindings"
|
||||
private static let transferModeKeySuffix = "wired_transfer_mode_option"
|
||||
static let modeLiveCapture = "边拍边传"
|
||||
static let modePostShootTransfer = "拍后传输"
|
||||
|
||||
/// 读取缓存的传输模式选项。
|
||||
func loadTransferModeOption() -> String? {
|
||||
let value = defaults.string(forKey: transferModeKey())?
|
||||
.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
|
||||
switch value {
|
||||
case Self.modeLiveCapture, Self.modePostShootTransfer:
|
||||
return value
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
/// 缓存传输模式选项。
|
||||
func saveTransferModeOption(_ option: String) {
|
||||
switch option {
|
||||
case Self.modeLiveCapture, Self.modePostShootTransfer:
|
||||
defaults.set(option, forKey: transferModeKey())
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
/// 初始化仓库,注入账号前缀与用户 ID 提供者。
|
||||
init(
|
||||
@ -187,6 +212,10 @@ final class WiredTransferPhotoStore {
|
||||
"\(accountPrefixProvider())\(Self.bindingsSuffix)"
|
||||
}
|
||||
|
||||
private func transferModeKey() -> String {
|
||||
"\(accountPrefixProvider())\(Self.transferModeKeySuffix)"
|
||||
}
|
||||
|
||||
private struct PhotoAlbumBinding: Codable {
|
||||
let photoID: String
|
||||
let albumID: Int
|
||||
|
||||
Reference in New Issue
Block a user