feat: 优化云盘工作区与批量文件工具
This commit is contained in:
@@ -145,8 +145,11 @@ struct CloudFile: Identifiable, Hashable, Sendable {
|
||||
var subDirectoryCount: Int?
|
||||
var subFileCount: Int?
|
||||
var modifiedAt: String
|
||||
var cloudPath: String
|
||||
let fileType: Int
|
||||
|
||||
var pathDepth: Int { cloudPath.split(separator: "/").count }
|
||||
|
||||
var icon: String {
|
||||
if isDirectory { return "folder.fill" }
|
||||
switch fileType {
|
||||
@@ -195,6 +198,7 @@ struct CloudFile: Identifiable, Hashable, Sendable {
|
||||
// Keep it as zero rather than “unknown”, so it sorts and renders correctly.
|
||||
if isDirectory, size == nil { size = 0 }
|
||||
modifiedAt = json.firstString(["updateTime", "updatedAt", "modifyTime", "createTime"]) ?? json.firstInt64Deep(["utime", "ctime"]).map(formatFileDate) ?? ""
|
||||
cloudPath = json.firstString(["location", "path", "fullPath"]) ?? name
|
||||
fileType = type
|
||||
}
|
||||
}
|
||||
@@ -373,6 +377,29 @@ struct ScanProgress: Sendable {
|
||||
var filesVisited = 0
|
||||
}
|
||||
|
||||
struct ScanDeletionProgress: Sendable {
|
||||
var phase = ""
|
||||
var completed = 0
|
||||
var total = 0
|
||||
}
|
||||
|
||||
struct BatchRenameChange: Identifiable, Sendable {
|
||||
let file: CloudFile
|
||||
let newName: String
|
||||
var id: String { file.id }
|
||||
}
|
||||
|
||||
struct BatchRenameProgress: Sendable {
|
||||
var currentName = ""
|
||||
var completed = 0
|
||||
var total = 0
|
||||
}
|
||||
|
||||
struct BatchRenameExecutionResult: Sendable {
|
||||
let succeeded: Int
|
||||
let failed: Int
|
||||
}
|
||||
|
||||
enum FileSort: String, CaseIterable, Identifiable, Sendable {
|
||||
case name, size, modifiedAt, createdAt, type
|
||||
var id: String { rawValue }
|
||||
|
||||
Reference in New Issue
Block a user