mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-06-18 20:29:44 -07:00
Show set dates in MRTD auth menu
This commit is contained in:
@@ -37,10 +37,23 @@ void nfc_scene_passport_bac_on_enter(void* context) {
|
||||
VariableItem* item;
|
||||
uint8_t value_index;
|
||||
|
||||
variable_item_list_add(variable_item_list, "Birth Date", 1, NULL, NULL);
|
||||
//TODO: show dates in menu?
|
||||
const size_t temp_str_size = 10;
|
||||
char temp_str[temp_str_size];
|
||||
snprintf(temp_str, temp_str_size, "%02u%02u%02u",
|
||||
nfc->dev->dev_data.mrtd_data.auth.bac.birth_date.year,
|
||||
nfc->dev->dev_data.mrtd_data.auth.bac.birth_date.month,
|
||||
nfc->dev->dev_data.mrtd_data.auth.bac.birth_date.day);
|
||||
|
||||
variable_item_list_add(variable_item_list, "Expiry Date", 1, NULL, NULL);
|
||||
item = variable_item_list_add(variable_item_list, "Birth Date", 1, NULL, NULL);
|
||||
variable_item_set_current_value_text(item, temp_str);
|
||||
|
||||
snprintf(temp_str, temp_str_size, "%02u%02u%02u",
|
||||
nfc->dev->dev_data.mrtd_data.auth.bac.expiry_date.year,
|
||||
nfc->dev->dev_data.mrtd_data.auth.bac.expiry_date.month,
|
||||
nfc->dev->dev_data.mrtd_data.auth.bac.expiry_date.day);
|
||||
|
||||
item = variable_item_list_add(variable_item_list, "Expiry Date", 1, NULL, NULL);
|
||||
variable_item_set_current_value_text(item, temp_str);
|
||||
|
||||
variable_item_list_add(variable_item_list, "Document Nr.", 1, NULL, NULL);
|
||||
//TODO: add scene to enter docnr, based on nfc_scene_passport_date.c
|
||||
|
||||
@@ -43,13 +43,17 @@ void nfc_scene_passport_date_on_enter(void* context) {
|
||||
nfc_text_store_set(nfc, "YYMMDD");
|
||||
date_empty = true;
|
||||
} else {
|
||||
char temp_str[10];
|
||||
snprintf(
|
||||
nfc->text_store,
|
||||
DATE_LENGTH + 1,
|
||||
temp_str,
|
||||
10,
|
||||
"%02u%02u%02u",
|
||||
date_value.year % 100,
|
||||
date_value.month % 112,
|
||||
date_value.day % 31); // incl. '\x00'
|
||||
date_value.year,
|
||||
date_value.month,
|
||||
date_value.day);
|
||||
|
||||
memcpy(nfc->text_store, temp_str, DATE_LENGTH);
|
||||
nfc->text_store[DATE_LENGTH] = '\x00';
|
||||
}
|
||||
|
||||
text_input_set_result_callback(
|
||||
@@ -66,8 +70,6 @@ void nfc_scene_passport_date_on_enter(void* context) {
|
||||
}
|
||||
|
||||
bool nfc_scene_passport_date_save(Nfc* nfc) {
|
||||
FURI_LOG_D(TAG, "Value2: %s", nfc->text_store);
|
||||
|
||||
int year;
|
||||
int month;
|
||||
int day;
|
||||
@@ -104,8 +106,6 @@ bool nfc_scene_passport_date_on_event(void* context, SceneManagerEvent event) {
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == NfcCustomEventTextInputDone) {
|
||||
FURI_LOG_D(TAG, "Value: %s", nfc->text_store);
|
||||
|
||||
nfc_scene_passport_date_save(nfc);
|
||||
//TODO: handle invalid date (returned false)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user