diff --git a/src/apps/common/confirm.py b/src/apps/common/confirm.py index 2f09b304b7..ac70f9f940 100644 --- a/src/apps/common/confirm.py +++ b/src/apps/common/confirm.py @@ -1,6 +1,10 @@ -from trezor import wire, ui +from trezor import wire, ui, loop from trezor.utils import unimport +# used to confirm/cancel the dialogs from outside of this module (i.e. +# through debug link) +future = loop.Future() + @unimport async def confirm(session_id, content=None, code=None, *args, **kwargs): @@ -16,7 +20,7 @@ async def confirm(session_id, content=None, code=None, *args, **kwargs): if code is None: code = Other await wire.reply_message(session_id, ButtonRequest(code=code), ButtonAck) - return await dialog == CONFIRMED + return await loop.Wait((future, dialog)) == CONFIRMED @unimport @@ -36,7 +40,7 @@ async def hold_to_confirm(session_id, content=None, code=None, *args, **kwargs): if code is None: code = Other await wire.reply_message(session_id, ButtonRequest(code=code), ButtonAck) - return await dialog == CONFIRMED + return await loop.Wait((future, dialog)) == CONFIRMED @unimport