mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-26 16:18:22 +00:00
confirm: allow to resolve the dialogs from outside
This commit is contained in:
parent
5d7c2ac4e2
commit
39b3ecb224
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user