feat: 添加云盘与消息中心功能
This commit is contained in:
@ -89,86 +89,6 @@ struct AvailableOrder: Decodable, Sendable, Equatable, Hashable {
|
||||
}
|
||||
}
|
||||
|
||||
/// 云盘文件/文件夹实体,对齐 Android `CloudFileEntity`。
|
||||
struct CloudFile: Decodable, Sendable, Equatable, Hashable {
|
||||
let id: Int
|
||||
let parentFolderId: Int
|
||||
let fileUrl: String
|
||||
let coverUrl: String
|
||||
let updatedAt: String
|
||||
let name: String
|
||||
let createdAt: String
|
||||
let childNum: Int
|
||||
let type: Int
|
||||
let fileSize: Int64
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case id
|
||||
case parentFolderId = "parent_folder_id"
|
||||
case fileUrl = "file_url"
|
||||
case coverUrl = "cover_url"
|
||||
case updatedAt = "updated_at"
|
||||
case name
|
||||
case createdAt = "created_at"
|
||||
case childNum = "child_num"
|
||||
case type
|
||||
case fileSize = "file_size"
|
||||
}
|
||||
|
||||
init(
|
||||
id: Int = 0,
|
||||
parentFolderId: Int = 0,
|
||||
fileUrl: String = "",
|
||||
coverUrl: String = "",
|
||||
updatedAt: String = "",
|
||||
name: String = "",
|
||||
createdAt: String = "",
|
||||
childNum: Int = 0,
|
||||
type: Int = 0,
|
||||
fileSize: Int64 = 0
|
||||
) {
|
||||
self.id = id
|
||||
self.parentFolderId = parentFolderId
|
||||
self.fileUrl = fileUrl
|
||||
self.coverUrl = coverUrl
|
||||
self.updatedAt = updatedAt
|
||||
self.name = name
|
||||
self.createdAt = createdAt
|
||||
self.childNum = childNum
|
||||
self.type = type
|
||||
self.fileSize = fileSize
|
||||
}
|
||||
|
||||
/// 是否为文件夹。
|
||||
var isFolder: Bool { type == 99 }
|
||||
|
||||
/// 是否为图片。
|
||||
var isImage: Bool { type == 2 }
|
||||
|
||||
/// 是否为视频。
|
||||
var isVideo: Bool { type == 1 }
|
||||
|
||||
/// 是否为可导入的媒体文件。
|
||||
var isSelectableMedia: Bool { isImage || isVideo }
|
||||
}
|
||||
|
||||
/// 云盘列表响应。
|
||||
struct CloudFileListResponse: Decodable, Sendable, Equatable {
|
||||
let total: Int
|
||||
let list: [CloudFile]
|
||||
|
||||
init(total: Int = 0, list: [CloudFile] = []) {
|
||||
self.total = total
|
||||
self.list = list
|
||||
}
|
||||
}
|
||||
|
||||
/// 云盘路径节点,用于面包屑导航。
|
||||
struct CloudPathItem: Sendable, Equatable, Hashable {
|
||||
let id: Int
|
||||
let name: String
|
||||
}
|
||||
|
||||
/// 任务素材来源。
|
||||
enum TaskFileSource: String, Sendable, Equatable {
|
||||
case cloud
|
||||
|
||||
Reference in New Issue
Block a user