From 959cf7d51525beeba3929641e609d8760e644363 Mon Sep 17 00:00:00 2001 From: matejcik Date: Wed, 21 Apr 2021 13:07:07 +0200 Subject: [PATCH] fix(core/homescreen): properly redraw when an outside process kills homescreen This happens with FIDO which does not use the normal workflow management and so `workflow.close_others()` is never called. --- core/src/apps/homescreen/__init__.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/src/apps/homescreen/__init__.py b/core/src/apps/homescreen/__init__.py index 5cf8f2f860..a69e639d1e 100644 --- a/core/src/apps/homescreen/__init__.py +++ b/core/src/apps/homescreen/__init__.py @@ -16,6 +16,15 @@ class HomescreenBase(ui.Layout): "apps/homescreen/res/bg.toif" ) + async def __iter__(self) -> ui.ResultValue: + # We need to catch the ui.Cancelled exception that kills us, because that means + # that we will need to draw on screen again after restart. + try: + return await super().__iter__() + except ui.Cancelled: + storage.cache.homescreen_shown = None + raise + def on_render(self) -> None: if not self.repaint: return