diff --git a/core/embed/rust/librust_qstr.h b/core/embed/rust/librust_qstr.h index 77bad82154..682a716b87 100644 --- a/core/embed/rust/librust_qstr.h +++ b/core/embed/rust/librust_qstr.h @@ -123,7 +123,6 @@ static void _librust_qstrs(void) { MP_QSTR_backup__title_create_wallet_backup; MP_QSTR_backup__title_skip; MP_QSTR_backup__want_to_skip; - MP_QSTR_battery_percentage; MP_QSTR_bitcoin__commitment_data; MP_QSTR_bitcoin__confirm_locktime; MP_QSTR_bitcoin__create_proof_of_ownership; diff --git a/core/embed/rust/src/ui/api/firmware_micropython.rs b/core/embed/rust/src/ui/api/firmware_micropython.rs index 35a9204660..90c1ebf54f 100644 --- a/core/embed/rust/src/ui/api/firmware_micropython.rs +++ b/core/embed/rust/src/ui/api/firmware_micropython.rs @@ -841,7 +841,6 @@ extern "C" fn new_show_homescreen(n_args: usize, args: *const Obj, kwargs: *mut extern "C" fn new_show_device_menu(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj { 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)?; @@ -850,7 +849,6 @@ extern "C" fn new_show_device_menu(n_args: usize, args: *const Obj, kwargs: *mut kwargs.get(Qstr::MP_QSTR_auto_lock_delay)?.try_into()?; let layout = ModelUI::show_device_menu( failed_backup, - battery_percentage, firmware_version, device_name, paired_devices, @@ -1675,7 +1673,6 @@ pub static mp_module_trezorui_api: Module = obj_module! { /// def show_device_menu( /// *, /// failed_backup: bool, - /// battery_percentage: int, /// firmware_version: str, /// device_name: str, /// paired_devices: Iterable[str], 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 b74d3131f4..7e8369c6e8 100644 --- a/core/embed/rust/src/ui/layout_bolt/ui_firmware.rs +++ b/core/embed/rust/src/ui/layout_bolt/ui_firmware.rs @@ -880,7 +880,6 @@ 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>, 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 8552a02893..027b4e8d9e 100644 --- a/core/embed/rust/src/ui/layout_caesar/ui_firmware.rs +++ b/core/embed/rust/src/ui/layout_caesar/ui_firmware.rs @@ -1073,7 +1073,6 @@ 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>, 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 2b4ec57e02..035c8bc31a 100644 --- a/core/embed/rust/src/ui/layout_delizia/ui_firmware.rs +++ b/core/embed/rust/src/ui/layout_delizia/ui_firmware.rs @@ -900,7 +900,6 @@ 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>, 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 862bb24bf7..cd7cade7b6 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 @@ -147,23 +147,17 @@ enum ActiveScreen<'a> { 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 // as defined by `enum Subscreen` (DeviceScreen is still a VerticalMenuScreen!) // This way we only need to keep one screen at any time in memory. active_screen: GcBox>, - // Information needed to construct any subscreen on demand submenus: GcBox>, subscreens: Vec, - // index of the current subscreen in the list of subscreens active_subscreen: usize, - // stack of parents that led to the current subscreen parent_subscreens: Vec, } @@ -171,20 +165,14 @@ pub struct DeviceMenuScreen<'a> { 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 - // (see component_msg_obj.rs, which currently just returns "DeviceDisconnect" with no - // index!) paired_devices: Vec, 1>, auto_lock_delay: TString<'static>, ) -> Result { let mut screen = Self { bounds: Rect::zero(), - battery_percentage, firmware_version, active_screen: GcBox::new(ActiveScreen::Empty)?, active_subscreen: 0, @@ -219,10 +207,6 @@ impl<'a> DeviceMenuScreen<'a> { Ok(screen) } - fn is_low_battery(&self) -> bool { - self.battery_percentage < 20 - } - fn add_paired_devices_menu( &mut self, paired_devices: Vec, 1>, @@ -397,14 +381,7 @@ impl<'a> DeviceMenuScreen<'a> { } let mut header = Header::new(submenu.header_text).with_close_button(); if submenu.show_battery { - header = header.with_icon( - theme::ICON_BATTERY_ZAP, - if self.is_low_battery() { - theme::YELLOW - } else { - theme::GREEN_LIME - }, - ); + // TODO: add battery } else { header = header.with_left_button( Button::with_icon(theme::ICON_CHEVRON_LEFT), 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 42c0296534..edcf3ceb7c 100644 --- a/core/embed/rust/src/ui/layout_eckhart/ui_firmware.rs +++ b/core/embed/rust/src/ui/layout_eckhart/ui_firmware.rs @@ -1018,7 +1018,6 @@ 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>, @@ -1026,7 +1025,6 @@ impl FirmwareUI for UIEckhart { ) -> Result { let layout = RootComponent::new(DeviceMenuScreen::new( failed_backup, - battery_percentage, firmware_version, device_name, paired_devices, diff --git a/core/embed/rust/src/ui/ui_firmware.rs b/core/embed/rust/src/ui/ui_firmware.rs index 654183ebb2..fc10b183e4 100644 --- a/core/embed/rust/src/ui/ui_firmware.rs +++ b/core/embed/rust/src/ui/ui_firmware.rs @@ -315,7 +315,6 @@ 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>, diff --git a/core/mocks/generated/trezorui_api.pyi b/core/mocks/generated/trezorui_api.pyi index af7c57fd7c..4dfb21b581 100644 --- a/core/mocks/generated/trezorui_api.pyi +++ b/core/mocks/generated/trezorui_api.pyi @@ -553,7 +553,6 @@ def show_homescreen( def show_device_menu( *, failed_backup: bool, - battery_percentage: int, firmware_version: str, device_name: str, paired_devices: Iterable[str], diff --git a/core/src/apps/homescreen/device_menu.py b/core/src/apps/homescreen/device_menu.py index 4a478b5e3f..af871b8b49 100644 --- a/core/src/apps/homescreen/device_menu.py +++ b/core/src/apps/homescreen/device_menu.py @@ -36,7 +36,6 @@ async def handle_device_menu() -> None: storage.device.is_initialized() and storage.device.unfinished_backup() ) # MOCK DATA - battery_percentage = 22 paired_devices = ["Trezor Suite"] if ble.is_connected() else [] # ### firmware_version = ".".join(map(str, utils.VERSION)) @@ -53,7 +52,6 @@ async def handle_device_menu() -> None: menu_result = await interact( trezorui_api.show_device_menu( failed_backup=failed_backup, - battery_percentage=battery_percentage, paired_devices=paired_devices, firmware_version=firmware_version, device_name=device_name,