diff --git a/shared/ux_q1.py b/shared/ux_q1.py index 91b337ca..5f9d137c 100644 --- a/shared/ux_q1.py +++ b/shared/ux_q1.py @@ -646,7 +646,10 @@ class QRScannerInteraction: async def scan_anything(self, expect_secret=False): # start a QR scan, and act on what we find, whatever it may be. + from flow import has_secrets + from actions import goto_top_menu problem = None + while 1: prompt = 'Scan any QR code, or CANCEL' if not expect_secret else \ 'Scan XPRV or Seed Words, or CANCEL' @@ -662,7 +665,7 @@ class QRScannerInteraction: problem = str(exc) continue except Exception as exc: - import sys; sys.print_exception(exc) + #import sys; sys.print_exception(exc) problem = "Unable to decode QR" continue @@ -670,13 +673,19 @@ class QRScannerInteraction: if what == 'xprv': from actions import import_extended_key_as_secret text_xprv, = vals - await import_extended_key_as_secret(text_xprv, True) + await import_extended_key_as_secret(text_xprv, has_secrets()) + goto_top_menu(first_time=True) return if what == 'words': - from seed import set_ephemeral_seed_words # dirty API + from seed import set_ephemeral_seed_words, set_seed_value words, = vals - await set_ephemeral_seed_words(words, meta='From QR') + if has_secrets(): + await set_ephemeral_seed_words(words, meta='From QR') + else: + set_seed_value(words=words) + + goto_top_menu(first_time=True) return if what == 'psbt': @@ -700,7 +709,6 @@ class QRScannerInteraction: await ux_visualize_textqr(txt) return - # not reached? problem = 'Unhandled: ' + what