1
1
#include "flipbip.h"
2
2
#include "helpers/flipbip_file.h"
3
- #include "helpers/flipbip_haptic.h"
3
+ // #include "helpers/flipbip_haptic.h"
4
4
// From: lib/crypto
5
5
#include <memzero.h>
6
6
#include <bip39.h>
7
7
8
+ #define MNEMONIC_MENU_DEFAULT "Import mnemonic seed"
9
+ #define MNEMONIC_MENU_SUCCESS "Import seed (success)"
10
+ #define MNEMONIC_MENU_FAILURE "Import seed (failure)"
11
+
8
12
bool flipbip_custom_event_callback (void * context , uint32_t event ) {
9
13
furi_assert (context );
10
14
FlipBip * app = context ;
@@ -40,7 +44,7 @@ static void text_input_callback(void* context) {
40
44
// reset input state
41
45
app -> input_state = FlipBipTextInputDefault ;
42
46
handled = true;
43
- view_dispatcher_switch_to_view (app -> view_dispatcher , FlipBipViewIdSettings );
47
+ // view_dispatcher_switch_to_view(app->view_dispatcher, FlipBipViewIdSettings);
44
48
} else if (app -> input_state == FlipBipTextInputMnemonic ) {
45
49
if (app -> import_from_mnemonic == 1 ) {
46
50
strcpy (app -> import_mnemonic_text , app -> input_text );
@@ -54,11 +58,13 @@ static void text_input_callback(void* context) {
54
58
status = FlipBipStatusSaveError ; // 12 = save error
55
59
56
60
if (status == FlipBipStatusSuccess ) {
61
+ app -> mnemonic_menu_text = MNEMONIC_MENU_SUCCESS ;
57
62
//notification_message(app->notification, &sequence_blink_cyan_100);
58
- flipbip_play_happy_bump (app );
63
+ // flipbip_play_happy_bump(app);
59
64
} else {
65
+ app -> mnemonic_menu_text = MNEMONIC_MENU_FAILURE ;
60
66
//notification_message(app->notification, &sequence_blink_red_100);
61
- flipbip_play_long_bump (app );
67
+ // flipbip_play_long_bump(app);
62
68
}
63
69
64
70
memzero (app -> import_mnemonic_text , TEXT_BUFFER_SIZE );
@@ -68,7 +74,9 @@ static void text_input_callback(void* context) {
68
74
// reset input state
69
75
app -> input_state = FlipBipTextInputDefault ;
70
76
handled = true;
71
- view_dispatcher_switch_to_view (app -> view_dispatcher , FlipBipViewIdMenu );
77
+ // exit scene 1 instance that's being used for text input and go back to menu
78
+ scene_manager_previous_scene (app -> scene_manager );
79
+ //view_dispatcher_switch_to_view(app->view_dispatcher, FlipBipViewIdMenu);
72
80
}
73
81
}
74
82
@@ -77,17 +85,17 @@ static void text_input_callback(void* context) {
77
85
memzero (app -> input_text , TEXT_BUFFER_SIZE );
78
86
// reset input state
79
87
app -> input_state = FlipBipTextInputDefault ;
80
- view_dispatcher_switch_to_view (app -> view_dispatcher , FlipBipViewIdMenu );
88
+ // view_dispatcher_switch_to_view(app->view_dispatcher, FlipBipViewIdMenu);
81
89
}
82
90
}
83
91
84
92
FlipBip * flipbip_app_alloc () {
85
93
FlipBip * app = malloc (sizeof (FlipBip ));
86
94
app -> gui = furi_record_open (RECORD_GUI );
87
- app -> notification = furi_record_open (RECORD_NOTIFICATION );
95
+ // app->notification = furi_record_open(RECORD_NOTIFICATION);
88
96
89
97
//Turn backlight on, believe me this makes testing your app easier
90
- notification_message (app -> notification , & sequence_display_backlight_on );
98
+ // notification_message(app->notification, &sequence_display_backlight_on);
91
99
92
100
//Scene additions
93
101
app -> view_dispatcher = view_dispatcher_alloc ();
@@ -111,6 +119,7 @@ FlipBip* flipbip_app_alloc() {
111
119
app -> bip44_coin = FlipBipCoinBTC0 ; // 0 (BTC)
112
120
app -> overwrite_saved_seed = 0 ;
113
121
app -> import_from_mnemonic = 0 ;
122
+ app -> mnemonic_menu_text = MNEMONIC_MENU_DEFAULT ;
114
123
115
124
// Text input
116
125
app -> input_state = FlipBipTextInputDefault ;
@@ -163,7 +172,7 @@ void flipbip_app_free(FlipBip* app) {
163
172
furi_record_close (RECORD_GUI );
164
173
165
174
app -> gui = NULL ;
166
- app -> notification = NULL ;
175
+ // app->notification = NULL;
167
176
168
177
//Remove whatever is left
169
178
memzero (app , sizeof (FlipBip ));
0 commit comments