From 3376e66082854a1b691e81626e7d92a0c727c00d Mon Sep 17 00:00:00 2001 From: Milen Pivchev Date: Wed, 25 Mar 2026 17:37:34 +0100 Subject: [PATCH] Use new login API Signed-off-by: Milen Pivchev --- .swiftlint.yml | 4 ++++ iOCNotes/Store.swift | 4 ---- iOCNotes/Views/ContentView.swift | 17 ++++++++++++----- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.swiftlint.yml b/.swiftlint.yml index a6a1ab8a..785534f6 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -40,5 +40,9 @@ large_tuple: warning: 4 error: 6 +type_body_length: + warning: 300 + error: 400 + switch_case_alignment: indented_cases: true diff --git a/iOCNotes/Store.swift b/iOCNotes/Store.swift index 05e46674..9eecc09a 100644 --- a/iOCNotes/Store.swift +++ b/iOCNotes/Store.swift @@ -297,11 +297,7 @@ final class Store: Logging, Storing { KeychainHelper.syncOnStart = newValue } } -} - -// MARK: - ServerAddressViewDelegate -extension Store: ServerAddressViewDelegate { private func getResponse(endpoint: URL, token: String, options: NKRequestOptions) async -> (url: String, user: String, appPassword: String)? { logger.debug("Getting login flow status...") diff --git a/iOCNotes/Views/ContentView.swift b/iOCNotes/Views/ContentView.swift index 30a833ca..84f6ec79 100644 --- a/iOCNotes/Views/ContentView.swift +++ b/iOCNotes/Views/ContentView.swift @@ -35,11 +35,18 @@ struct ContentView: View { var body: some View { if store.accounts.isEmpty { - ServerAddressView(backgroundColor: .constant(Color.accent), brandImage: Image("BrandLogo"), delegate: store, sharedAccounts: sharedAccounts, userAgent: userAgent) - .onAppear { - // The store must update its list of shared accounts when the login user interface is about to appear. - store.readSharedAccounts() - } + ServerAddressView(backgroundColor: .constant(Color.accent), brandImage: Image("BrandLogo"), sharedAccounts: sharedAccounts, userAgent: userAgent) { host, name, password in + store.addAccount(host: host, name: name, password: password) + } beginPolling: { url, _ in + try await store.beginPolling(at: url) + } cancelPolling: { token in + store.cancelPolling(by: token) + } + .onAppear { + // The store must update its list of shared accounts when the login user interface is about to appear. + store.readSharedAccounts() + } + } else { TabView(selection: $selection) { NavigationStack {