From ce671044e98ef01942bb78f3c0ccb1069776566f Mon Sep 17 00:00:00 2001 From: Pete Walters Date: Fri, 22 Aug 2025 14:14:47 -0500 Subject: [PATCH] Add an error sheet to failed QuickRestore bootstrap --- ...tionQuickRestoreQRCodeViewController.swift | 26 +++++++++++++++++-- .../translations/en.lproj/Localizable.strings | 6 +++++ SignalUI/Appearance/Theme+Icons.swift | 6 +++++ 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/Signal/Registration/UserInterface/RegistrationQuickRestoreQRCodeViewController.swift b/Signal/Registration/UserInterface/RegistrationQuickRestoreQRCodeViewController.swift index cf10a9eeff..e918207ab7 100644 --- a/Signal/Registration/UserInterface/RegistrationQuickRestoreQRCodeViewController.swift +++ b/Signal/Registration/UserInterface/RegistrationQuickRestoreQRCodeViewController.swift @@ -61,8 +61,30 @@ class RegistrationQuickRestoreQRCodeViewController: let message: RegistrationProvisioningMessage = try await provisioningSocketManager.waitForMessage() presenter?.didReceiveRegistrationMessage(message) } catch { - // TODO: [Backups]: Prompt the user with the error - Logger.error("Encountered error waiting for qick restore message") + let title = OWSLocalizedString( + "REGISTRATION_SCAN_QR_CODE_FAILED_TITLE", + comment: "Title of error notifying restore failed." + ) + let body = OWSLocalizedString( + "REGISTRATION_SCAN_QR_CODE_FAILED_BODY", + comment: "Body of error notifying restore failed." + ) + let sheet = HeroSheetViewController( + hero: .circleIcon( + icon: UIImage(named: "alert")!, + iconSize: 36, + tintColor: UIColor.Signal.label, + backgroundColor: UIColor.Signal.background + ), + title: title, + body: body, + primaryButton: .init(title: CommonStrings.okayButton, action: { [weak self] _ in + self?.provisioningSocketManager.reset() + self?.presentedViewController?.dismiss(animated: true) + }) + ) + sheet.modalPresentationStyle = .formSheet + present(sheet, animated: true) } } } diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index 5e43b43232..ef5db50d7b 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -6955,6 +6955,12 @@ /* No comment provided by engineer. */ "REGISTRATION_RESTRICTED_MESSAGE" = "You need to register before you can send a message."; +/* Body of error notifying restore failed. */ +"REGISTRATION_SCAN_QR_CODE_FAILED_BODY" = "Failed to restore from old device. Try again."; + +/* Title of error notifying restore failed. */ +"REGISTRATION_SCAN_QR_CODE_FAILED_TITLE" = "Restore failed"; + /* Title for screen containing QR code that users scan with their old phone when they want to transfer/restore their message history to a new device. */ "REGISTRATION_SCAN_QR_CODE_TITLE" = "Scan this code with your old phone"; diff --git a/SignalUI/Appearance/Theme+Icons.swift b/SignalUI/Appearance/Theme+Icons.swift index e579552313..e4caade88a 100644 --- a/SignalUI/Appearance/Theme+Icons.swift +++ b/SignalUI/Appearance/Theme+Icons.swift @@ -134,6 +134,8 @@ public enum ThemeIcon: UInt { case composeFindByPhoneNumberLarge case composeInviteLarge + case errorCircle + case check16 case compose16 case error16 @@ -462,6 +464,10 @@ public extension Theme { case .composeInviteLarge: return "invite-resizable" + // Error icon + case .errorCircle: + return "error-circle" + // Compact 16 dp icons case .check16: return "check-compact"