Skip to content

Commit 8c308aa

Browse files
Merge pull request #215 from nextcloud/trash
Trash - improved
2 parents 6f25e10 + f749846 commit 8c308aa

2 files changed

Lines changed: 27 additions & 3 deletions

File tree

Sources/NextcloudKit/Models/NKProperties.swift

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,14 @@ public enum NKProperties: String, CaseIterable {
7878
}
7979

8080
static func trashProperties() -> String {
81-
let properties: [String] = [displayname.rawValue, getcontenttype.rawValue, resourcetype.rawValue, id.rawValue, fileid.rawValue, size.rawValue, haspreview.rawValue, "<trashbin-filename xmlns=\"http://nextcloud.org/ns\"/>", "<trashbin-original-location xmlns=\"http://nextcloud.org/ns\"/>", "<trashbin-deletion-time xmlns=\"http://nextcloud.org/ns\"/>"]
82-
return properties.joined()
81+
let base = allCases.map { $0.rawValue }.joined()
82+
83+
let trashExtras = [
84+
"<trashbin-filename xmlns=\"http://nextcloud.org/ns\"/>",
85+
"<trashbin-original-location xmlns=\"http://nextcloud.org/ns\"/>",
86+
"<trashbin-deletion-time xmlns=\"http://nextcloud.org/ns\"/>"
87+
].joined()
88+
89+
return base + trashExtras
8390
}
8491
}

Sources/NextcloudKit/Models/NKTrash.swift

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,27 @@ public struct NKTrash: Sendable {
2121
public var iconName: String
2222
public var size: Int64
2323
public var classFile: String
24+
public var livePhoto: Bool
2425
public var trashbinFileName: String
2526
public var trashbinOriginalLocation: String
2627
public var trashbinDeletionTime: Date
2728

28-
public init(ocId: String = "", contentType: String = "", typeIdentifier: String = "", date: Date = Date(), directory: Bool = false, fileId: String = "", fileName: String = "", filePath: String = "", hasPreview: Bool = false, iconName: String = "", size: Int64 = 0, classFile: String = "", trashbinFileName: String = "", trashbinOriginalLocation: String = "", trashbinDeletionTime: Date = Date()) {
29+
public init(ocId: String = "",
30+
contentType: String = "",
31+
typeIdentifier: String = "",
32+
date: Date = Date(),
33+
directory: Bool = false,
34+
fileId: String = "",
35+
fileName: String = "",
36+
filePath: String = "",
37+
hasPreview: Bool = false,
38+
iconName: String = "",
39+
size: Int64 = 0,
40+
classFile: String = "",
41+
livePhoto: Bool = false,
42+
trashbinFileName: String = "",
43+
trashbinOriginalLocation: String = "",
44+
trashbinDeletionTime: Date = Date()) {
2945
self.ocId = ocId
3046
self.contentType = contentType
3147
self.typeIdentifier = typeIdentifier
@@ -38,6 +54,7 @@ public struct NKTrash: Sendable {
3854
self.iconName = iconName
3955
self.size = size
4056
self.classFile = classFile
57+
self.livePhoto = livePhoto
4158
self.trashbinFileName = trashbinFileName
4259
self.trashbinOriginalLocation = trashbinOriginalLocation
4360
self.trashbinDeletionTime = trashbinDeletionTime

0 commit comments

Comments
 (0)