Display label in PIN unlock
This commit is contained in:
parent
dddb1e7548
commit
ba5aea519d
|
@ -7,11 +7,11 @@ class PinCancelled(Exception):
|
|||
|
||||
|
||||
@ui.layout(delay=5000)
|
||||
async def request_pin(code: int = None) -> str:
|
||||
async def request_pin(code: int = None, device_label: str = '') -> str:
|
||||
from trezor.ui.confirm import ConfirmDialog, CONFIRMED
|
||||
from trezor.ui.pin import PinMatrix
|
||||
|
||||
label = _get_label(code)
|
||||
label = _get_label(code, device_label)
|
||||
|
||||
def onchange():
|
||||
c = dialog.cancel
|
||||
|
@ -41,7 +41,7 @@ async def request_pin(code: int = None) -> str:
|
|||
raise PinCancelled()
|
||||
|
||||
|
||||
def _get_label(code: int):
|
||||
def _get_label(code: int, device_label: str):
|
||||
from trezor.messages import PinMatrixRequestType
|
||||
if code is None:
|
||||
code = PinMatrixRequestType.Current
|
||||
|
@ -50,5 +50,8 @@ def _get_label(code: int):
|
|||
elif code == PinMatrixRequestType.NewSecond:
|
||||
label = 'Enter PIN again'
|
||||
else: # PinMatrixRequestType.Current
|
||||
label = 'Enter PIN'
|
||||
if device_label:
|
||||
label = 'Unlock %s' % device_label
|
||||
else:
|
||||
label = 'Enter PIN'
|
||||
return label
|
||||
|
|
|
@ -11,7 +11,7 @@ async def swipe_to_rotate():
|
|||
|
||||
async def dim_screen():
|
||||
await loop.sleep(5 * 1000000)
|
||||
await ui.backlight_slide(ui.BACKLIGHT_DIM)
|
||||
await ui.backlight_slide(ui.BACKLIGHT_DIM, delay=20000)
|
||||
while True:
|
||||
await loop.sleep(10000000)
|
||||
|
||||
|
|
|
@ -7,10 +7,11 @@ from apps.common.request_pin import request_pin
|
|||
|
||||
|
||||
async def unlock_layout():
|
||||
|
||||
while True:
|
||||
try:
|
||||
if config.has_pin():
|
||||
pin = await request_pin()
|
||||
pin = await request_pin(None, 'My TREZOR') # FIXME
|
||||
else:
|
||||
pin = ''
|
||||
|
||||
|
@ -28,5 +29,6 @@ async def unlock_failed():
|
|||
|
||||
config.init()
|
||||
ui.display.backlight(ui.BACKLIGHT_NONE) # Bootloader ends faded out
|
||||
loop.schedule(ui.backlight_slide(ui.BACKLIGHT_NORMAL))
|
||||
loop.schedule(unlock_layout())
|
||||
loop.run()
|
||||
|
|
|
@ -83,7 +83,7 @@ async def alert(count: int=3):
|
|||
display.backlight(current)
|
||||
|
||||
|
||||
async def backlight_slide(val: int, delay: int=20000, step: int=1):
|
||||
async def backlight_slide(val: int, delay: int=1000, step: int=1):
|
||||
sleep = loop.sleep(delay)
|
||||
current = display.backlight()
|
||||
for i in range(current, val, -step if current > val else step):
|
||||
|
|
Loading…
Reference in New Issue