Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add show_from function on multipage menu #212

Merged
merged 2 commits into from
Nov 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions ledger_device_sdk/src/ui/gadgets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -554,19 +554,26 @@ impl<'a> MultiPageMenu<'a> {
}

pub fn show<T: TryFrom<ApduHeader>>(&mut self) -> EventOrPageIndex<T>
where
Reply: From<<T as TryFrom<ApduHeader>>::Error>,
{
self.show_from(0)
}

pub fn show_from<T: TryFrom<ApduHeader>>(&mut self, page_index: usize) -> EventOrPageIndex<T>
where
Reply: From<<T as TryFrom<ApduHeader>>::Error>,
{
clear_screen();

self.pages[0].place();
self.pages[page_index].place();

LEFT_ARROW.display();
RIGHT_ARROW.display();

crate::ui::screen_util::screen_update();

let mut index = 0;
let mut index = page_index;

loop {
match self.comm.next_event() {
Expand Down
Loading