diff --git a/Shared/Views/AccountView/AccountView.swift b/Shared/Views/AccountView/AccountView.swift index 4faaeae..517308c 100644 --- a/Shared/Views/AccountView/AccountView.swift +++ b/Shared/Views/AccountView/AccountView.swift @@ -38,38 +38,54 @@ struct AccountView: View { // MARK: - View var body: some View { -// let otherAccounts = accounts.filter({ $0.username != account.username }).map({ $0 }) + let otherAccounts = accounts.filter({ $0.username != account.username }).map({ $0 }) + + let columns: [GridItem] = { + #if os(macOS) + return [.init(), .init()] + #else + return UIDevice.current.userInterfaceIdiom == .pad ? [.init(), .init()] : [.init()] + #endif + }() ScrollView { content -// VStack { -// if !otherAccounts.isEmpty { -// Text("Other Accounts") -// .frame(maxWidth: .infinity, alignment: .leading) -// LazyVStack { -// ForEach(otherAccounts) { account in -// NavigationLink { -// AccountView(account: account) -// } label: { -// GroupBox { -// HStack { -// FaviconView(website: "https://" + account.domain) -// .frame(width: 40, height: 40) -// VStack(alignment: .leading) { -// Text(account.domain) -// .bold() -// .frame(maxWidth: .infinity, alignment: .leading) -// Text(account.username) -// .foregroundColor(Color.secondary) -// } -// } -// } -// }.buttonStyle(.plain) -// } -// } -// } -// }.padding() + VStack { + if !otherAccounts.isEmpty { + Text("Other Accounts") + .font(.title3.bold()) + .frame(maxWidth: .infinity, alignment: .leading) + LazyVGrid(columns: columns) { + ForEach(otherAccounts) { account in + NavigationLink { + AccountView(account: account) + } label: { + GroupBox { + HStack { + if let domain = account.domain { + FaviconView(website: domain) + .frame(width: 40, height: 40) + } + VStack(alignment: .leading) { + Text(account.domain ?? "Unknwon domain") + .bold() + .frame(maxWidth: .infinity, alignment: .leading) + Text(account.username ?? "Unknown email or username") + .foregroundColor(Color.secondary) + } + Spacer() + Image(systemName: "chevron.right") + .foregroundColor(.secondary) + } + } + }.buttonStyle(.plain) + } + } + } + } + .padding() + .frame(maxWidth: 800) } #if os(iOS) .navigationTitle(account.domain?.capitalizingFirstLetter() ?? "") diff --git a/Shared/Views/CardView/CardView.swift b/Shared/Views/CardView/CardView.swift index 5cdbbf6..0add6e4 100644 --- a/Shared/Views/CardView/CardView.swift +++ b/Shared/Views/CardView/CardView.swift @@ -11,9 +11,9 @@ struct CardView: View { // MARK: - Variables let card: Card -#if os(iOS) - @ObservedObject var manager = MotionManager() -#endif +//#if os(iOS) +// @ObservedObject var manager = MotionManager() +//#endif @State private var isShowingNumber: Bool = false @State private var decryptedNumber: String? = nil @@ -130,7 +130,7 @@ struct CardView: View { .frame(width: 400) #else .frame(maxWidth: 400) - .modifier(ParallaxMotionModifier(manager: manager, magnitude: 10)) +// .modifier(ParallaxMotionModifier(manager: manager, magnitude: 10)) #endif } #if os(macOS) diff --git a/Shared/Views/ContentView/ContentView+List.swift b/Shared/Views/ContentView/ContentView+List.swift index c936cae..17e9bc3 100644 --- a/Shared/Views/ContentView/ContentView+List.swift +++ b/Shared/Views/ContentView/ContentView+List.swift @@ -55,6 +55,11 @@ extension ContentView { vaultToBeDeleted = vault shouldDeleteVault.toggle() } + Button("Rename") { + isCreatingNewVault = false + newVaultName = vault.name ?? "" + vaultToBeRenamed = vault + } } .swipeActions { Button("Rename") { diff --git a/Shared/Views/ContentView/ContentView.swift b/Shared/Views/ContentView/ContentView.swift index 43d673f..fac709f 100644 --- a/Shared/Views/ContentView/ContentView.swift +++ b/Shared/Views/ContentView/ContentView.swift @@ -43,6 +43,8 @@ struct ContentView: View { @State var vaultToBeDeleted: Vault? = nil @State var vaultToBeRenamed: Vault? = nil + @State private var showSettings: Bool = false + // MARK: - View var body: some View { NavigationView { @@ -56,11 +58,23 @@ struct ContentView: View { Label("Lock", systemImage: "lock.fill") } #if os(iOS) - NavigationLink { - SettingsView() + Button { + showSettings.toggle() } label: { Label("Settings", systemImage: "gearshape.fill") } + .sheet(isPresented: $showSettings) { + NavigationView { + SettingsView() + .toolbar { + ToolbarItem(placement: .navigationBarTrailing) { + Button("Done") { + showSettings.toggle() + } + } + } + } + } #endif } } diff --git a/Shared/Views/ImportExport/ImportView/ImportView+Import.swift b/Shared/Views/ImportExport/ImportView/ImportView+Import.swift index 4b2da91..dbcb75b 100644 --- a/Shared/Views/ImportExport/ImportView/ImportView+Import.swift +++ b/Shared/Views/ImportExport/ImportView/ImportView+Import.swift @@ -55,7 +55,7 @@ extension ImportView { let account = Account(context: viewContext) account.domain = domain - account.url = url.absoluteString + account.url = url.absoluteString.removeHTTP.removeWWW account.username = importedAccount.username account.otpAuth = importedAccount.otpAuth diff --git a/Shared/Views/Vault/VaultView/VaultView.swift b/Shared/Views/Vault/VaultView/VaultView.swift index 27189c2..79b8af0 100644 --- a/Shared/Views/Vault/VaultView/VaultView.swift +++ b/Shared/Views/Vault/VaultView/VaultView.swift @@ -53,6 +53,7 @@ struct VaultView: View { viewModel.selectedItems.insert(selectedItem) } self._viewModel = StateObject(wrappedValue: viewModel) + } // MARK: - View