MRTD popup "PACE todo"

This commit is contained in:
Chris van Marle
2022-10-11 22:12:52 +02:00
parent 67eff89a09
commit 9b861e2313
3 changed files with 45 additions and 2 deletions
+2 -2
View File
@@ -37,9 +37,9 @@ ADD_SCENE(nfc, emv_read_success, EmvReadSuccess)
ADD_SCENE(nfc, emv_menu, EmvMenu)
ADD_SCENE(nfc, passport_read, PassportReadSuccess)
ADD_SCENE(nfc, passport_menu, PassportMenu)
ADD_SCENE(nfc, passport_bac, PassportBac)
//ADD_SCENE(nfc, passport_pace, PassportPace)
ADD_SCENE(nfc, passport_bac, PassportBac) //TODO: rename to Auth
ADD_SCENE(nfc, passport_date, PassportDate)
ADD_SCENE(nfc, passport_pace_todo, PassportPaceTodo)
ADD_SCENE(nfc, emulate_apdu_sequence, EmulateApduSequence)
ADD_SCENE(nfc, device_info, DeviceInfo)
ADD_SCENE(nfc, delete, Delete)
@@ -100,6 +100,9 @@ bool nfc_scene_passport_bac_on_event(void* context, SceneManagerEvent event) {
consumed = true;
break;
case NfcScenePassportAuthSelectAuth:
if(nfc->dev->dev_data.mrtd_data.auth.method == MrtdAuthMethodPace) {
scene_manager_next_scene(nfc->scene_manager, NfcScenePassportPaceTodo);
}
consumed = true;
break;
}
@@ -0,0 +1,40 @@
#include "../nfc_i.h"
void nfc_scene_passport_pace_todo_popup_callback(void* context) {
Nfc* nfc = context;
view_dispatcher_send_custom_event(nfc->view_dispatcher, NfcCustomEventViewExit);
}
void nfc_scene_passport_pace_todo_on_enter(void* context) {
Nfc* nfc = context;
// Setup view
Popup* popup = nfc->popup;
popup_set_icon(popup, 0, 2, &I_DolphinCommon_56x48);
popup_set_header(popup, "PACE not yet implemented", 0, 19, AlignLeft, AlignBottom);
popup_set_timeout(popup, 2000);
popup_set_context(popup, nfc);
popup_set_callback(popup, nfc_scene_passport_pace_todo_popup_callback);
popup_enable_timeout(popup);
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewPopup);
}
bool nfc_scene_passport_pace_todo_on_event(void* context, SceneManagerEvent event) {
Nfc* nfc = context;
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
if(event.event == NfcCustomEventViewExit) {
consumed = scene_manager_search_and_switch_to_previous_scene(
nfc->scene_manager, NfcScenePassportBac);
}
}
return consumed;
}
void nfc_scene_passport_pace_todo_on_exit(void* context) {
Nfc* nfc = context;
// Clear view
popup_reset(nfc->popup);
}