aboutsummaryrefslogtreecommitdiff
path: root/Hotline/Models
diff options
context:
space:
mode:
authorDustin Mierau <mierau@users.noreply.github.com>2024-05-01 19:04:19 -0700
committerGitHub <noreply@github.com>2024-05-01 19:04:19 -0700
commita5c1e0b475d14b176479f662bf29163f2220180b (patch)
tree2a458fb29ade4e1c21fa662121bfa88a45c797de /Hotline/Models
parent44dcb81e80e167374e2d3217b81cf0148fa7d66a (diff)
parentc55cae05aeeb629fc9d2939c5f5e935ebc3ac92b (diff)
Merge pull request #14 from jhalter/get-set-file-info
Add Get/Set file info
Diffstat (limited to 'Hotline/Models')
-rw-r--r--Hotline/Models/FileDetails.swift13
-rw-r--r--Hotline/Models/Hotline.swift11
2 files changed, 24 insertions, 0 deletions
diff --git a/Hotline/Models/FileDetails.swift b/Hotline/Models/FileDetails.swift
new file mode 100644
index 0000000..20b1ee2
--- /dev/null
+++ b/Hotline/Models/FileDetails.swift
@@ -0,0 +1,13 @@
+import UniformTypeIdentifiers
+
+struct FileDetails:Identifiable {
+ let id = UUID()
+ var name: String
+ var path: [String]
+ var size: Int
+ var comment: String
+ var type: String
+ var creator: String
+ var created: Date
+ var modified: Date
+}
diff --git a/Hotline/Models/Hotline.swift b/Hotline/Models/Hotline.swift
index baf87eb..cccb4d4 100644
--- a/Hotline/Models/Hotline.swift
+++ b/Hotline/Models/Hotline.swift
@@ -440,6 +440,17 @@ final class Hotline: HotlineClientDelegate, HotlineFileClientDelegate {
}
}
}
+
+ @MainActor func fileDetails(_ fileName: String, path: [String], complete callback: ((FileDetails?) -> Void)? = nil) {
+ var fullPath: [String] = []
+ if path.count > 1 {
+ fullPath = Array(path[0..<path.count-1])
+ }
+
+ self.client.sendGetFileInfo(name: fileName, path: fullPath) { info in
+ callback?(info)
+ }
+ }
@MainActor func previewFile(_ fileName: String, path: [String], complete callback: ((PreviewFileInfo?) -> Void)? = nil) {
var fullPath: [String] = []