Skip to content

Commit

Permalink
main.rs: Use display_pending_review() from SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
Xavier Chapron committed Dec 15, 2023
1 parent 90d176f commit 9f9eafe
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 66 deletions.
154 changes: 112 additions & 42 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["yhql", "agrojean-ledger"]
edition = "2021"

[dependencies]
ledger_device_sdk = "1.2.0"
ledger_device_sdk = "1.3.0"
ledger_secure_sdk_sys = "1.0.2"
include_gif = "1.0.1"
serde = {version="1.0.192", default_features = false, features = ["derive"]}
Expand Down
27 changes: 4 additions & 23 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ use handlers::{
sign_tx::{handler_sign_tx, TxContext},
};
use ledger_device_sdk::io::{ApduHeader, Comm, Event, Reply, StatusWords};
use ledger_device_sdk::ui::gadgets::display_pending_review;


ledger_device_sdk::set_panic!(ledger_device_sdk::exiting_panic);

Expand Down Expand Up @@ -114,33 +116,12 @@ impl TryFrom<ApduHeader> for Instruction {
}
}

// Developer mode / pending review popup
// must be cleared with user interaction
fn display_pending_review(comm: &mut Comm) {
use ledger_device_sdk::buttons::ButtonEvent::{
BothButtonsRelease, LeftButtonRelease, RightButtonRelease,
};
use ledger_device_sdk::ui::gadgets::clear_screen;
use ledger_device_sdk::ui::layout::{Layout, Location, StringPlace};
use ledger_device_sdk::ui::screen_util::screen_update;

clear_screen();
"Pending Review".place(Location::Middle, Layout::Centered, false);
screen_update();

loop {
if let Event::Button(LeftButtonRelease | RightButtonRelease | BothButtonsRelease) =
comm.next_event::<ApduHeader>()
{
break;
}
}
}

#[no_mangle]
extern "C" fn sample_main() {
let mut comm = Comm::new();

// Developer mode / pending review popup
// must be cleared with user interaction
display_pending_review(&mut comm);

let mut tx_ctx = TxContext::new();
Expand Down

0 comments on commit 9f9eafe

Please sign in to comment.