Browse Source

feat: implemented standard navigation patterns (#223) (#224)

* feat: implemented standard navigation patterns (#223)

* CLang format changes

---------

Co-authored-by: akopachov <akopachov@users.noreply.github.com>
Alexander Kopachov 1 year ago
parent
commit
bc062bff65

+ 10 - 7
ui/scenes/authenticate/totp_scene_authenticate.c

@@ -1,6 +1,7 @@
 #include "totp_scene_authenticate.h"
 #include <dialogs/dialogs.h>
 #include <totp_icons.h>
+#include <assets_icons.h>
 #include "../../../types/common.h"
 #include "../../constants.h"
 #include "../../../services/config/config.h"
@@ -79,12 +80,18 @@ bool totp_scene_authenticate_handle_event(
         return true;
     }
 
-    if(event->input.type == InputTypeLong && event->input.key == InputKeyBack) {
+    if(event->input.type == InputTypeShort && event->input.key == InputKeyBack) {
         return false;
     }
 
     SceneState* scene_state = plugin_state->current_scene_state;
-    if(event->input.type == InputTypePress) {
+    if((event->input.type == InputTypeLong || event->input.type == InputTypeRepeat) &&
+       event->input.key == InputKeyBack) {
+        if(scene_state->code_length > 0) {
+            scene_state->code_input[scene_state->code_length - 1] = 0;
+            scene_state->code_length--;
+        }
+    } else if(event->input.type == InputTypePress) {
         switch(event->input.key) {
         case InputKeyUp:
             if(scene_state->code_length < MAX_CODE_LENGTH) {
@@ -139,17 +146,13 @@ bool totp_scene_authenticate_handle_event(
                     SCREEN_HEIGHT_CENTER - 5,
                     AlignCenter,
                     AlignCenter);
-                dialog_message_set_icon(message, &I_DolphinCommon_56x48, 72, 17);
+                dialog_message_set_icon(message, &I_WarningDolphinFlip_45x42, 83, 22);
                 dialog_message_show(plugin_state->dialogs_app, message);
                 dialog_message_free(message);
             }
             break;
         }
         case InputKeyBack:
-            if(scene_state->code_length > 0) {
-                scene_state->code_input[scene_state->code_length - 1] = 0;
-                scene_state->code_length--;
-            }
             break;
         default:
             break;

+ 1 - 1
ui/scenes/generate_token/totp_scene_generate_token.c

@@ -335,7 +335,7 @@ bool totp_scene_generate_token_handle_event(
         return true;
     }
 
-    if(event->input.type == InputTypeLong && event->input.key == InputKeyBack) {
+    if(event->input.type == InputTypePress && event->input.key == InputKeyBack) {
         return false;
     }
 

+ 3 - 2
ui/scenes/standby/standby.c

@@ -1,12 +1,13 @@
 #include "standby.h"
+#include <assets_icons.h>
 #include <totp_icons.h>
 #include "../../constants.h"
 
 void totp_scene_standby_render(Canvas* const canvas) {
-    canvas_draw_icon(canvas, SCREEN_WIDTH - 56, SCREEN_HEIGHT - 48, &I_DolphinCommon_56x48);
+    canvas_draw_icon(canvas, SCREEN_WIDTH - 50, SCREEN_HEIGHT - 44, &I_WarningDolphinFlip_45x42);
 
     canvas_set_font(canvas, FontPrimary);
     canvas_draw_str_aligned(canvas, 5, 10, AlignLeft, AlignTop, "CLI command");
 
     canvas_draw_str_aligned(canvas, 5, 24, AlignLeft, AlignTop, "is running now");
-}
+}