From 95753e3fa9e200c201c4642db3f4d8fcee3da267 Mon Sep 17 00:00:00 2001 From: Leendert de Borst Date: Mon, 13 Oct 2025 21:04:48 +0200 Subject: [PATCH] Add explicit server offline error message to passkey create flow (#520) --- ...entialProviderViewController+Passkey.swift | 43 ++++++++++++++++-- .../ios/Autofill/en.lproj/Localizable.strings | Bin 1980 -> 2548 bytes 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/apps/mobile-app/ios/Autofill/CredentialProviderViewController+Passkey.swift b/apps/mobile-app/ios/Autofill/CredentialProviderViewController+Passkey.swift index fe4e09ae0..a955ff8a8 100644 --- a/apps/mobile-app/ios/Autofill/CredentialProviderViewController+Passkey.swift +++ b/apps/mobile-app/ios/Autofill/CredentialProviderViewController+Passkey.swift @@ -334,10 +334,21 @@ extension CredentialProviderViewController: PasskeyProviderDelegate { // Initialize WebApiService for vault sync/mutate and favicon extraction let webApiService = WebApiService() - // Step 1: Sync vault before creating passkey (to avoid conflicts) - viewModel.setLoading(true, message: NSLocalizedString("creating_passkey", comment: "Syncing vault...")) + // Step 1: Check server connectivity by syncing vault before creating passkey + viewModel.setLoading(true, message: NSLocalizedString("checking_connection", comment: "Checking connection...")) - try _ = await vaultStore.syncVault(using: webApiService) + do { + try _ = await vaultStore.syncVault(using: webApiService) + } catch { + // Server connectivity check failed + viewModel.setLoading(false) + + // Show error dialog to user + await MainActor.run { + self.showConnectivityErrorAlert(viewModel: viewModel) + } + return + } // Step 2: Extract favicon from service URL var logo: Data? @@ -610,4 +621,30 @@ extension CredentialProviderViewController: PasskeyProviderDelegate { return nil } + + /** + * Show connectivity error alert dialog + */ + private func showConnectivityErrorAlert(viewModel: PasskeyRegistrationViewModel) { + let alert = UIAlertController( + title: NSLocalizedString("connection_error_title", comment: "Connection Error"), + message: NSLocalizedString("connection_error_message", comment: "No connection to the server can be made."), + preferredStyle: .alert + ) + + alert.addAction(UIAlertAction( + title: NSLocalizedString("ok", comment: "OK"), + style: .default, + handler: { _ in + // User acknowledged the error - stay on the passkey registration screen + } + )) + + // Present the alert + if let currentController = self.currentHostingController { + currentController.present(alert, animated: true) + } else { + self.present(alert, animated: true) + } + } } diff --git a/apps/mobile-app/ios/Autofill/en.lproj/Localizable.strings b/apps/mobile-app/ios/Autofill/en.lproj/Localizable.strings index 3320eaf137e7597e112fc2562ef9d0f5b720c71b..6da9cfe859ec8e439c9cf4aa3b6e325f43d80c0f 100644 GIT binary patch delta 513 zcmZ{gL2AN47=@p!f*TjTz>qG4EYbr=S0e68ZxGTX)S@P$Q^8fvAYJqtJwR^Ybv!`7 ze?(Cl877&T_ul^=uN@p8f7^$quV=+_8mm^tDwWIYQ(Lyz4y4qYRkJtTV)%VUux|Nw zORuM&BA7`5>XBJ>IsXzfE40!_Ku+;i nylz-?aARhmSzsm9bnf6B=A=$F?P~qH-CIF-%tXoePw(juawTAB delta 7 Ocmew&yoZ0o9(Di@oC8Jx