mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-08-02 03:48:58 +00:00
perf(core): wrap AddressDetails
in a GcBox
[no changelog]
This commit is contained in:
parent
a0ab4963f0
commit
5c49084a16
@ -2,7 +2,7 @@ use heapless::Vec;
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
error::Error,
|
error::Error,
|
||||||
micropython::buffer::StrBuffer,
|
micropython::{buffer::StrBuffer, gc::GcBox},
|
||||||
strutil::TString,
|
strutil::TString,
|
||||||
translations::TR,
|
translations::TR,
|
||||||
ui::{
|
ui::{
|
||||||
@ -36,7 +36,7 @@ impl AddressDetails {
|
|||||||
details_title: TString<'static>,
|
details_title: TString<'static>,
|
||||||
account: Option<TString<'static>>,
|
account: Option<TString<'static>>,
|
||||||
path: Option<TString<'static>>,
|
path: Option<TString<'static>>,
|
||||||
) -> Result<Self, Error> {
|
) -> Result<GcBox<Self>, Error> {
|
||||||
let mut para = ParagraphVecShort::new();
|
let mut para = ParagraphVecShort::new();
|
||||||
if let Some(a) = account {
|
if let Some(a) = account {
|
||||||
para.add(Paragraph::new::<TString>(
|
para.add(Paragraph::new::<TString>(
|
||||||
@ -73,7 +73,7 @@ impl AddressDetails {
|
|||||||
xpub_page_count: Vec::new(),
|
xpub_page_count: Vec::new(),
|
||||||
current_page: 0,
|
current_page: 0,
|
||||||
};
|
};
|
||||||
Ok(result)
|
GcBox::new(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_xpub(&mut self, title: StrBuffer, xpub: StrBuffer) -> Result<(), Error> {
|
pub fn add_xpub(&mut self, title: StrBuffer, xpub: StrBuffer) -> Result<(), Error> {
|
||||||
@ -128,7 +128,7 @@ impl PaginateFull for AddressDetails {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Component for AddressDetails {
|
impl Component for GcBox<AddressDetails> {
|
||||||
type Msg = ();
|
type Msg = ();
|
||||||
|
|
||||||
fn place(&mut self, bounds: Rect) -> Rect {
|
fn place(&mut self, bounds: Rect) -> Rect {
|
||||||
@ -176,7 +176,7 @@ impl Component for AddressDetails {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Swipable for AddressDetails {
|
impl Swipable for GcBox<AddressDetails> {
|
||||||
fn get_swipe_config(&self) -> SwipeConfig {
|
fn get_swipe_config(&self) -> SwipeConfig {
|
||||||
match self.current_page {
|
match self.current_page {
|
||||||
0 => self.details.get_swipe_config(),
|
0 => self.details.get_swipe_config(),
|
||||||
@ -190,7 +190,7 @@ impl Swipable for AddressDetails {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "ui_debug")]
|
#[cfg(feature = "ui_debug")]
|
||||||
impl crate::trace::Trace for AddressDetails {
|
impl crate::trace::Trace for GcBox<AddressDetails> {
|
||||||
fn trace(&self, t: &mut dyn crate::trace::Tracer) {
|
fn trace(&self, t: &mut dyn crate::trace::Tracer) {
|
||||||
t.component("AddressDetails");
|
t.component("AddressDetails");
|
||||||
match self.current_page {
|
match self.current_page {
|
||||||
|
@ -8,7 +8,7 @@ use super::component::{
|
|||||||
};
|
};
|
||||||
use crate::{
|
use crate::{
|
||||||
error::Error,
|
error::Error,
|
||||||
micropython::obj::Obj,
|
micropython::{gc::GcBox, obj::Obj},
|
||||||
ui::{
|
ui::{
|
||||||
component::{paginated::PaginateFull, Component, Never},
|
component::{paginated::PaginateFull, Component, Never},
|
||||||
flow::Swipable,
|
flow::Swipable,
|
||||||
@ -174,7 +174,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ComponentMsgObj for AddressDetails {
|
impl ComponentMsgObj for GcBox<AddressDetails> {
|
||||||
fn msg_try_into_obj(&self, _msg: Self::Msg) -> Result<Obj, Error> {
|
fn msg_try_into_obj(&self, _msg: Self::Msg) -> Result<Obj, Error> {
|
||||||
Ok(CANCELLED.as_obj())
|
Ok(CANCELLED.as_obj())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user