Skip to content

Commit

Permalink
Update description label in share view
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <[email protected]>
  • Loading branch information
claucambra committed Apr 6, 2024
1 parent da6406e commit 153e5c0
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,21 @@ class ShareViewController: NSViewController, ShareViewDataSourceUIDelegate {
}
}
fileNameIcon.image = fileThumbnail?.nsImage

let resourceValues = try? itemUrl.resourceValues(
forKeys: [.fileSizeKey, .contentModificationDateKey]
)
var sizeDesc = "Unknown size"
var modDesc = "Unknown modification date"
if let fileSize = resourceValues?.fileSize {
sizeDesc = ByteCountFormatter().string(fromByteCount: Int64(fileSize))
}
if let modificationDate = resourceValues?.contentModificationDate {
modDesc = DateFormatter.localizedString(
from: modificationDate, dateStyle: .short, timeStyle: .short
)
}
descriptionLabel.stringValue = "\(sizeDesc) · \(modDesc)"
}

@IBAction func dismissError(_ sender: Any) {
Expand Down

0 comments on commit 153e5c0

Please sign in to comment.