11/*******************************************************************************
2- * (c) 2018 - 2023 Zondax AG
3- *
4- * Licensed under the Apache License, Version 2.0 (the "License");
5- * you may not use this file except in compliance with the License.
6- * You may obtain a copy of the License at
7- *
8- * http://www.apache.org/licenses/LICENSE-2.0
9- *
10- * Unless required by applicable law or agreed to in writing, software
11- * distributed under the License is distributed on an "AS IS" BASIS,
12- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13- * See the License for the specific language governing permissions and
14- * limitations under the License.
15- ********************************************************************************/
2+ * (c) 2018 - 2023 Zondax AG
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ ********************************************************************************/
1616#include "bolos_target.h"
1717
1818#if defined(TARGET_NANOX ) || defined(TARGET_NANOS2 )
1919#include "view_internal.h"
20+ #include "view_nano.h"
2021#include "view_nano_inspect.h"
2122#include "view_templates.h"
22- #include "view_nano.h"
2323#include "zxmacros.h"
2424
2525extern const ux_flow_step_t * ux_review_flow [MAX_REVIEW_UX_SCREENS ];
@@ -38,18 +38,22 @@ uint8_t flow_inside_inspect_loop;
3838extern unsigned int review_type ;
3939
4040// Menu to recursively inspect elements from a transaction
41- UX_STEP_VALID (ux_inspect_flow_root_step , pb , h_rootTxn (), { & C_icon_back , "Go to root" });
41+ UX_STEP_VALID (ux_inspect_flow_root_step , pb , h_rootTxn (), {& C_icon_back , "Go to root" });
4242
4343UX_STEP_INIT (ux_inspect_flow_start_step , NULL , NULL , { h_inspect_loop_start (); });
44- UX_STEP_CB_INIT (ux_inspect_flow_step , bnnn_paging , h_inspect_loop_inside (), h_inspect (), { .title = viewdata .key , .text = viewdata .value , });
44+ UX_STEP_CB_INIT (ux_inspect_flow_step , bnnn_paging , h_inspect_loop_inside (), h_inspect (),
45+ {
46+ .title = viewdata .key ,
47+ .text = viewdata .value ,
48+ });
4549
4650UX_STEP_INIT (ux_inspect_flow_end_step , NULL , NULL , { h_inspect_loop_end (); });
4751
48- UX_STEP_VALID (ux_inspect_flow_back_step , pb , h_back (), { & C_icon_back , "BACK" });
52+ UX_STEP_VALID (ux_inspect_flow_back_step , pb , h_back (), {& C_icon_back , "BACK" });
4953
50- void view_inspect_show_impl (){
54+ void view_inspect_show_impl () {
5155 // h_inspect_loop_inside();
52- if (G_ux .stack_count == 0 ) {
56+ if (G_ux .stack_count == 0 ) {
5357 ux_stack_push ();
5458 }
5559
@@ -65,24 +69,23 @@ void view_inspect_show_impl(){
6569}
6670
6771void inspect_init () {
68- #ifdef HAVE_INSPECT
69- h_inspect_init ();
70- if (!viewdata .viewfuncCanInspectItem (viewdata .innerField .level ,
71- viewdata .innerField .trace ,
72- viewdata .innerField .paging .itemIdx )) {
73- h_rootTxn ();
74- return ;
75- }
72+ #ifdef HAVE_INSPECT
73+ h_inspect_init ();
74+ if (!viewdata .viewfuncCanInspectItem (viewdata .innerField .level , viewdata .innerField .trace ,
75+ viewdata .innerField .paging .itemIdx )) {
76+ h_rootTxn ();
77+ return ;
78+ }
7679
77- const zxerr_t err = h_inspect_update_data ();
78- if (err != zxerr_ok ) {
79- // Show error
80- view_error_show ();
81- // h_rootTxn();
82- return ;
83- }
84- view_inspect_show_impl ();
85- #endif
80+ const zxerr_t err = h_inspect_update_data ();
81+ if (err != zxerr_ok ) {
82+ // Show error
83+ view_error_show ();
84+ // h_rootTxn();
85+ return ;
86+ }
87+ view_inspect_show_impl ();
88+ #endif
8689}
8790
8891void h_inspect () {
@@ -93,9 +96,8 @@ void h_inspect() {
9396
9497 // Check if we can inspect this element
9598 if (viewdata .innerField .level >= MAX_DEPTH ||
96- !viewdata .viewfuncCanInspectItem (viewdata .innerField .level + 1 ,
97- viewdata .innerField .trace ,
98- viewdata .innerField .paging .itemIdx )) {
99+ !viewdata .viewfuncCanInspectItem (viewdata .innerField .level + 1 , viewdata .innerField .trace ,
100+ viewdata .innerField .paging .itemIdx )) {
99101 flow_inside_inspect_loop = 0 ;
100102 h_inspect_update_data ();
101103 view_inspect_show_impl ();
@@ -190,7 +192,7 @@ void h_inspect_loop_end() {
190192 }
191193
192194 ux_layout_bnnn_paging_reset ();
193- CUR_FLOW .prev_index = CUR_FLOW .index - 2 ;
195+ CUR_FLOW .prev_index = CUR_FLOW .index - 2 ;
194196 CUR_FLOW .index -- ;
195197 ux_flow_relayout ();
196198}
0 commit comments