From 5c2e7f9e08edaf04815d21c44aaf0686560c75c4 Mon Sep 17 00:00:00 2001 From: Willy-JL <49810075+Willy-JL@users.noreply.github.com> Date: Thu, 8 Jun 2023 15:53:24 +0100 Subject: [PATCH] Auto unlock rpc for u2f --- .../main/u2f/scenes/u2f_scene_error.c | 25 ------------------- applications/main/u2f/u2f_app.c | 14 ++++------- applications/main/u2f/u2f_app_i.h | 1 - 3 files changed, 5 insertions(+), 35 deletions(-) diff --git a/applications/main/u2f/scenes/u2f_scene_error.c b/applications/main/u2f/scenes/u2f_scene_error.c index 33839a61a..36e490f1c 100644 --- a/applications/main/u2f/scenes/u2f_scene_error.c +++ b/applications/main/u2f/scenes/u2f_scene_error.c @@ -25,31 +25,6 @@ void u2f_scene_error_on_enter(void* context) { "No SD card or\napp data found.\nThis app will not\nwork without\nrequired files."); widget_add_button_element( app->widget, GuiButtonTypeLeft, "Back", u2f_scene_error_event_callback, app); - } else if(app->error == U2fAppErrorCloseRpc) { - widget_add_icon_element(app->widget, 78, 0, &I_ActiveConnection_50x64); - if(XTREME_SETTINGS()->is_nsfw) { - widget_add_string_multiline_element( - app->widget, 3, 2, AlignLeft, AlignTop, FontPrimary, "I am not\na whore!"); - widget_add_string_multiline_element( - app->widget, - 3, - 30, - AlignLeft, - AlignTop, - FontSecondary, - "Pull out from\nPC or phone to\nuse me like this."); - } else { - widget_add_string_multiline_element( - app->widget, 3, 2, AlignLeft, AlignTop, FontPrimary, "Connection\nis active!"); - widget_add_string_multiline_element( - app->widget, - 3, - 30, - AlignLeft, - AlignTop, - FontSecondary, - "Disconnect from\nPC or phone to\nuse this function."); - } } view_dispatcher_switch_to_view(app->view_dispatcher, U2fAppViewError); diff --git a/applications/main/u2f/u2f_app.c b/applications/main/u2f/u2f_app.c index db94a398c..1c8db40d0 100644 --- a/applications/main/u2f/u2f_app.c +++ b/applications/main/u2f/u2f_app.c @@ -49,16 +49,12 @@ U2fApp* u2f_app_alloc() { view_dispatcher_add_view( app->view_dispatcher, U2fAppViewMain, u2f_view_get_view(app->u2f_view)); - if(furi_hal_usb_is_locked()) { - app->error = U2fAppErrorCloseRpc; - scene_manager_next_scene(app->scene_manager, U2fSceneError); + furi_hal_usb_unlock(); + if(u2f_data_check(true)) { + scene_manager_next_scene(app->scene_manager, U2fSceneMain); } else { - if(u2f_data_check(true)) { - scene_manager_next_scene(app->scene_manager, U2fSceneMain); - } else { - app->error = U2fAppErrorNoFiles; - scene_manager_next_scene(app->scene_manager, U2fSceneError); - } + app->error = U2fAppErrorNoFiles; + scene_manager_next_scene(app->scene_manager, U2fSceneError); } return app; diff --git a/applications/main/u2f/u2f_app_i.h b/applications/main/u2f/u2f_app_i.h index 2896684c3..7a06caf05 100644 --- a/applications/main/u2f/u2f_app_i.h +++ b/applications/main/u2f/u2f_app_i.h @@ -18,7 +18,6 @@ typedef enum { U2fAppErrorNoFiles, - U2fAppErrorCloseRpc, } U2fAppError; typedef enum {