BBQr switch in QR File Share
This commit is contained in:
parent
7e6be45e2d
commit
67febe2758
@ -1499,11 +1499,13 @@ Erases and reformats MicroSD card. This is not a secure erase but more of a quic
|
||||
wipe_microsd_card()
|
||||
|
||||
|
||||
async def qr_share_file(*A):
|
||||
async def qr_share_file(_1, _2, item):
|
||||
# Pick file from SD card and share as (BB)Qr
|
||||
from files import CardSlot, CardMissingError, needs_microsd
|
||||
from export import export_by_qr
|
||||
|
||||
force_bbqr = item.arg
|
||||
|
||||
def is_suitable(fname):
|
||||
f = fname.lower()
|
||||
return f.endswith('.psbt') or f.endswith('.txn') \
|
||||
@ -1548,7 +1550,7 @@ async def qr_share_file(*A):
|
||||
else:
|
||||
raise ValueError(ext)
|
||||
|
||||
await export_by_qr(data, txid, tc)
|
||||
await export_by_qr(data, txid, tc, force_bbqr=force_bbqr)
|
||||
|
||||
|
||||
async def nfc_share_file(*A):
|
||||
|
||||
@ -13,13 +13,16 @@ from public_constants import AF_CLASSIC, AF_P2WPKH, AF_P2WPKH_P2SH, AF_P2WSH, AF
|
||||
from charcodes import KEY_NFC, KEY_CANCEL, KEY_QR
|
||||
from ownership import OWNERSHIP
|
||||
|
||||
async def export_by_qr(body, label, type_code):
|
||||
async def export_by_qr(body, label, type_code, force_bbqr=False):
|
||||
# render as QR and show on-screen
|
||||
from ux import show_qr_code
|
||||
|
||||
try:
|
||||
# ignore label/title - provides no useful info
|
||||
# makes qr smaller and harder to read
|
||||
if force_bbqr:
|
||||
raise ValueError
|
||||
|
||||
await show_qr_code(body)
|
||||
except (ValueError, RuntimeError, TypeError):
|
||||
if version.has_qwerty:
|
||||
|
||||
@ -214,6 +214,7 @@ FileMgmtMenu = [
|
||||
MenuItem('List Files', f=list_files),
|
||||
MenuItem('Verify Sig File', f=verify_sig_file),
|
||||
MenuItem('NFC File Share', predicate=nfc_enabled, f=nfc_share_file, shortcut=KEY_NFC),
|
||||
MenuItem('BBQr File Share', predicate=version.has_qr, f=qr_share_file, arg=True),
|
||||
MenuItem('QR File Share', predicate=version.has_qr, f=qr_share_file, shortcut=KEY_QR),
|
||||
MenuItem('Clone Coldcard', predicate=has_secrets, f=clone_write_data),
|
||||
MenuItem('Format SD Card', f=wipe_sd_card),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user