mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-19 04:44:47 -07:00
Show the wrong PIN Attempt count on the login screen (#3495)
* now shows failed login attempt count
* fixed the memory leaking
* made some text changes
* removed second allocation of the furi string
* cleaned up code
* Changed Position of the Wrong Attempts Text + It removes if you typed an arrow
* aligned text to the center and switched to furi_string_reset insted of furi_string_set_str("")
* fixed weird behavior
* Desktop: cleanup pin scene code, better reporting on transition between states
Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -35,6 +35,9 @@ typedef struct {
|
||||
const char* secondary_str;
|
||||
uint8_t secondary_str_x;
|
||||
uint8_t secondary_str_y;
|
||||
const char* tertiary_str;
|
||||
uint8_t tertiary_str_x;
|
||||
uint8_t tertiary_str_y;
|
||||
const char* button_label;
|
||||
} DesktopViewPinInputModel;
|
||||
|
||||
@@ -167,6 +170,17 @@ static void desktop_view_pin_input_draw(Canvas* canvas, void* context) {
|
||||
canvas_draw_str(
|
||||
canvas, model->secondary_str_x, model->secondary_str_y, model->secondary_str);
|
||||
}
|
||||
|
||||
if(model->tertiary_str && model->pin.length == 0) {
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
canvas_draw_str_aligned(
|
||||
canvas,
|
||||
model->tertiary_str_x,
|
||||
model->tertiary_str_y,
|
||||
AlignCenter,
|
||||
AlignBottom,
|
||||
model->tertiary_str);
|
||||
}
|
||||
}
|
||||
|
||||
void desktop_view_pin_input_timer_callback(void* context) {
|
||||
@@ -294,6 +308,20 @@ void desktop_view_pin_input_set_label_secondary(
|
||||
view_commit_model(pin_input->view, true);
|
||||
}
|
||||
|
||||
void desktop_view_pin_input_set_label_tertiary(
|
||||
DesktopViewPinInput* pin_input,
|
||||
uint8_t x,
|
||||
uint8_t y,
|
||||
const char* label) {
|
||||
furi_assert(pin_input);
|
||||
|
||||
DesktopViewPinInputModel* model = view_get_model(pin_input->view);
|
||||
model->tertiary_str = label;
|
||||
model->tertiary_str_x = x;
|
||||
model->tertiary_str_y = y;
|
||||
view_commit_model(pin_input->view, true);
|
||||
}
|
||||
|
||||
void desktop_view_pin_input_set_pin_position(DesktopViewPinInput* pin_input, uint8_t x, uint8_t y) {
|
||||
furi_assert(pin_input);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user