diff --git a/Secretive.xcodeproj/project.pbxproj b/Secretive.xcodeproj/project.pbxproj index d68adc4..bd45ff3 100644 --- a/Secretive.xcodeproj/project.pbxproj +++ b/Secretive.xcodeproj/project.pbxproj @@ -49,7 +49,7 @@ 50A5C18F240E4B4C00E2996C /* SecretKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50617DA823FCE4AB0099B055 /* SecretKit.framework */; }; 50A5C190240E4B4C00E2996C /* SecretKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 50617DA823FCE4AB0099B055 /* SecretKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 50B8550D24138C4F009958AC /* DeleteSecretView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50B8550C24138C4F009958AC /* DeleteSecretView.swift */; }; - 50BB046B2418AAAE00D6E079 /* EmptySecureEnclaveView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50BB046A2418AAAE00D6E079 /* EmptySecureEnclaveView.swift */; }; + 50BB046B2418AAAE00D6E079 /* EmptyStoreView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50BB046A2418AAAE00D6E079 /* EmptyStoreView.swift */; }; 50C385A3240789E600AF2719 /* OpenSSHReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50C385A2240789E600AF2719 /* OpenSSHReader.swift */; }; 50C385A52407A76D00AF2719 /* SecretDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50C385A42407A76D00AF2719 /* SecretDetailView.swift */; }; 50C385A9240B636500AF2719 /* SetupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50C385A8240B636500AF2719 /* SetupView.swift */; }; @@ -200,7 +200,7 @@ 50A3B79D24026B9900D209EA /* SocketController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SocketController.swift; sourceTree = ""; }; 50A3B79F24026B9900D209EA /* Agent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Agent.swift; sourceTree = ""; }; 50B8550C24138C4F009958AC /* DeleteSecretView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DeleteSecretView.swift; sourceTree = ""; }; - 50BB046A2418AAAE00D6E079 /* EmptySecureEnclaveView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmptySecureEnclaveView.swift; sourceTree = ""; }; + 50BB046A2418AAAE00D6E079 /* EmptyStoreView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmptyStoreView.swift; sourceTree = ""; }; 50C385A2240789E600AF2719 /* OpenSSHReader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = OpenSSHReader.swift; path = SecretKit/Common/OpenSSH/OpenSSHReader.swift; sourceTree = SOURCE_ROOT; }; 50C385A42407A76D00AF2719 /* SecretDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecretDetailView.swift; sourceTree = ""; }; 50C385A8240B636500AF2719 /* SetupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SetupView.swift; sourceTree = ""; }; @@ -301,7 +301,7 @@ 50C385A42407A76D00AF2719 /* SecretDetailView.swift */, 5099A02323FD2AAA0062B6F2 /* CreateSecretView.swift */, 50B8550C24138C4F009958AC /* DeleteSecretView.swift */, - 50BB046A2418AAAE00D6E079 /* EmptySecureEnclaveView.swift */, + 50BB046A2418AAAE00D6E079 /* EmptyStoreView.swift */, 50C385A8240B636500AF2719 /* SetupView.swift */, 50617D8623FCE48E0099B055 /* Assets.xcassets */, 50617D8B23FCE48E0099B055 /* Main.storyboard */, @@ -736,7 +736,7 @@ 50C385A52407A76D00AF2719 /* SecretDetailView.swift in Sources */, 5099A02423FD2AAA0062B6F2 /* CreateSecretView.swift in Sources */, 50B8550D24138C4F009958AC /* DeleteSecretView.swift in Sources */, - 50BB046B2418AAAE00D6E079 /* EmptySecureEnclaveView.swift in Sources */, + 50BB046B2418AAAE00D6E079 /* EmptyStoreView.swift in Sources */, 50617D8323FCE48E0099B055 /* AppDelegate.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Secretive/ContentView.swift b/Secretive/ContentView.swift index e824d00..9d6159b 100644 --- a/Secretive/ContentView.swift +++ b/Secretive/ContentView.swift @@ -15,13 +15,25 @@ struct ContentView: View { ForEach(storeList.stores) { store in if store.isAvailable { Section(header: Text(store.name)) { - ForEach(store.secrets) { secret in - NavigationLink(destination: SecretDetailView(secret: secret), tag: secret.id, selection: self.$active) { - Text(secret.name) - }.contextMenu { - if store is AnySecretStoreModifiable { - Button(action: { self.delete(secret: secret) }) { - Text("Delete") + if store.secrets.isEmpty { + if store is AnySecretStoreModifiable { + NavigationLink(destination: EmptyStoreModifiableView()) { + Text("No Secrets") + } + } else { + NavigationLink(destination: EmptyStoreView()) { + Text("No Secrets") + } + } + } else { + ForEach(store.secrets) { secret in + NavigationLink(destination: SecretDetailView(secret: secret), tag: secret.id, selection: self.$active) { + Text(secret.name) + }.contextMenu { + if store is AnySecretStoreModifiable { + Button(action: { self.delete(secret: secret) }) { + Text("Delete") + } } } } diff --git a/Secretive/EmptySecureEnclaveView.swift b/Secretive/EmptySecureEnclaveView.swift deleted file mode 100644 index 8fe058f..0000000 --- a/Secretive/EmptySecureEnclaveView.swift +++ /dev/null @@ -1,9 +0,0 @@ -import SwiftUI - -struct EmptySecureEnclaveView: View { - - var body: some View { - Text("Create a new one.") - } - -} diff --git a/Secretive/EmptyStoreView.swift b/Secretive/EmptyStoreView.swift new file mode 100644 index 0000000..f7d1bae --- /dev/null +++ b/Secretive/EmptyStoreView.swift @@ -0,0 +1,53 @@ +import SwiftUI + +struct EmptyStoreView: View { + + var body: some View { + VStack { + Text("No Secrets").bold() + Text("Use your Smart Card's management tool to create a secret.") + Text("Secretive only supports Elliptic Curve keys.") + }.frame(maxWidth: .infinity, maxHeight: .infinity) + } + +} + +struct EmptyStoreModifiableView: View { + + var body: some View { + VStack { + GeometryReader { g in + Path { path in + path.move(to: CGPoint(x: g.size.width / 2, y: g.size.height)) + path.addCurve(to: + CGPoint(x: g.size.width * (3/4), y: g.size.height * (1/2)), control1: + CGPoint(x: g.size.width / 2, y: g.size.height * (1/2)), control2: + CGPoint(x: g.size.width * (3/4), y: g.size.height * (1/2))) + path.addCurve(to: + CGPoint(x: g.size.width, y: 0), control1: + CGPoint(x: g.size.width, y: g.size.height * (1/2)), control2: + CGPoint(x: g.size.width, y: 0)) + }.stroke(style: StrokeStyle(lineWidth: 5, lineCap: .round)) + Path { path in + path.move(to: CGPoint(x: g.size.width - 10, y: 0)) + path.addLine(to: CGPoint(x: g.size.width, y: -10)) + path.addLine(to: CGPoint(x: g.size.width + 10, y: 0)) + }.fill() + }.frame(height: 100).padding() + Text("No Secrets").bold() + Text("Create a new one by clicking here.") + Spacer() + }.frame(maxWidth: .infinity, maxHeight: .infinity) + } + +} + +struct EmptyStoreModifiableView_Previews: PreviewProvider { + static var previews: some View { + Group { + EmptyStoreView() + EmptyStoreModifiableView() + + } + } +}