refactor(core/delizia): move `dummy_page()` to `util.rs`
What changed, and why it matters
This commit is a simple code cleanup: it moves a small helper function called dummy_page() into a shared utility file so two different screens can use the same copy instead of each defining their own. There is no change to what the code does, no bug fix, and no security-relevant behavior change.
No security action needed; treat as ordinary refactoring.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch refactors the Delizia UI flow code in trezor-firmware. It removes a local dummy_page() definition from confirm_summary.rs, adds the same definition to util.rs, and updates confirm_output.rs and confirm_summary.rs to import it. The function creates an invisible placeholder page (empty frame + empty vertical menu mapped to FlowMsg::Cancelled) required by the swipe-flow framework. The implementation is identical before and after; only its location changes.
Changed components
core/embed/rust/src/ui/layout_delizia/flow/confirm_output.rscore/embed/rust/src/ui/layout_delizia/flow/confirm_summary.rscore/embed/rust/src/ui/layout_delizia/flow/util.rsInspect captured patch +11 / −16
diff --git a/core/embed/rust/src/ui/layout_delizia/flow/confirm_output.rs b/core/embed/rust/src/ui/layout_delizia/flow/confirm_output.rs
index e166d8a9f..04de0b279 100644
--- a/core/embed/rust/src/ui/layout_delizia/flow/confirm_output.rs
+++ b/core/embed/rust/src/ui/layout_delizia/flow/confirm_output.rs
@@ -23,7 +23,7 @@ use super::{
},
theme,
},
- util::{ConfirmValue, ShowInfoParams},
+ util::{dummy_page, ConfirmValue, ShowInfoParams},
};
const MENU_ITEM_CANCEL: usize = 0;
@@ -331,11 +331,7 @@ pub fn new_confirm_output(
} else {
// dummy page - this will never be shown since there is no menu item pointing to
// it, but the page has to exist in the flow
- flow.add_page(
- &ConfirmOutputWithSummary::AddressInfo,
- Frame::left_aligned(TString::empty(), VerticalMenu::empty())
- .map(|_| Some(FlowMsg::Cancelled)),
- )?;
+ flow.add_page(&ConfirmOutputWithSummary::AddressInfo, dummy_page())?;
}
flow.add_page(&ConfirmOutputWithSummary::Summary, content_summary)?
.add_page(&ConfirmOutputWithSummary::SummaryMenu, content_summary_menu)?
diff --git a/core/embed/rust/src/ui/layout_delizia/flow/confirm_summary.rs b/core/embed/rust/src/ui/layout_delizia/flow/confirm_summary.rs
index fafdd5aad..15ce8b0b4 100644
--- a/core/embed/rust/src/ui/layout_delizia/flow/confirm_summary.rs
+++ b/core/embed/rust/src/ui/layout_delizia/flow/confirm_summary.rs
@@ -1,15 +1,14 @@
use heapless::Vec;
use crate::{
- error::{self},
- maybe_trace::MaybeTrace,
+ error,
strutil::TString,
translations::TR,
ui::{
- component::{swipe_detect::SwipeSettings, Component, ComponentExt},
+ component::{swipe_detect::SwipeSettings, ComponentExt},
flow::{
base::{Decision, DecisionBuilder as _},
- FlowController, FlowMsg, Swipable, SwipeFlow,
+ FlowController, FlowMsg, SwipeFlow,
},
geometry::Direction,
},
@@ -20,7 +19,7 @@ use super::{
component::{Frame, PromptScreen, SwipeContent, VerticalMenu, VerticalMenuChoiceMsg},
theme,
},
- util::ShowInfoParams,
+ util::{dummy_page, ShowInfoParams},
};
const MENU_ITEM_CANCEL: usize = 0;
@@ -66,10 +65,6 @@ impl FlowController for ConfirmSummary {
}
}
-fn dummy_page() -> impl Component<Msg = FlowMsg> + Swipable + MaybeTrace {
- Frame::left_aligned(TString::empty(), VerticalMenu::empty()).map(|_| Some(FlowMsg::Cancelled))
-}
-
pub fn new_confirm_summary(
summary_params: ShowInfoParams,
account_params: Option<ShowInfoParams>,
diff --git a/core/embed/rust/src/ui/layout_delizia/flow/util.rs b/core/embed/rust/src/ui/layout_delizia/flow/util.rs
index 578ec4658..56102d782 100644
--- a/core/embed/rust/src/ui/layout_delizia/flow/util.rs
+++ b/core/embed/rust/src/ui/layout_delizia/flow/util.rs
@@ -24,7 +24,7 @@ use heapless::Vec;
use super::{
super::{
- component::{Frame, PromptMsg, SwipeContent, VerticalMenuChoiceMsg},
+ component::{Frame, PromptMsg, SwipeContent, VerticalMenu, VerticalMenuChoiceMsg},
flow, theme,
},
ConfirmActionExtra, ConfirmActionMenuStrings, ConfirmActionStrings,
@@ -522,3 +522,7 @@ where
flow.add_page(&SinglePage::Show, layout)?;
Ok(flow)
}
+
+pub fn dummy_page() -> impl Component<Msg = FlowMsg> + Swipable + MaybeTrace {
+ Frame::left_aligned(TString::empty(), VerticalMenu::empty()).map(|_| Some(FlowMsg::Cancelled))
+}
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.