mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-11 02:51:11 +00:00
Order TrustedDevicesView by date
This commit is contained in:
1 parent
e895e7a68e
commit
74226d2fc3
1 file changed
+16
-17
@@ -55,25 +55,24 @@ struct TrustedDevicesView: View {
|
||||
|
||||
|
||||
var devicesView: some View {
|
||||
ForEach(Array(store.trustedCertificates.keys), id: \.self) { key in
|
||||
if let cert = store.trustedCertificates[key] {
|
||||
HStack {
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
LUIText(cert.device.name ?? "Unknown".localized(), isBold: true)
|
||||
LUIText(Self.dateFormatter.string(from: cert.creationDate), color: .mainColor.opacity(0.7))
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
LUIButton {
|
||||
deviceToRemove = key
|
||||
showRemoveAlert = true
|
||||
} label: {
|
||||
ReorderListIcon(imageName: "minus.circle.fill", color: .red)
|
||||
}
|
||||
let entries = store.trustedCertificates.sorted { $0.value.creationDate < $1.value.creationDate }
|
||||
return ForEach(entries, id: \.key) { key, cert in
|
||||
HStack {
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
LUIText(cert.device.name ?? "Unknown".localized(), isBold: true)
|
||||
LUIText(Self.dateFormatter.string(from: cert.creationDate), color: .mainColor.opacity(0.7))
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
LUIButton {
|
||||
deviceToRemove = key
|
||||
showRemoveAlert = true
|
||||
} label: {
|
||||
ReorderListIcon(imageName: "minus.circle.fill", color: .red)
|
||||
}
|
||||
.padding(.vertical, 8)
|
||||
}
|
||||
.padding(.vertical, 8)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user