mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-26 09:28:13 +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
|
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
|
@unimport
|
||||||
async def confirm(session_id, content=None, code=None, *args, **kwargs):
|
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:
|
if code is None:
|
||||||
code = Other
|
code = Other
|
||||||
await wire.reply_message(session_id, ButtonRequest(code=code), ButtonAck)
|
await wire.reply_message(session_id, ButtonRequest(code=code), ButtonAck)
|
||||||
return await dialog == CONFIRMED
|
return await loop.Wait((future, dialog)) == CONFIRMED
|
||||||
|
|
||||||
|
|
||||||
@unimport
|
@unimport
|
||||||
@ -36,7 +40,7 @@ async def hold_to_confirm(session_id, content=None, code=None, *args, **kwargs):
|
|||||||
if code is None:
|
if code is None:
|
||||||
code = Other
|
code = Other
|
||||||
await wire.reply_message(session_id, ButtonRequest(code=code), ButtonAck)
|
await wire.reply_message(session_id, ButtonRequest(code=code), ButtonAck)
|
||||||
return await dialog == CONFIRMED
|
return await loop.Wait((future, dialog)) == CONFIRMED
|
||||||
|
|
||||||
|
|
||||||
@unimport
|
@unimport
|
||||||
|
Loading…
Reference in New Issue
Block a user