@@ -282,7 +282,6 @@ UX_FLOW_DEF_NOCB(ux_review_flow_4_review_title, pbb,
282282 REVIEW_MSG_TITLE ,
283283 REVIEW_MSG_VALUE ,
284284 });
285-
286285UX_STEP_INIT (ux_review_flow_2_start_step , NULL , NULL , { h_review_loop_start (); });
287286#ifdef HAVE_INSPECT
288287UX_STEP_CB_INIT (ux_review_flow_2_step , bnnn_paging , h_review_loop_inside (), inspect_init (),
@@ -566,6 +565,76 @@ void view_review_show_impl(unsigned int requireReply, const char *title, const c
566565
567566void run_root_txn_flow () { run_ux_review_flow (review_type , & ux_review_flow_2_start_step ); }
568567
568+ void view_review_show_with_intent_impl (unsigned int requireReply , const char * intent ) {
569+ review_type = requireReply ;
570+ h_paging_init ();
571+ h_paging_decrease ();
572+
573+ // Format the intro message based on the intent
574+ if (intent != NULL && strlen (intent ) > 0 ) {
575+ // Put "Review transaction" or "Review message" on first line
576+ const char * first_line = (review_type == REVIEW_MSG ) ? "Review message" : "Review transaction" ;
577+ snprintf (intro_msg_buf , sizeof (intro_msg_buf ), "%s" , first_line );
578+
579+ // Put "to {intent}" on second line
580+ const size_t max_intent_len = sizeof (intro_submsg_buf ) - 4 ; // Reserve 4 bytes: "to " (3) + null terminator (1)
581+ int ret = snprintf (intro_submsg_buf , sizeof (intro_submsg_buf ), "to %.*s" , (int )max_intent_len , intent );
582+
583+ // Check if truncation occurred and add ellipsis if needed
584+ if (ret >= (int )sizeof (intro_submsg_buf )) {
585+ const size_t buf_len = sizeof (intro_submsg_buf );
586+ if (buf_len >= 4 ) {
587+ intro_submsg_buf [buf_len - 4 ] = '.' ;
588+ intro_submsg_buf [buf_len - 3 ] = '.' ;
589+ intro_submsg_buf [buf_len - 2 ] = '.' ;
590+ intro_submsg_buf [buf_len - 1 ] = '\0' ;
591+ }
592+ }
593+
594+ // Use the dynamic review flow for transactions and messages with intent
595+ if (review_type == REVIEW_TXN ) {
596+ flow_inside_loop = 0 ;
597+ if (G_ux .stack_count == 0 ) {
598+ ux_stack_push ();
599+ }
600+ // Build flow with dynamic title for transaction
601+ uint8_t index = 0 ;
602+ ux_review_flow [index ++ ] = & ux_review_flow_1_review_group_title ;
603+ ux_review_flow [index ++ ] = & ux_review_flow_2_start_step ;
604+ ux_review_flow [index ++ ] = & ux_review_flow_2_step ;
605+ ux_review_flow [index ++ ] = & ux_review_flow_2_end_step ;
606+ ux_review_flow [index ++ ] = & ux_review_flow_3_step ;
607+ ux_review_flow [index ++ ] = FLOW_END_STEP ;
608+ ux_flow_init (0 , ux_review_flow , NULL );
609+ return ;
610+ } else if (review_type == REVIEW_MSG ) {
611+ // Create custom flow for message with intent
612+ flow_inside_loop = 0 ;
613+ if (G_ux .stack_count == 0 ) {
614+ ux_stack_push ();
615+ }
616+ // Build flow with dynamic title for message
617+ uint8_t index = 0 ;
618+ // Use the group title flow which displays intro_msg_buf
619+ ux_review_flow [index ++ ] = & ux_review_flow_1_review_group_title ;
620+ ux_review_flow [index ++ ] = & ux_review_flow_2_start_step ;
621+ ux_review_flow [index ++ ] = & ux_review_flow_2_step ;
622+ ux_review_flow [index ++ ] = & ux_review_flow_2_end_step ;
623+ ux_review_flow [index ++ ] = & ux_review_flow_6_step ;
624+ ux_review_flow [index ++ ] = FLOW_END_STEP ;
625+ ux_flow_init (0 , ux_review_flow , NULL );
626+ return ;
627+ }
628+ }
629+
630+ // Fallback to normal review flow if no intent or other review types
631+ flow_inside_loop = 0 ;
632+ if (G_ux .stack_count == 0 ) {
633+ ux_stack_push ();
634+ }
635+ run_ux_review_flow ((review_type_e )review_type , NULL );
636+ }
637+
569638// Build review UX flow and run it
570639void run_ux_review_flow (review_type_e reviewType , const ux_flow_step_t * const start_step ) {
571640 uint8_t index = 0 ;
0 commit comments