From 86d5cf2e168e320b0774bf9004f71b7410468632 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ioan=20Biz=C4=83u?= Date: Thu, 14 Nov 2024 17:33:39 +0100 Subject: [PATCH] feat(core/ui): tweak blob first page appearance This commit adds a margin and footer description to the first page of the paginated blobs to be confirmed on Mercury. It also extracts the part of confirm_blob that deals with the first page to a separate function in order to keep confirm_blob simple. [no changelog] --- core/embed/rust/librust_qstr.h | 2 +- .../src/ui/model_mercury/component/frame.rs | 23 ++++- .../ui/model_mercury/flow/confirm_action.rs | 17 +++- .../embed/rust/src/ui/model_mercury/layout.rs | 98 +++++++++++++++---- core/embed/rust/src/ui/model_tr/layout.rs | 1 - .../rust/src/ui/model_tt/component/page.rs | 12 --- core/embed/rust/src/ui/model_tt/layout.rs | 14 --- core/mocks/generated/trezorui2.pyi | 18 +++- .../src/trezor/ui/layouts/mercury/__init__.py | 8 +- 9 files changed, 133 insertions(+), 60 deletions(-) diff --git a/core/embed/rust/librust_qstr.h b/core/embed/rust/librust_qstr.h index 2782ee8254..e0d70554c9 100644 --- a/core/embed/rust/librust_qstr.h +++ b/core/embed/rust/librust_qstr.h @@ -194,6 +194,7 @@ static void _librust_qstrs(void) { MP_QSTR_confirm_address; MP_QSTR_confirm_backup; MP_QSTR_confirm_blob; + MP_QSTR_confirm_blob_intro; MP_QSTR_confirm_coinjoin; MP_QSTR_confirm_emphasized; MP_QSTR_confirm_fido; @@ -359,7 +360,6 @@ static void _librust_qstrs(void) { MP_QSTR_notification_level; MP_QSTR_page_count; MP_QSTR_page_counter; - MP_QSTR_page_limit; MP_QSTR_pages; MP_QSTR_paint; MP_QSTR_passphrase__access_wallet; diff --git a/core/embed/rust/src/ui/model_mercury/component/frame.rs b/core/embed/rust/src/ui/model_mercury/component/frame.rs index 32719551a7..9857265ec4 100644 --- a/core/embed/rust/src/ui/model_mercury/component/frame.rs +++ b/core/embed/rust/src/ui/model_mercury/component/frame.rs @@ -89,6 +89,7 @@ pub struct Frame { swipe: SwipeConfig, internal_page_cnt: usize, horizontal_swipe: HorizontalSwipe, + margin: usize, } pub enum FrameMsg { @@ -111,6 +112,7 @@ where swipe: SwipeConfig::new(), internal_page_cnt: 1, horizontal_swipe: HorizontalSwipe::new(), + margin: 0, } } @@ -262,12 +264,18 @@ where ..self } } + pub fn with_vertical_pages(self) -> Self { Self { swipe: self.swipe.with_vertical_pages(), ..self } } + + pub fn with_margin(mut self, margin: usize) -> Self { + self.margin = margin; + self + } } impl Component for Frame @@ -278,7 +286,7 @@ where fn place(&mut self, bounds: Rect) -> Rect { self.bounds = bounds; - let content_area = frame_place(&mut self.header, &mut self.footer, bounds); + let content_area = frame_place(&mut self.header, &mut self.footer, bounds, self.margin); self.content.place(content_area); @@ -347,9 +355,16 @@ fn frame_event( header.event(ctx, event) } -fn frame_place(header: &mut Header, footer: &mut Option