From f41b14e935ecdd483bf29815876f50caf838fd01 Mon Sep 17 00:00:00 2001 From: Tomas Susanka Date: Mon, 11 Jun 2018 15:55:10 +0200 Subject: [PATCH] nem: show qr --- src/apps/nem/get_address.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/apps/nem/get_address.py b/src/apps/nem/get_address.py index b1d2f84270..d524975b68 100644 --- a/src/apps/nem/get_address.py +++ b/src/apps/nem/get_address.py @@ -4,7 +4,8 @@ from trezor.messages.NEMAddress import NEMAddress from trezor.ui.text import Text from apps.common import seed -from apps.common.confirm import require_confirm +from apps.common.confirm import confirm +from apps.common.display_address import show_qr from .layout import split_address from .helpers import get_network_str, NEM_CURVE @@ -17,16 +18,26 @@ async def get_address(ctx, msg): address = node.nem_address(network) if msg.show_display: - await _require_confirm_address(ctx, address, network) + + while True: + if await _show_address(ctx, address, network): + break + if await show_qr(ctx, address.upper()): + break return NEMAddress(address=address) -async def _require_confirm_address(ctx, address: str, network: int): +async def _show_address(ctx, address: str, network: int): lines = split_address(address) content = Text( - 'Export NEM address', ui.ICON_RECEIVE, + 'Confirm address', ui.ICON_RECEIVE, ui.NORMAL, '%s network' % get_network_str(network), ui.MONO, *lines, icon_color=ui.GREEN) - await require_confirm(ctx, content, code=ButtonRequestType.Address) + return await confirm( + ctx, + content, + code=ButtonRequestType.Address, + cancel='QR', + cancel_style=ui.BTN_KEY)