Fix minor UI inconsistencies and bugs (#2361)

* Changed blue LED to cyan in NFC Magic and Picopass apps.
* Fix capitalization of ATQA and UID in NFC Add Manually wizard.
* Fix reselection of "Saved" menu item in NFC and RFID apps.
* Fix double back press after deleting a file in the SubGhz browser.
* Make NFC app behave like other apps: return to the file browser after deleting a file.
* Rename NfcSceneSetAtqua to NfcSceneSetAtqa.
* Save selected menu items in NFC Magic and Picopass apps in a way that always works.
* Restore previous selection in Universal Remotes menu.
* Other way to do universal remote menu saving, and NFC Extra Actions saves last selection.

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
Liam Hays 2023-02-08 01:08:50 -07:00 committed by GitHub
parent 7a3a1aaf0d
commit 111c7557b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 55 additions and 17 deletions

View File

@ -33,7 +33,8 @@ void infrared_scene_universal_on_enter(void* context) {
SubmenuIndexUniversalAC, SubmenuIndexUniversalAC,
infrared_scene_universal_submenu_callback, infrared_scene_universal_submenu_callback,
context); context);
submenu_set_selected_item(submenu, 0); submenu_set_selected_item(
submenu, scene_manager_get_scene_state(infrared->scene_manager, InfraredSceneUniversal));
view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewSubmenu); view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewSubmenu);
} }
@ -54,6 +55,7 @@ bool infrared_scene_universal_on_event(void* context, SceneManagerEvent event) {
scene_manager_next_scene(scene_manager, InfraredSceneUniversalAudio); scene_manager_next_scene(scene_manager, InfraredSceneUniversalAudio);
consumed = true; consumed = true;
} }
scene_manager_set_scene_state(scene_manager, InfraredSceneUniversal, event.event);
} }
return consumed; return consumed;

View File

@ -47,21 +47,28 @@ bool lfrfid_scene_start_on_event(void* context, SceneManagerEvent event) {
if(event.type == SceneManagerEventTypeCustom) { if(event.type == SceneManagerEventTypeCustom) {
if(event.event == SubmenuIndexRead) { if(event.event == SubmenuIndexRead) {
scene_manager_set_scene_state(app->scene_manager, LfRfidSceneStart, SubmenuIndexRead);
scene_manager_next_scene(app->scene_manager, LfRfidSceneRead); scene_manager_next_scene(app->scene_manager, LfRfidSceneRead);
DOLPHIN_DEED(DolphinDeedRfidRead); DOLPHIN_DEED(DolphinDeedRfidRead);
consumed = true; consumed = true;
} else if(event.event == SubmenuIndexSaved) { } else if(event.event == SubmenuIndexSaved) {
// Like in the other apps, explicitly save the scene state
// in each branch in case the user cancels loading a file.
scene_manager_set_scene_state(app->scene_manager, LfRfidSceneStart, SubmenuIndexSaved);
furi_string_set(app->file_path, LFRFID_APP_FOLDER); furi_string_set(app->file_path, LFRFID_APP_FOLDER);
scene_manager_next_scene(app->scene_manager, LfRfidSceneSelectKey); scene_manager_next_scene(app->scene_manager, LfRfidSceneSelectKey);
consumed = true; consumed = true;
} else if(event.event == SubmenuIndexAddManually) { } else if(event.event == SubmenuIndexAddManually) {
scene_manager_set_scene_state(
app->scene_manager, LfRfidSceneStart, SubmenuIndexAddManually);
scene_manager_next_scene(app->scene_manager, LfRfidSceneSaveType); scene_manager_next_scene(app->scene_manager, LfRfidSceneSaveType);
consumed = true; consumed = true;
} else if(event.event == SubmenuIndexExtraActions) { } else if(event.event == SubmenuIndexExtraActions) {
scene_manager_set_scene_state(
app->scene_manager, LfRfidSceneStart, SubmenuIndexExtraActions);
scene_manager_next_scene(app->scene_manager, LfRfidSceneExtraActions); scene_manager_next_scene(app->scene_manager, LfRfidSceneExtraActions);
consumed = true; consumed = true;
} }
scene_manager_set_scene_state(app->scene_manager, LfRfidSceneStart, event.event);
} }
return consumed; return consumed;

View File

@ -4,7 +4,7 @@ ADD_SCENE(nfc, saved_menu, SavedMenu)
ADD_SCENE(nfc, extra_actions, ExtraActions) ADD_SCENE(nfc, extra_actions, ExtraActions)
ADD_SCENE(nfc, set_type, SetType) ADD_SCENE(nfc, set_type, SetType)
ADD_SCENE(nfc, set_sak, SetSak) ADD_SCENE(nfc, set_sak, SetSak)
ADD_SCENE(nfc, set_atqa, SetAtqua) ADD_SCENE(nfc, set_atqa, SetAtqa)
ADD_SCENE(nfc, set_uid, SetUid) ADD_SCENE(nfc, set_uid, SetUid)
ADD_SCENE(nfc, generate_info, GenerateInfo) ADD_SCENE(nfc, generate_info, GenerateInfo)
ADD_SCENE(nfc, read_card_success, ReadCardSuccess) ADD_SCENE(nfc, read_card_success, ReadCardSuccess)

View File

@ -30,7 +30,7 @@ bool nfc_scene_delete_success_on_event(void* context, SceneManagerEvent event) {
nfc->scene_manager, NfcSceneMfClassicKeys); nfc->scene_manager, NfcSceneMfClassicKeys);
} else { } else {
consumed = scene_manager_search_and_switch_to_previous_scene( consumed = scene_manager_search_and_switch_to_previous_scene(
nfc->scene_manager, NfcSceneStart); nfc->scene_manager, NfcSceneFileSelect);
} }
} }
} }

View File

@ -34,6 +34,8 @@ void nfc_scene_extra_actions_on_enter(void* context) {
SubmenuIndexMfUltralightUnlock, SubmenuIndexMfUltralightUnlock,
nfc_scene_extra_actions_submenu_callback, nfc_scene_extra_actions_submenu_callback,
nfc); nfc);
submenu_set_selected_item(
submenu, scene_manager_get_scene_state(nfc->scene_manager, NfcSceneExtraActions));
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewMenu); view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewMenu);
} }

View File

@ -11,7 +11,7 @@ void nfc_scene_set_atqa_on_enter(void* context) {
// Setup view // Setup view
ByteInput* byte_input = nfc->byte_input; ByteInput* byte_input = nfc->byte_input;
byte_input_set_header_text(byte_input, "Enter atqa in hex"); byte_input_set_header_text(byte_input, "Enter ATQA in hex");
byte_input_set_result_callback( byte_input_set_result_callback(
byte_input, byte_input,
nfc_scene_set_atqa_byte_input_callback, nfc_scene_set_atqa_byte_input_callback,

View File

@ -28,7 +28,7 @@ bool nfc_scene_set_sak_on_event(void* context, SceneManagerEvent event) {
if(event.type == SceneManagerEventTypeCustom) { if(event.type == SceneManagerEventTypeCustom) {
if(event.event == NfcCustomEventByteInputDone) { if(event.event == NfcCustomEventByteInputDone) {
scene_manager_next_scene(nfc->scene_manager, NfcSceneSetAtqua); scene_manager_next_scene(nfc->scene_manager, NfcSceneSetAtqa);
consumed = true; consumed = true;
} }
} }

View File

@ -11,7 +11,7 @@ void nfc_scene_set_uid_on_enter(void* context) {
// Setup view // Setup view
ByteInput* byte_input = nfc->byte_input; ByteInput* byte_input = nfc->byte_input;
byte_input_set_header_text(byte_input, "Enter uid in hex"); byte_input_set_header_text(byte_input, "Enter UID in hex");
nfc->dev_edit_data = nfc->dev->dev_data.nfc_data; nfc->dev_edit_data = nfc->dev->dev_data.nfc_data;
byte_input_set_result_callback( byte_input_set_result_callback(
byte_input, byte_input,

View File

@ -48,11 +48,14 @@ bool nfc_scene_start_on_event(void* context, SceneManagerEvent event) {
if(event.type == SceneManagerEventTypeCustom) { if(event.type == SceneManagerEventTypeCustom) {
if(event.event == SubmenuIndexRead) { if(event.event == SubmenuIndexRead) {
scene_manager_set_scene_state(nfc->scene_manager, NfcSceneStart, SubmenuIndexRead);
nfc->dev->dev_data.read_mode = NfcReadModeAuto; nfc->dev->dev_data.read_mode = NfcReadModeAuto;
scene_manager_next_scene(nfc->scene_manager, NfcSceneRead); scene_manager_next_scene(nfc->scene_manager, NfcSceneRead);
DOLPHIN_DEED(DolphinDeedNfcRead); DOLPHIN_DEED(DolphinDeedNfcRead);
consumed = true; consumed = true;
} else if(event.event == SubmenuIndexDetectReader) { } else if(event.event == SubmenuIndexDetectReader) {
scene_manager_set_scene_state(
nfc->scene_manager, NfcSceneStart, SubmenuIndexDetectReader);
bool sd_exist = storage_sd_status(nfc->dev->storage) == FSE_OK; bool sd_exist = storage_sd_status(nfc->dev->storage) == FSE_OK;
if(sd_exist) { if(sd_exist) {
nfc_device_data_clear(&nfc->dev->dev_data); nfc_device_data_clear(&nfc->dev->dev_data);
@ -63,19 +66,27 @@ bool nfc_scene_start_on_event(void* context, SceneManagerEvent event) {
} }
consumed = true; consumed = true;
} else if(event.event == SubmenuIndexSaved) { } else if(event.event == SubmenuIndexSaved) {
// Save the scene state explicitly in each branch, so that
// if the user cancels loading a file, the Saved menu item
// is properly reselected.
scene_manager_set_scene_state(nfc->scene_manager, NfcSceneStart, SubmenuIndexSaved);
scene_manager_next_scene(nfc->scene_manager, NfcSceneFileSelect); scene_manager_next_scene(nfc->scene_manager, NfcSceneFileSelect);
consumed = true; consumed = true;
} else if(event.event == SubmenuIndexExtraAction) { } else if(event.event == SubmenuIndexExtraAction) {
scene_manager_set_scene_state(
nfc->scene_manager, NfcSceneStart, SubmenuIndexExtraAction);
scene_manager_next_scene(nfc->scene_manager, NfcSceneExtraActions); scene_manager_next_scene(nfc->scene_manager, NfcSceneExtraActions);
consumed = true; consumed = true;
} else if(event.event == SubmenuIndexAddManually) { } else if(event.event == SubmenuIndexAddManually) {
scene_manager_set_scene_state(
nfc->scene_manager, NfcSceneStart, SubmenuIndexAddManually);
scene_manager_next_scene(nfc->scene_manager, NfcSceneSetType); scene_manager_next_scene(nfc->scene_manager, NfcSceneSetType);
consumed = true; consumed = true;
} else if(event.event == SubmenuIndexDebug) { } else if(event.event == SubmenuIndexDebug) {
scene_manager_set_scene_state(nfc->scene_manager, NfcSceneStart, SubmenuIndexDebug);
scene_manager_next_scene(nfc->scene_manager, NfcSceneDebug); scene_manager_next_scene(nfc->scene_manager, NfcSceneDebug);
consumed = true; consumed = true;
} }
scene_manager_set_scene_state(nfc->scene_manager, NfcSceneStart, event.event);
} }
return consumed; return consumed;
} }

View File

@ -31,7 +31,10 @@ bool subghz_scene_delete_success_on_event(void* context, SceneManagerEvent event
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneReadRAW); scene_manager_next_scene(subghz->scene_manager, SubGhzSceneReadRAW);
} else if(scene_manager_search_and_switch_to_previous_scene( } else if(scene_manager_search_and_switch_to_previous_scene(
subghz->scene_manager, SubGhzSceneSaved)) { subghz->scene_manager, SubGhzSceneSaved)) {
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneSaved); // Commented so that the user doesn't have to press
// back twice to get to the main SubGhz menu after
// deleting a file.
//scene_manager_next_scene(subghz->scene_manager, SubGhzSceneSaved);
} else { } else {
scene_manager_search_and_switch_to_previous_scene( scene_manager_search_and_switch_to_previous_scene(
subghz->scene_manager, SubGhzSceneStart); subghz->scene_manager, SubGhzSceneStart);

View File

@ -136,9 +136,9 @@ void nfc_magic_free(NfcMagic* nfc_magic) {
free(nfc_magic); free(nfc_magic);
} }
static const NotificationSequence nfc_magic_sequence_blink_start_blue = { static const NotificationSequence nfc_magic_sequence_blink_start_cyan = {
&message_blink_start_10, &message_blink_start_10,
&message_blink_set_color_blue, &message_blink_set_color_cyan,
&message_do_not_reset, &message_do_not_reset,
NULL, NULL,
}; };
@ -149,7 +149,7 @@ static const NotificationSequence nfc_magic_sequence_blink_stop = {
}; };
void nfc_magic_blink_start(NfcMagic* nfc_magic) { void nfc_magic_blink_start(NfcMagic* nfc_magic) {
notification_message(nfc_magic->notifications, &nfc_magic_sequence_blink_start_blue); notification_message(nfc_magic->notifications, &nfc_magic_sequence_blink_start_cyan);
} }
void nfc_magic_blink_stop(NfcMagic* nfc_magic) { void nfc_magic_blink_stop(NfcMagic* nfc_magic) {

View File

@ -40,16 +40,24 @@ bool nfc_magic_scene_start_on_event(void* context, SceneManagerEvent event) {
if(event.type == SceneManagerEventTypeCustom) { if(event.type == SceneManagerEventTypeCustom) {
if(event.event == SubmenuIndexCheck) { if(event.event == SubmenuIndexCheck) {
scene_manager_set_scene_state(
nfc_magic->scene_manager, NfcMagicSceneStart, SubmenuIndexCheck);
scene_manager_next_scene(nfc_magic->scene_manager, NfcMagicSceneCheck); scene_manager_next_scene(nfc_magic->scene_manager, NfcMagicSceneCheck);
consumed = true; consumed = true;
} else if(event.event == SubmenuIndexWriteGen1A) { } else if(event.event == SubmenuIndexWriteGen1A) {
// Explicitly save state in each branch so that the
// correct option is reselected if the user cancels
// loading a file.
scene_manager_set_scene_state(
nfc_magic->scene_manager, NfcMagicSceneStart, SubmenuIndexWriteGen1A);
scene_manager_next_scene(nfc_magic->scene_manager, NfcMagicSceneFileSelect); scene_manager_next_scene(nfc_magic->scene_manager, NfcMagicSceneFileSelect);
consumed = true; consumed = true;
} else if(event.event == SubmenuIndexWipe) { } else if(event.event == SubmenuIndexWipe) {
scene_manager_set_scene_state(
nfc_magic->scene_manager, NfcMagicSceneStart, SubmenuIndexWipe);
scene_manager_next_scene(nfc_magic->scene_manager, NfcMagicSceneWipe); scene_manager_next_scene(nfc_magic->scene_manager, NfcMagicSceneWipe);
consumed = true; consumed = true;
} }
scene_manager_set_scene_state(nfc_magic->scene_manager, NfcMagicSceneStart, event.event);
} }
return consumed; return consumed;

View File

@ -137,9 +137,9 @@ void picopass_text_store_clear(Picopass* picopass) {
memset(picopass->text_store, 0, sizeof(picopass->text_store)); memset(picopass->text_store, 0, sizeof(picopass->text_store));
} }
static const NotificationSequence picopass_sequence_blink_start_blue = { static const NotificationSequence picopass_sequence_blink_start_cyan = {
&message_blink_start_10, &message_blink_start_10,
&message_blink_set_color_blue, &message_blink_set_color_cyan,
&message_do_not_reset, &message_do_not_reset,
NULL, NULL,
}; };
@ -150,7 +150,7 @@ static const NotificationSequence picopass_sequence_blink_stop = {
}; };
void picopass_blink_start(Picopass* picopass) { void picopass_blink_start(Picopass* picopass) {
notification_message(picopass->notifications, &picopass_sequence_blink_start_blue); notification_message(picopass->notifications, &picopass_sequence_blink_start_cyan);
} }
void picopass_blink_stop(Picopass* picopass) { void picopass_blink_stop(Picopass* picopass) {

View File

@ -32,13 +32,18 @@ bool picopass_scene_start_on_event(void* context, SceneManagerEvent event) {
if(event.type == SceneManagerEventTypeCustom) { if(event.type == SceneManagerEventTypeCustom) {
if(event.event == SubmenuIndexRead) { if(event.event == SubmenuIndexRead) {
scene_manager_set_scene_state(
picopass->scene_manager, PicopassSceneStart, SubmenuIndexRead);
scene_manager_next_scene(picopass->scene_manager, PicopassSceneReadCard); scene_manager_next_scene(picopass->scene_manager, PicopassSceneReadCard);
consumed = true; consumed = true;
} else if(event.event == SubmenuIndexSaved) { } else if(event.event == SubmenuIndexSaved) {
// Explicitly save state so that the correct item is
// reselected if the user cancels loading a file.
scene_manager_set_scene_state(
picopass->scene_manager, PicopassSceneStart, SubmenuIndexSaved);
scene_manager_next_scene(picopass->scene_manager, PicopassSceneFileSelect); scene_manager_next_scene(picopass->scene_manager, PicopassSceneFileSelect);
consumed = true; consumed = true;
} }
scene_manager_set_scene_state(picopass->scene_manager, PicopassSceneStart, event.event);
} }
return consumed; return consumed;