mirror of
				https://github.com/maxgoedjen/secretive.git
				synced 2025-11-04 09:20:56 +00:00 
			
		
		
		
	Basic no stores view (#66)
This commit is contained in:
		
							parent
							
								
									a6fbcdbe55
								
							
						
					
					
						commit
						7481498c5b
					
				@ -20,6 +20,10 @@ public class SecretStoreList: ObservableObject {
 | 
			
		||||
        addInternal(store: modifiable)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public var anyAvailable: Bool {
 | 
			
		||||
        stores.reduce(false, { $0 || $1.isAvailable })
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
extension SecretStoreList {
 | 
			
		||||
 | 
			
		||||
@ -27,6 +27,7 @@
 | 
			
		||||
		50617DD023FCED2C0099B055 /* SecureEnclave.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50617DCF23FCED2C0099B055 /* SecureEnclave.swift */; };
 | 
			
		||||
		50617DD223FCEFA90099B055 /* PreviewStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50617DD123FCEFA90099B055 /* PreviewStore.swift */; };
 | 
			
		||||
		506772C72424784600034DED /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 506772C62424784600034DED /* Credits.rtf */; };
 | 
			
		||||
		506772C92425BB8500034DED /* NoStoresView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 506772C82425BB8500034DED /* NoStoresView.swift */; };
 | 
			
		||||
		5068389E241471CD00F55094 /* SecretStoreList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5068389D241471CD00F55094 /* SecretStoreList.swift */; };
 | 
			
		||||
		506838A12415EA5600F55094 /* AnySecret.swift in Sources */ = {isa = PBXBuildFile; fileRef = 506838A02415EA5600F55094 /* AnySecret.swift */; };
 | 
			
		||||
		506838A32415EA5D00F55094 /* AnySecretStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 506838A22415EA5D00F55094 /* AnySecretStore.swift */; };
 | 
			
		||||
@ -201,6 +202,7 @@
 | 
			
		||||
		50617DCF23FCED2C0099B055 /* SecureEnclave.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureEnclave.swift; sourceTree = "<group>"; };
 | 
			
		||||
		50617DD123FCEFA90099B055 /* PreviewStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreviewStore.swift; sourceTree = "<group>"; };
 | 
			
		||||
		506772C62424784600034DED /* Credits.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = Credits.rtf; sourceTree = "<group>"; };
 | 
			
		||||
		506772C82425BB8500034DED /* NoStoresView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoStoresView.swift; sourceTree = "<group>"; };
 | 
			
		||||
		5068389D241471CD00F55094 /* SecretStoreList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecretStoreList.swift; sourceTree = "<group>"; };
 | 
			
		||||
		506838A02415EA5600F55094 /* AnySecret.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnySecret.swift; sourceTree = "<group>"; };
 | 
			
		||||
		506838A22415EA5D00F55094 /* AnySecretStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnySecretStore.swift; sourceTree = "<group>"; };
 | 
			
		||||
@ -434,6 +436,7 @@
 | 
			
		||||
				5099A02323FD2AAA0062B6F2 /* CreateSecretView.swift */,
 | 
			
		||||
				50B8550C24138C4F009958AC /* DeleteSecretView.swift */,
 | 
			
		||||
				50BB046A2418AAAE00D6E079 /* EmptyStoreView.swift */,
 | 
			
		||||
				506772C82425BB8500034DED /* NoStoresView.swift */,
 | 
			
		||||
				50C385A8240B636500AF2719 /* SetupView.swift */,
 | 
			
		||||
			);
 | 
			
		||||
			path = Views;
 | 
			
		||||
@ -811,6 +814,7 @@
 | 
			
		||||
				50BB046B2418AAAE00D6E079 /* EmptyStoreView.swift in Sources */,
 | 
			
		||||
				50731669241E00C20023809E /* NoticeView.swift in Sources */,
 | 
			
		||||
				50617D8323FCE48E0099B055 /* AppDelegate.swift in Sources */,
 | 
			
		||||
				506772C92425BB8500034DED /* NoStoresView.swift in Sources */,
 | 
			
		||||
				508A58B5241ED48F0069DC07 /* PreviewAgentStatusChecker.swift in Sources */,
 | 
			
		||||
				508A58AA241E06B40069DC07 /* PreviewUpdater.swift in Sources */,
 | 
			
		||||
			);
 | 
			
		||||
 | 
			
		||||
@ -20,6 +20,7 @@ struct ContentView<UpdaterType: UpdaterProtocol, AgentStatusCheckerType: AgentSt
 | 
			
		||||
            if !agentStatusChecker.running {
 | 
			
		||||
                agentNotice()
 | 
			
		||||
            }
 | 
			
		||||
            if storeList.anyAvailable {
 | 
			
		||||
            NavigationView {
 | 
			
		||||
                List(selection: $active) {
 | 
			
		||||
                    ForEach(storeList.stores) { store in
 | 
			
		||||
@ -68,6 +69,9 @@ struct ContentView<UpdaterType: UpdaterProtocol, AgentStatusCheckerType: AgentSt
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            } else {
 | 
			
		||||
                NoStoresView()
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										29
									
								
								Secretive/Views/NoStoresView.swift
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								Secretive/Views/NoStoresView.swift
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,29 @@
 | 
			
		||||
//
 | 
			
		||||
//  NoStoresView.swift
 | 
			
		||||
//  Secretive
 | 
			
		||||
//
 | 
			
		||||
//  Created by Max Goedjen on 3/20/20.
 | 
			
		||||
//  Copyright © 2020 Max Goedjen. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
import SwiftUI
 | 
			
		||||
 | 
			
		||||
struct NoStoresView: View {
 | 
			
		||||
    var body: some View {
 | 
			
		||||
        VStack {
 | 
			
		||||
            Text("No Secure Storage Available").bold()
 | 
			
		||||
            Text("Your Mac doesn't have a Secure Enclave, and there's not a compatible Smart Card inserted.")
 | 
			
		||||
            Button(action: {
 | 
			
		||||
                NSWorkspace.shared.open(URL(string: "https://www.yubico.com/products/compare-yubikey-5-series/")!)
 | 
			
		||||
            }) {
 | 
			
		||||
                Text("If you're looking to add one to your Mac, the YubiKey 5 Series are great.")
 | 
			
		||||
            }
 | 
			
		||||
        }.padding()
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
struct NoStoresView_Previews: PreviewProvider {
 | 
			
		||||
    static var previews: some View {
 | 
			
		||||
        NoStoresView()
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user