Add an error sheet to failed QuickRestore bootstrap

This commit is contained in:
Pete Walters 2025-08-22 14:14:47 -05:00 committed by GitHub
parent 34536f3d0c
commit ce671044e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 36 additions and 2 deletions

View File

@ -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)
}
}
}

View File

@ -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";

View File

@ -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"