From 7e7df47a09330ac53a31bf429feb641fb44f2a13 Mon Sep 17 00:00:00 2001 From: Eric Betts Date: Wed, 27 Sep 2023 01:06:26 -0700 Subject: [PATCH] Picopass: populate key change input with first key of user dictionary (#54) --- picopass/scenes/picopass_scene_key_menu.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/picopass/scenes/picopass_scene_key_menu.c b/picopass/scenes/picopass_scene_key_menu.c index 21d8a526dea..c655c10eb69 100644 --- a/picopass/scenes/picopass_scene_key_menu.c +++ b/picopass/scenes/picopass_scene_key_menu.c @@ -91,9 +91,16 @@ bool picopass_scene_key_menu_on_event(void* context, SceneManagerEvent event) { scene_manager_next_scene(picopass->scene_manager, PicopassSceneWriteKey); consumed = true; } else if(event.event == SubmenuIndexWriteCustom) { + // If user dictionary, prepopulate with the first key + if(iclass_elite_dict_check_presence(IclassEliteDictTypeUser)) { + IclassEliteDict* dict = iclass_elite_dict_alloc(IclassEliteDictTypeUser); + iclass_elite_dict_get_next_key(dict, picopass->byte_input_store); + iclass_elite_dict_free(dict); + } + scene_manager_set_scene_state( picopass->scene_manager, PicopassSceneKeyMenu, SubmenuIndexWriteCustom); - // Key and elite_kdf = true are both set in key_input scene + // Key and elite_kdf = true are both set in key_input scene after the value is input scene_manager_next_scene(picopass->scene_manager, PicopassSceneKeyInput); consumed = true; }