Skip to content

Commit

Permalink
Rename NbglAddressConfirm to NbglAddressReview to match with C API na…
Browse files Browse the repository at this point in the history
…mes.
  • Loading branch information
agrojean-ledger committed May 27, 2024
1 parent dbe7ade commit d35bc49
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions ledger_device_sdk/examples/nbgl_address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use ledger_device_sdk as _;

use include_gif::include_gif;
use ledger_device_sdk::io::*;
use ledger_device_sdk::nbgl::{init_comm, NbglAddressConfirm, NbglGlyph};
use ledger_device_sdk::nbgl::{init_comm, NbglAddressReview, NbglGlyph};
use ledger_secure_sdk_sys::*;

#[no_mangle]
Expand All @@ -26,5 +26,5 @@ extern "C" fn sample_main() {
const FERRIS: NbglGlyph =
NbglGlyph::from_include(include_gif!("examples/crab_64x64.gif", NBGL));
// Display the address confirmation screen.
NbglAddressConfirm::new().glyph(&FERRIS).show(addr_hex);
NbglAddressReview::new().glyph(&FERRIS).show(addr_hex);
}
20 changes: 10 additions & 10 deletions ledger_device_sdk/src/nbgl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ impl<'a> NbglHomeAndSettings<'a> {
}
}
_ => {
panic!("Unexpected return value from sync_nbgl_useCaseHome");
panic!("Unexpected return value from ux_sync_homeAndSettings");
}
}
}
Expand Down Expand Up @@ -469,30 +469,30 @@ impl<'a, const MAX_FIELD_NUMBER: usize, const STRING_BUFFER_SIZE: usize>

/// A wrapper around the synchronous NBGL ux_sync_addressReview C API binding.
/// Used to display address confirmation screens.
pub struct NbglAddressConfirm<'a> {
pub struct NbglAddressReview<'a> {
icon: *const nbgl_icon_details_t,
glyph: Option<&'a NbglGlyph<'a>>,
verify_str: &'a str,
}

impl<'a> NbglAddressConfirm<'a> {
pub fn new() -> NbglAddressConfirm<'a> {
NbglAddressConfirm {
impl<'a> NbglAddressReview<'a> {
pub fn new() -> NbglAddressReview<'a> {
NbglAddressReview {
verify_str: "Verify address",
icon: core::ptr::null(),
glyph: None,
}
}

pub fn glyph(self, glyph: &'a NbglGlyph) -> NbglAddressConfirm<'a> {
NbglAddressConfirm {
pub fn glyph(self, glyph: &'a NbglGlyph) -> NbglAddressReview<'a> {
NbglAddressReview {
glyph: Some(glyph),
..self
}
}

pub fn verify_str(self, verify_str: &'a str) -> NbglAddressConfirm<'a> {
NbglAddressConfirm { verify_str, ..self }
pub fn verify_str(self, verify_str: &'a str) -> NbglAddressReview<'a> {
NbglAddressReview { verify_str, ..self }
}

pub fn show(&mut self, address: &str) -> bool {
Expand Down Expand Up @@ -524,7 +524,7 @@ impl<'a> NbglAddressConfirm<'a> {
return false;
}
_ => {
panic!("Unexpected return value from sync_nbgl_useCaseTransactionReview");
panic!("Unexpected return value from ux_sync_addressReview");
}
}
}
Expand Down

0 comments on commit d35bc49

Please sign in to comment.