@@ -38,7 +38,7 @@ use handlers::{
38
38
get_version:: handler_get_version,
39
39
sign_tx:: { handler_sign_tx, TxContext } ,
40
40
} ;
41
- use ledger_device_sdk:: io:: { ApduHeader , Comm , Reply , StatusWords } ;
41
+ use ledger_device_sdk:: io:: { ApduHeader , Comm , Event , Reply , StatusWords } ;
42
42
#[ cfg( feature = "pending_review_screen" ) ]
43
43
#[ cfg( not( any( target_os = "stax" , target_os = "flex" ) ) ) ]
44
44
use ledger_device_sdk:: ui:: gadgets:: display_pending_review;
@@ -167,49 +167,35 @@ extern "C" fn sample_main() {
167
167
init_comm ( & mut comm) ;
168
168
tx_ctx. home = ui_menu_main ( & mut comm) ;
169
169
tx_ctx. home . show_and_return ( ) ;
170
-
171
- loop {
172
- let ins: Instruction = comm. next_command ( ) ;
173
- let status = match handle_apdu ( & mut comm, & ins, & mut tx_ctx) {
174
- Ok ( ( ) ) => {
175
- comm. reply_ok ( ) ;
176
- AppSW :: Ok
177
- }
178
- Err ( sw) => {
179
- comm. reply ( sw) ;
180
- sw
181
- }
182
- } ;
183
- show_status_and_home_if_needed ( & ins, & mut tx_ctx, & status) ;
184
- }
185
170
}
186
171
187
172
#[ cfg( not( any( target_os = "stax" , target_os = "flex" ) ) ) ]
188
- {
189
- use ledger_device_sdk:: io:: Event ;
190
-
191
- // Developer mode / pending review popup
192
- // must be cleared with user interaction
193
- #[ cfg( feature = "pending_review_screen" ) ]
194
- display_pending_review ( & mut comm) ;
195
-
196
- loop {
197
- // Wait for either a specific button push to exit the app
198
- // or an APDU command
199
- if let Event :: Command ( ins) = ui_menu_main ( & mut comm) {
200
- let result = handle_apdu ( & mut comm, & ins, & mut tx_ctx) ;
201
- let _status: AppSW = match result {
202
- Ok ( ( ) ) => {
203
- comm. reply_ok ( ) ;
204
- AppSW :: Ok
205
- }
206
- Err ( sw) => {
207
- comm. reply ( sw) ;
208
- sw
209
- }
210
- } ;
173
+ #[ cfg( feature = "pending_review_screen" ) ]
174
+ display_pending_review ( & mut comm) ;
175
+
176
+ loop {
177
+ #[ cfg( any( target_os = "stax" , target_os = "flex" ) ) ]
178
+ let ins: Instruction = comm. next_command ( ) ;
179
+
180
+ #[ cfg( not( any( target_os = "stax" , target_os = "flex" ) ) ) ]
181
+ let ins = if let Event :: Command ( ins) = ui_menu_main ( & mut comm) {
182
+ ins
183
+ } else {
184
+ continue ;
185
+ } ;
186
+
187
+ let status = match handle_apdu ( & mut comm, & ins, & mut tx_ctx) {
188
+ Ok ( ( ) ) => {
189
+ comm. reply_ok ( ) ;
190
+ AppSW :: Ok
211
191
}
212
- }
192
+ Err ( sw) => {
193
+ comm. reply ( sw) ;
194
+ sw
195
+ }
196
+ } ;
197
+ #[ cfg( any( target_os = "stax" , target_os = "flex" ) ) ]
198
+ show_status_and_home_if_needed ( & ins, & mut tx_ctx, & status) ;
213
199
}
214
200
}
215
201
0 commit comments