Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 🗓️ Show file modification dates #27

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Reconnect/PLP/FileServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class FileServer {
let name: String
let size: UInt32
let attributes: FileAttributes
let modificationDate: Date

func hash(into hasher: inout Hasher) {
hasher.combine(path)
Expand Down Expand Up @@ -102,10 +103,15 @@ class FileServer {
filePath = path + name
}

var modificationTime = entry.getPsiTime()
let modificationTimeInterval = TimeInterval(modificationTime.getTime())
let modificationDate = Date(timeIntervalSince1970: modificationTimeInterval)

entries.append(DirectoryEntry(path: filePath,
name: name,
size: entry.getSize(),
attributes: attributes))
attributes: attributes,
modificationDate: modificationDate))
}
return entries
}
Expand Down
4 changes: 4 additions & 0 deletions Reconnect/Views/BrowserView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ struct BrowserView: View {
}
.width(16.0)
TableColumn("Name", value: \.name)
TableColumn("Date Modified") { file in
Text(file.modificationDate.formatted(date: .long, time: .shortened))
.foregroundStyle(.secondary)
}
TableColumn("Size") { file in
Text(String(file.size))
}
Expand Down