Skip to content

Commit 6d0ee40

Browse files
authored
fix(core): fix the fingerprint unlock issue (#263)
1 parent aed3491 commit 6d0ee40

File tree

3 files changed

+30
-17
lines changed

3 files changed

+30
-17
lines changed

core/src/trezor/lvglui/scrs/common.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,10 +527,16 @@ def read_content(self) -> list[str]:
527527
return [self.layout_title or ""] + [self.layout_subtitle or ""]
528528

529529
def destroy(self, delay_ms=400):
530-
self.del_delayed(delay_ms)
530+
try:
531+
self.del_delayed(delay_ms)
532+
except Exception:
533+
pass
531534

532535
def _delete_cb(self, _anim):
533-
self.del_delayed(100)
536+
try:
537+
self.del_delayed(100)
538+
except Exception:
539+
pass
534540

535541
def _load_anim_hor(self):
536542
Anim(

core/src/trezor/lvglui/scrs/lockscreen.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@
1414
class LockScreen(Screen):
1515
@classmethod
1616
def retrieval(cls) -> tuple[bool, "LockScreen" | None]:
17-
if hasattr(cls, "_instance") and cls._instance.is_visible():
18-
return True, cls._instance
19-
else:
20-
return False, None
17+
try:
18+
if cls._instance.is_visible():
19+
return True, cls._instance
20+
except Exception:
21+
pass
22+
return False, None
2123

2224
def __init__(self, device_name, ble_name="", dev_state=None):
2325
lockscreen = device.get_homescreen()

core/src/trezor/lvglui/scrs/pinscreen.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,12 @@ class InputNum(FullSizeWindow):
7676

7777
@classmethod
7878
def get_window_if_visible(cls) -> "InputNum" | None:
79-
return (
80-
cls._instance
81-
if (cls._instance is not None and cls._instance.is_visible())
82-
else None
83-
)
79+
try:
80+
if cls._instance is not None and cls._instance.is_visible():
81+
return cls._instance
82+
except Exception:
83+
pass
84+
return None
8485

8586
def __init__(self, **kwargs):
8687
super().__init__(
@@ -169,11 +170,12 @@ class InputPin(FullSizeWindow):
169170

170171
@classmethod
171172
def get_window_if_visible(cls) -> "InputPin" | None:
172-
return (
173-
cls._instance
174-
if (cls._instance is not None and cls._instance.is_visible())
175-
else None
176-
)
173+
try:
174+
if cls._instance is not None and cls._instance.is_visible():
175+
return cls._instance
176+
except Exception:
177+
pass
178+
return None
177179

178180
def __init__(self, **kwargs):
179181
super().__init__(
@@ -250,7 +252,10 @@ def _show_fingerprint_prompt_if_necessary(self):
250252

251253
def refresh_fingerprint_prompt(self):
252254
if hasattr(self, "fingerprint_prompt"):
253-
self.fingerprint_prompt.delete()
255+
try:
256+
self.fingerprint_prompt.delete()
257+
except Exception:
258+
pass
254259

255260
def on_event(self, event_obj):
256261
code = event_obj.code

0 commit comments

Comments
 (0)