Remove changes

This commit is contained in:
Max Goedjen
2020-03-07 15:20:59 -08:00
parent 8863a42308
commit 734df29065
5 changed files with 29 additions and 27 deletions

View File

@@ -15,7 +15,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
func applicationDidFinishLaunching(_ aNotification: Notification) {
let contentView = ContentView(store: secureEnclave)
let contentView = ContentView(secureEnclave: secureEnclave, smartCard: smartCard)
// Create the window and set the content view.
window = NSWindow(
contentRect: NSRect(x: 0, y: 0, width: 480, height: 300),

View File

@@ -3,8 +3,9 @@ import SecretKit
struct ContentView: View {
@ObservedObject var store: SecureEnclave.Store
@State var active: SecureEnclave.Secret.ID?
@ObservedObject var secureEnclave: SecureEnclave.Store
@ObservedObject var smartCard: SmartCard.Store
@State var active: Data?
@State var showingDeletion = false
@State var deletingSecret: SecureEnclave.Secret?
@@ -12,8 +13,8 @@ struct ContentView: View {
var body: some View {
NavigationView {
List(selection: $active) {
Section(header: Text(store.name)) {
ForEach(store.secrets) { secret in
Section(header: Text(secureEnclave.name)) {
ForEach(secureEnclave.secrets) { secret in
NavigationLink(destination: SecretDetailView(secret: secret), tag: secret.id, selection: self.$active) {
Text(secret.name)
}.contextMenu {
@@ -23,15 +24,22 @@ struct ContentView: View {
}
}
}
Section(header: Text(smartCard.name)) {
ForEach(smartCard.secrets) { secret in
NavigationLink(destination: SecretDetailView(secret: secret), tag: secret.id, selection: self.$active) {
Text(secret.name)
}
}
}
}.onAppear {
self.active = self.store.secrets.first?.id
self.active = self.secureEnclave.secrets.first?.id ?? self.smartCard.secrets.first?.id
}
.listStyle(SidebarListStyle())
.frame(minWidth: 100, idealWidth: 240)
}
.navigationViewStyle(DoubleColumnNavigationViewStyle())
.sheet(isPresented: $showingDeletion) {
DeleteSecretView(secret: self.deletingSecret!, store: self.store) {
DeleteSecretView(secret: self.deletingSecret!, store: self.secureEnclave) {
self.showingDeletion = false
}
}