From d968bcd3cd780c1ce118effc515d8e931ca86daf Mon Sep 17 00:00:00 2001 From: Matt Gleason Date: Tue, 18 Jul 2023 15:13:54 -0500 Subject: [PATCH] SFT-2453: added context-specific qr failure text, used long error page --- ports/stm32/boards/Passport/modules/flows/scan_qr_flow.py | 8 +++++--- .../boards/Passport/modules/flows/sign_psbt_qr_flow.py | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ports/stm32/boards/Passport/modules/flows/scan_qr_flow.py b/ports/stm32/boards/Passport/modules/flows/scan_qr_flow.py index 0c302a0f0..d8fe39125 100644 --- a/ports/stm32/boards/Passport/modules/flows/scan_qr_flow.py +++ b/ports/stm32/boards/Passport/modules/flows/scan_qr_flow.py @@ -3,7 +3,7 @@ from data_codecs.qr_type import QRType from flows import Flow -from pages import ScanQRPage, ErrorPage +from pages import ScanQRPage, LongErrorPage from foundation import ur @@ -16,7 +16,8 @@ def __init__(self, ur_types=None, explicit_type=None, data_description=None, - max_frames=None): + max_frames=None, + failure_message=None): """ Initialize the scan QR flow. @@ -40,6 +41,7 @@ def __init__(self, self.data_description = data_description self.data = None self.max_frames = max_frames + self.failure_message = failure_message or 'Unable to scan QR code.\n\n{}' if len(self.qr_types) == 0: raise ValueError('At least one QR type must be provided') @@ -62,7 +64,7 @@ async def scan(self): return if result.is_failure(): - await ErrorPage(text='Unable to scan QR code.\n\n{}'.format(result.error)).show() + await LongErrorPage(text=self.failure_message.format(result.error)).show() self.set_result(None) return diff --git a/ports/stm32/boards/Passport/modules/flows/sign_psbt_qr_flow.py b/ports/stm32/boards/Passport/modules/flows/sign_psbt_qr_flow.py index cbefd37c3..5ac45be42 100644 --- a/ports/stm32/boards/Passport/modules/flows/sign_psbt_qr_flow.py +++ b/ports/stm32/boards/Passport/modules/flows/sign_psbt_qr_flow.py @@ -32,7 +32,9 @@ async def scan_transaction(self): result = await ScanQRFlow(qr_types=[QRType.QR, QRType.UR2], ur_types=[ur.Value.CRYPTO_PSBT, ur.Value.BYTES], data_description='a PSBT file', - max_frames=self.max_frames).run() + max_frames=self.max_frames, + failure_message="Unable to Scan QR code, \ +try signing using the microSD card.\n\n{}").run() if result is None: # User canceled the scan self.set_result(False)