Implemented Scan card menu

This commit was merged in pull request #29.
This commit is contained in:
2026-08-22 13:35:58 +02:00
parent cf6c068394
commit b44ae59c8b
14 changed files with 189 additions and 89 deletions
+24 -9
View File
@@ -1,4 +1,6 @@
use crate::display::primary_lcd::PrimaryLcdDisplay;
use crate::navigation::navigation::CARD_DATA;
use crate::navigation::navigation::NewState;
use alloc::format;
use embedded_graphics::Drawable;
@@ -82,16 +84,29 @@ impl Navigable for ScanMenu {
core::future::ready(())
}
fn handle_input(&self, input: Action) -> impl core::future::Future<Output = View> + Send {
fn handle_input(&self, input: Action) -> impl core::future::Future<Output = NewState> + Send {
async move {
let new_progress = match input {
Action::Up => self.progress.wrapping_add(5),
_ => self.progress,
};
View::Scan(ScanMenu {
progress: new_progress,
})
log::info!("Scan view detected, checking for NFC card data");
if let Some(card_data) = CARD_DATA.lock().await.take() {
log::info!("NFC Card to be displayed: {:?}", card_data);
NewState {
view: View::Card(crate::views::card_view::CardView { card: card_data }),
replace_view: true,
redraw: true,
}
} else {
let new_progress = match input {
Action::Up => self.progress.wrapping_add(5),
_ => self.progress,
};
NewState {
view: View::Scan(ScanMenu {
progress: new_progress,
}),
replace_view: true,
redraw: matches!(input, Action::Up | Action::Timer),
}
}
}
}
}