Skip to content

Commit f11ece5

Browse files
committed
ui: Remove components
* entry_screen isn't used * confirm_button was just a trivial wrapper
1 parent d31aa5d commit f11ece5

File tree

8 files changed

+36
-185
lines changed

8 files changed

+36
-185
lines changed

src/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,13 @@ set(DBB-FIRMWARE-UI-SOURCES
7474
${CMAKE_SOURCE_DIR}/src/ui/components/trinary_input_string.c
7575
${CMAKE_SOURCE_DIR}/src/ui/components/waiting.c
7676
${CMAKE_SOURCE_DIR}/src/ui/components/screensaver.c
77-
${CMAKE_SOURCE_DIR}/src/ui/components/entry_screen.c
7877
${CMAKE_SOURCE_DIR}/src/ui/components/knight_rider.c
7978
${CMAKE_SOURCE_DIR}/src/ui/components/right_arrow.c
8079
${CMAKE_SOURCE_DIR}/src/ui/components/left_arrow.c
8180
${CMAKE_SOURCE_DIR}/src/ui/components/icon_button.c
8281
${CMAKE_SOURCE_DIR}/src/ui/components/confirm_gesture.c
8382
${CMAKE_SOURCE_DIR}/src/ui/components/label.c
8483
${CMAKE_SOURCE_DIR}/src/ui/components/confirm.c
85-
${CMAKE_SOURCE_DIR}/src/ui/components/confirm_button.c
8684
${CMAKE_SOURCE_DIR}/src/ui/components/keyboard_switch.c
8785
${CMAKE_SOURCE_DIR}/src/ui/components/orientation_arrows.c
8886
${CMAKE_SOURCE_DIR}/src/ui/components/info_centered.c

src/rust/bitbox02-sys/build.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,10 @@ const BITBOX02_SOURCES: &[&str] = &[
200200
"src/u2f/u2f_app.c",
201201
"src/u2f/u2f_packet.c",
202202
"src/ui/components/button.c",
203-
"src/ui/components/confirm_button.c",
204203
"src/ui/components/confirm_gesture.c",
205204
"src/ui/components/confirm_transaction.c",
206205
"src/ui/components/confirm.c",
207206
"src/ui/components/empty.c",
208-
"src/ui/components/entry_screen.c",
209207
"src/ui/components/icon_button.c",
210208
"src/ui/components/image.c",
211209
"src/ui/components/info_centered.c",

src/ui/components/confirm_button.c

Lines changed: 0 additions & 34 deletions
This file was deleted.

src/ui/components/confirm_button.h

Lines changed: 0 additions & 30 deletions
This file was deleted.

src/ui/components/confirm_transaction.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// limitations under the License.
1414

1515
#include "confirm_transaction.h"
16-
#include "confirm_button.h"
16+
#include "confirm_gesture.h"
1717
#include "icon_button.h"
1818
#include "label.h"
1919
#include "ui_images.h"
@@ -71,6 +71,16 @@ static void _cancel(component_t* cancel_button)
7171
}
7272
}
7373

74+
static void _confirm_button_cb(component_t* confirm_button)
75+
{
76+
component_t* component = confirm_button->parent;
77+
data_t* data = (data_t*)component->data;
78+
if (data->callback) {
79+
data->callback(true, data->user_data);
80+
data->callback = NULL;
81+
}
82+
}
83+
7484
/********************************** Component Functions **********************************/
7585

7686
/**
@@ -120,7 +130,12 @@ static component_t* _confirm_transaction_create(
120130

121131
ui_util_add_sub_component(confirm, icon_button_create(top_slider, ICON_BUTTON_CROSS, _cancel));
122132

123-
ui_util_add_sub_component(confirm, confirm_button_create(longtouch, ICON_BUTTON_NEXT));
133+
if (longtouch) {
134+
ui_util_add_sub_component(confirm, confirm_gesture_create());
135+
} else {
136+
ui_util_add_sub_component(
137+
confirm, icon_button_create(top_slider, ICON_BUTTON_NEXT, _confirm_button_cb));
138+
}
124139

125140
if (data->has_address) {
126141
ui_util_add_sub_component(

src/ui/components/entry_screen.c

Lines changed: 0 additions & 84 deletions
This file was deleted.

src/ui/components/entry_screen.h

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/ui/components/trinary_input_string.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
// limitations under the License.
1414

1515
#include "trinary_input_string.h"
16-
#include "confirm_button.h"
1716
#include "confirm_gesture.h"
17+
#include "icon_button.h"
1818
#include "keyboard_switch.h"
1919
#include "label.h"
2020
#include "left_arrow.h"
@@ -389,6 +389,18 @@ static void _on_event(const event_t* event, component_t* component)
389389
}
390390
}
391391

392+
static void _confirm_button_cb(component_t* confirm_button)
393+
{
394+
component_t* component = confirm_button->parent;
395+
data_t* data = (data_t*)component->data;
396+
if (data->can_confirm) {
397+
if (data->confirm_cb) {
398+
data->confirm_cb(data->string, data->confirm_user_data);
399+
data->confirm_cb = NULL;
400+
}
401+
}
402+
}
403+
392404
static void _cancel(component_t* cancel_button)
393405
{
394406
component_t* component = cancel_button->parent;
@@ -484,7 +496,12 @@ component_t* trinary_input_string_create(
484496
data->left_arrow_component = left_arrow_create(top_slider, component);
485497
ui_util_add_sub_component(component, data->left_arrow_component);
486498

487-
data->confirm_component = confirm_button_create(params->longtouch, ICON_BUTTON_CHECK);
499+
if (params->longtouch) {
500+
data->confirm_component = confirm_gesture_create();
501+
} else {
502+
data->confirm_component =
503+
icon_button_create(top_slider, ICON_BUTTON_CHECK, _confirm_button_cb);
504+
}
488505
ui_util_add_sub_component(component, data->confirm_component);
489506

490507
if (params->wordlist == NULL && !params->number_input) {

0 commit comments

Comments
 (0)