diff --git a/core/embed/rust/librust_qstr.h b/core/embed/rust/librust_qstr.h index a4314fa45e..9533cd6ac3 100644 --- a/core/embed/rust/librust_qstr.h +++ b/core/embed/rust/librust_qstr.h @@ -262,6 +262,7 @@ static void _librust_qstrs(void) { MP_QSTR_fingerprint; MP_QSTR_firmware_update__title; MP_QSTR_firmware_update__title_fingerprint; + MP_QSTR_firmware_version; MP_QSTR_flow_confirm_output; MP_QSTR_flow_confirm_set_new_pin; MP_QSTR_flow_get_address; diff --git a/core/embed/rust/src/ui/api/firmware_micropython.rs b/core/embed/rust/src/ui/api/firmware_micropython.rs index c54f959c36..b6711d4a44 100644 --- a/core/embed/rust/src/ui/api/firmware_micropython.rs +++ b/core/embed/rust/src/ui/api/firmware_micropython.rs @@ -806,9 +806,17 @@ extern "C" fn new_show_device_menu(n_args: usize, args: *const Obj, kwargs: *mut let block = move |_args: &[Obj], kwargs: &Map| { let failed_backup: bool = kwargs.get(Qstr::MP_QSTR_failed_backup)?.try_into()?; let battery_percentage: u8 = kwargs.get_or(Qstr::MP_QSTR_battery_percentage, 0)?; + let firmware_version: TString = kwargs.get(Qstr::MP_QSTR_firmware_version)?.try_into()?; + let device_name: TString = kwargs.get(Qstr::MP_QSTR_device_name)?.try_into()?; let paired_devices: Obj = kwargs.get(Qstr::MP_QSTR_paired_devices)?; let paired_devices: Vec = util::iter_into_vec(paired_devices)?; - let layout = ModelUI::show_device_menu(failed_backup, battery_percentage, paired_devices)?; + let layout = ModelUI::show_device_menu( + failed_backup, + battery_percentage, + firmware_version, + device_name, + paired_devices, + )?; let layout_obj = LayoutObj::new_root(layout)?; Ok(layout_obj.into()) }; @@ -1602,6 +1610,8 @@ pub static mp_module_trezorui_api: Module = obj_module! { /// *, /// failed_backup: bool, /// battery_percentage: int, + /// firmware_version: str, + /// device_name: str, /// paired_devices: Iterable[str], /// ) -> LayoutObj[UiResult]: /// """Show the device menu.""" diff --git a/core/embed/rust/src/ui/layout_bolt/ui_firmware.rs b/core/embed/rust/src/ui/layout_bolt/ui_firmware.rs index 178ab6a53f..fb1aa5459e 100644 --- a/core/embed/rust/src/ui/layout_bolt/ui_firmware.rs +++ b/core/embed/rust/src/ui/layout_bolt/ui_firmware.rs @@ -873,6 +873,8 @@ impl FirmwareUI for UIBolt { fn show_device_menu( _failed_backup: bool, _battery_percentage: u8, + _firmware_version: TString<'static>, + _device_name: TString<'static>, _paired_devices: heapless::Vec, 1>, ) -> Result { Err::, Error>(Error::ValueError( diff --git a/core/embed/rust/src/ui/layout_caesar/ui_firmware.rs b/core/embed/rust/src/ui/layout_caesar/ui_firmware.rs index 31cf918552..5d8e725448 100644 --- a/core/embed/rust/src/ui/layout_caesar/ui_firmware.rs +++ b/core/embed/rust/src/ui/layout_caesar/ui_firmware.rs @@ -1039,6 +1039,8 @@ impl FirmwareUI for UICaesar { fn show_device_menu( _failed_backup: bool, _battery_percentage: u8, + _firmware_version: TString<'static>, + _device_name: TString<'static>, _paired_devices: Vec, 1>, ) -> Result { Err::, Error>(Error::ValueError( diff --git a/core/embed/rust/src/ui/layout_delizia/ui_firmware.rs b/core/embed/rust/src/ui/layout_delizia/ui_firmware.rs index 5907fec858..eed86b965f 100644 --- a/core/embed/rust/src/ui/layout_delizia/ui_firmware.rs +++ b/core/embed/rust/src/ui/layout_delizia/ui_firmware.rs @@ -891,6 +891,8 @@ impl FirmwareUI for UIDelizia { fn show_device_menu( _failed_backup: bool, _battery_percentage: u8, + _firmware_version: TString<'static>, + _device_name: TString<'static>, _paired_devices: heapless::Vec, 1>, ) -> Result { Err::, Error>(Error::ValueError( diff --git a/core/embed/rust/src/ui/layout_eckhart/firmware/device_menu_screen.rs b/core/embed/rust/src/ui/layout_eckhart/firmware/device_menu_screen.rs index 78d5f39ea0..6e79fd30c7 100644 --- a/core/embed/rust/src/ui/layout_eckhart/firmware/device_menu_screen.rs +++ b/core/embed/rust/src/ui/layout_eckhart/firmware/device_menu_screen.rs @@ -129,6 +129,7 @@ pub struct DeviceMenuScreen<'a> { bounds: Rect, battery_percentage: u8, + firmware_version: TString<'static>, // These correspond to the currently active subscreen, // which is one of the possible kinds of subscreens @@ -153,6 +154,8 @@ impl<'a> DeviceMenuScreen<'a> { pub fn new( failed_backup: bool, battery_percentage: u8, + firmware_version: TString<'static>, + device_name: TString<'static>, // NB: we currently only support one device at a time. // if we ever increase this size, we will need a way to return the correct // device index on Disconnect back to uPy @@ -163,6 +166,7 @@ impl<'a> DeviceMenuScreen<'a> { let mut screen = Self { bounds: Rect::zero(), battery_percentage, + firmware_version, menu_screen: None, paired_device_screen: None, about_screen: None, @@ -173,7 +177,7 @@ impl<'a> DeviceMenuScreen<'a> { let about = screen.add_subscreen(Subscreen::AboutScreen); let security = screen.add_security_menu(); - let device = screen.add_device_menu("My device".into(), about); // TODO: device name + let device = screen.add_device_menu(device_name, about); let settings = screen.add_settings_menu(security, device); let mut paired_device_indices: Vec = Vec::new(); @@ -407,7 +411,7 @@ impl<'a> DeviceMenuScreen<'a> { self.paired_device_screen = None; let about_content = Paragraphs::new([ Paragraph::new(&theme::firmware::TEXT_REGULAR, "Firmware version"), - Paragraph::new(&theme::firmware::TEXT_REGULAR, "2.3.1"), // TODO + Paragraph::new(&theme::firmware::TEXT_REGULAR, self.firmware_version), ]); self.about_screen = Some( diff --git a/core/embed/rust/src/ui/layout_eckhart/ui_firmware.rs b/core/embed/rust/src/ui/layout_eckhart/ui_firmware.rs index fea918db14..6e9f5fd43c 100644 --- a/core/embed/rust/src/ui/layout_eckhart/ui_firmware.rs +++ b/core/embed/rust/src/ui/layout_eckhart/ui_firmware.rs @@ -786,11 +786,15 @@ impl FirmwareUI for UIEckhart { fn show_device_menu( failed_backup: bool, battery_percentage: u8, + firmware_version: TString<'static>, + device_name: TString<'static>, paired_devices: Vec, 1>, ) -> Result { let layout = RootComponent::new(DeviceMenuScreen::new( failed_backup, battery_percentage, + firmware_version, + device_name, paired_devices, )); Ok(layout) diff --git a/core/embed/rust/src/ui/ui_firmware.rs b/core/embed/rust/src/ui/ui_firmware.rs index cb3c8e1dc4..de35c7c564 100644 --- a/core/embed/rust/src/ui/ui_firmware.rs +++ b/core/embed/rust/src/ui/ui_firmware.rs @@ -304,6 +304,8 @@ pub trait FirmwareUI { fn show_device_menu( failed_backup: bool, battery_percentage: u8, + firmware_version: TString<'static>, + device_name: TString<'static>, paired_devices: Vec, 1>, ) -> Result; diff --git a/core/mocks/generated/trezorui_api.pyi b/core/mocks/generated/trezorui_api.pyi index 38994d6c62..9b61436244 100644 --- a/core/mocks/generated/trezorui_api.pyi +++ b/core/mocks/generated/trezorui_api.pyi @@ -537,6 +537,8 @@ def show_device_menu( *, failed_backup: bool, battery_percentage: int, + firmware_version: str, + device_name: str, paired_devices: Iterable[str], ) -> LayoutObj[UiResult]: """Show the device menu.""" diff --git a/core/src/apps/homescreen/__init__.py b/core/src/apps/homescreen/__init__.py index f158d1fc2e..7fe9c0bff3 100644 --- a/core/src/apps/homescreen/__init__.py +++ b/core/src/apps/homescreen/__init__.py @@ -60,10 +60,11 @@ async def homescreen() -> None: obj.__del__() if res is trezorui_api.INFO: - # MOCK DATA failed_backup = True battery_percentage = 22 + firmware_version = "2.3.1" + device_name = "My Trezor" paired_devices = ["Suite on my de-Googled Phone"] # @@ -71,6 +72,8 @@ async def homescreen() -> None: trezorui_api.show_device_menu( failed_backup=failed_backup, battery_percentage=battery_percentage, + firmware_version=firmware_version, + device_name=device_name, paired_devices=paired_devices, ), "device_menu", @@ -80,7 +83,7 @@ async def homescreen() -> None: await raise_if_not_confirmed( trezorui_api.show_pairing_device_name( - device_name="My Trez", + device_name=device_name, ), "device_name", )