From efda21a2a711e9098450f9882c391ab2ef6b3790 Mon Sep 17 00:00:00 2001 From: M1nd3r Date: Wed, 20 Nov 2024 10:38:33 +0100 Subject: [PATCH] fixup! chore(core): update core to reflect cache and context refactor [no changelog] --- core/src/trezor/ui/__init__.py | 2 +- core/src/trezor/ui/layouts/homescreen.py | 5 +++-- core/src/trezor/workflow.py | 10 +++++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/core/src/trezor/ui/__init__.py b/core/src/trezor/ui/__init__.py index c0e4e51b9c..7292fefac2 100644 --- a/core/src/trezor/ui/__init__.py +++ b/core/src/trezor/ui/__init__.py @@ -329,7 +329,7 @@ class Layout(Generic[T]): def _paint(self) -> None: """Paint the layout and ensure that homescreen cache is properly invalidated.""" - import storage.cache_common as storage_cache + import storage.cache as storage_cache painted = self.layout.paint() if painted: diff --git a/core/src/trezor/ui/layouts/homescreen.py b/core/src/trezor/ui/layouts/homescreen.py index 348c0d5df2..cce243097f 100644 --- a/core/src/trezor/ui/layouts/homescreen.py +++ b/core/src/trezor/ui/layouts/homescreen.py @@ -1,7 +1,8 @@ from typing import TYPE_CHECKING -import storage.cache_common as storage_cache +import storage.cache as storage_cache import trezorui2 +from storage.cache_common import APP_COMMON_BUSY_DEADLINE_MS from trezor import TR, ui if TYPE_CHECKING: @@ -129,6 +130,6 @@ class Busyscreen(HomescreenBase): # Handle timeout. result = await super().get_result() assert result == trezorui2.CANCELLED - context.cache_delete(storage_cache.APP_COMMON_BUSY_DEADLINE_MS) + context.cache_delete(APP_COMMON_BUSY_DEADLINE_MS) set_homescreen() return result diff --git a/core/src/trezor/workflow.py b/core/src/trezor/workflow.py index 62ce2726ef..67b88f8e68 100644 --- a/core/src/trezor/workflow.py +++ b/core/src/trezor/workflow.py @@ -1,7 +1,7 @@ import utime from typing import TYPE_CHECKING -import storage.cache_common as cache_common +import storage.cache as storage_cache from trezor import log, loop from trezor.enums import MessageType @@ -153,7 +153,7 @@ def close_others() -> None: if not task.is_running(): task.close() - cache_common.homescreen_shown = None + storage_cache.homescreen_shown = None # if tasks were running, closing the last of them will run start_default @@ -211,11 +211,11 @@ class IdleTimer: time and saves it to storage.cache. This is done to avoid losing an active timer when workflow restart happens and tasks are lost. """ - if _restore_from_cache and cache_common.autolock_last_touch is not None: - now = cache_common.autolock_last_touch + if _restore_from_cache and storage_cache.autolock_last_touch is not None: + now = storage_cache.autolock_last_touch else: now = utime.ticks_ms() - cache_common.autolock_last_touch = now + storage_cache.autolock_last_touch = now for callback, task in self.tasks.items(): timeout_us = self.timeouts[callback]