From 43eeccac590e674d5dfc189be43791458d6aac52 Mon Sep 17 00:00:00 2001 From: obrusvit Date: Thu, 23 May 2024 15:37:54 +0200 Subject: [PATCH] feat(core/ui): T3T1 request number flow [no changelog] --- core/embed/rust/librust_qstr.h | 2 + .../model_mercury/component/number_input.rs | 102 +++++------- .../rust/src/ui/model_mercury/flow/mod.rs | 2 + .../ui/model_mercury/flow/request_number.rs | 148 ++++++++++++++++++ .../embed/rust/src/ui/model_mercury/layout.rs | 58 ++----- core/mocks/generated/trezorui2.pyi | 16 ++ core/src/trezor/ui/layouts/mercury/reset.py | 45 +++--- 7 files changed, 236 insertions(+), 137 deletions(-) create mode 100644 core/embed/rust/src/ui/model_mercury/flow/request_number.rs diff --git a/core/embed/rust/librust_qstr.h b/core/embed/rust/librust_qstr.h index ac5a9dacf..89ef5c039 100644 --- a/core/embed/rust/librust_qstr.h +++ b/core/embed/rust/librust_qstr.h @@ -230,6 +230,7 @@ static void _librust_qstrs(void) { MP_QSTR_flow_confirm_summary; MP_QSTR_flow_get_address; MP_QSTR_flow_prompt_backup; + MP_QSTR_flow_request_number; MP_QSTR_flow_show_share_words; MP_QSTR_flow_warning_hi_prio; MP_QSTR_get_language; @@ -253,6 +254,7 @@ static void _librust_qstrs(void) { MP_QSTR_icon_name; MP_QSTR_image; MP_QSTR_indeterminate; + MP_QSTR_info; MP_QSTR_info_button; MP_QSTR_init; MP_QSTR_inputs__back; diff --git a/core/embed/rust/src/ui/model_mercury/component/number_input.rs b/core/embed/rust/src/ui/model_mercury/component/number_input.rs index 215483fe4..d3ff1c18f 100644 --- a/core/embed/rust/src/ui/model_mercury/component/number_input.rs +++ b/core/embed/rust/src/ui/model_mercury/component/number_input.rs @@ -1,15 +1,15 @@ use crate::{ error::Error, strutil::{self, TString}, - translations::TR, ui::{ component::{ base::ComponentExt, paginated::Paginate, text::paragraphs::{Paragraph, Paragraphs}, - Child, Component, Event, EventCtx, Pad, + Child, Component, Event, EventCtx, Pad, SwipeDirection, }, - display::{self, Font}, + display::Font, + flow::{Swipable, SwipableResult}, geometry::{Alignment, Grid, Insets, Offset, Rect}, shape::{self, Renderer}, }, @@ -17,10 +17,7 @@ use crate::{ use super::{theme, Button, ButtonMsg}; -pub enum NumberInputDialogMsg { - Selected, - InfoRequested, -} +pub struct NumberInputDialogMsg(pub u32); pub struct NumberInputDialog where @@ -31,8 +28,6 @@ where input: Child, paragraphs: Child>>, paragraphs_pad: Pad, - info_button: Child