Update TOTP

This commit is contained in:
Willy-JL
2023-04-09 19:52:56 +01:00
parent 80b1e73989
commit 769d44d793
32 changed files with 121 additions and 128 deletions

View File

@@ -19,11 +19,11 @@
#ifdef TOTP_BADBT_TYPE_ENABLED
#include "../../../workers/bt_type_code/bt_type_code.h"
#endif
#include "../../fonts/mode-nine/mode_nine.h"
#include "../../fonts/mode-nine/mode-nine.h"
#define PROGRESS_BAR_MARGIN (3)
#define PROGRESS_BAR_HEIGHT (4)
static const char* STEAM_ALGO_ALPHABET = "23456789BCDFGHJKMNPQRTVWXY";
static const uint8_t PROGRESS_BAR_MARGIN = 3;
static const uint8_t PROGRESS_BAR_HEIGHT = 4;
typedef struct {
uint16_t current_token_index;
@@ -177,6 +177,7 @@ static void draw_totp_code(Canvas* const canvas, const SceneState* const scene_s
uint8_t char_width = modeNine_15ptFontInfo.charInfo[0].width;
uint8_t total_length = code_length * (char_width + modeNine_15ptFontInfo.spacePixels);
uint8_t offset_x = (SCREEN_WIDTH - total_length) >> 1;
uint8_t offset_x_inc = char_width + modeNine_15ptFontInfo.spacePixels;
uint8_t offset_y = SCREEN_HEIGHT_CENTER - (modeNine_15ptFontInfo.height >> 1);
for(uint8_t i = 0; i < code_length; i++) {
char ch = scene_state->last_code[i];
@@ -189,14 +190,10 @@ static void draw_totp_code(Canvas* const canvas, const SceneState* const scene_s
modeNine_15ptFontInfo.height,
&modeNine_15ptFontInfo.data[modeNine_15ptFontInfo.charInfo[char_index].offset]);
offset_x += char_width + modeNine_15ptFontInfo.spacePixels;
offset_x += offset_x_inc;
}
}
void totp_scene_generate_token_init(const PluginState* plugin_state) {
UNUSED(plugin_state);
}
void totp_scene_generate_token_activate(
PluginState* plugin_state,
const GenerateTokenSceneContext* context) {
@@ -518,7 +515,3 @@ void totp_scene_generate_token_deactivate(PluginState* plugin_state) {
free(scene_state);
plugin_state->current_scene_state = NULL;
}
void totp_scene_generate_token_free(const PluginState* plugin_state) {
UNUSED(plugin_state);
}

View File

@@ -8,7 +8,6 @@ typedef struct {
uint16_t current_token_index;
} GenerateTokenSceneContext;
void totp_scene_generate_token_init(const PluginState* plugin_state);
void totp_scene_generate_token_activate(
PluginState* plugin_state,
const GenerateTokenSceneContext* context);
@@ -17,4 +16,3 @@ bool totp_scene_generate_token_handle_event(
const PluginEvent* const event,
PluginState* plugin_state);
void totp_scene_generate_token_deactivate(PluginState* plugin_state);
void totp_scene_generate_token_free(const PluginState* plugin_state);