@@ -107,6 +107,7 @@ typedef struct KeypadContext_s {
107
107
#endif
108
108
109
109
typedef struct BlindSigningContext_s {
110
+ bool isStreaming ;
110
111
nbgl_operationType_t operationType ;
111
112
const nbgl_contentTagValueList_t * tagValueList ;
112
113
const nbgl_icon_details_t * icon ;
@@ -281,6 +282,12 @@ static void useCaseReview(nbgl_operationType_t operationType,
281
282
nbgl_choiceCallback_t choiceCallback ,
282
283
bool isLight ,
283
284
bool playNotifSound );
285
+ static void useCaseReviewStreamingStart (nbgl_operationType_t operationType ,
286
+ const nbgl_icon_details_t * icon ,
287
+ const char * reviewTitle ,
288
+ const char * reviewSubTitle ,
289
+ nbgl_choiceCallback_t choiceCallback ,
290
+ bool playNotifSound );
284
291
285
292
static void reset_callbacks (void )
286
293
{
@@ -584,16 +591,26 @@ static void pageCallback(int token, uint8_t index)
584
591
blindSigningContext .choiceCallback (false);
585
592
}
586
593
else { // bottom button to continue to review
587
- useCaseReview (blindSigningContext .operationType ,
588
- blindSigningContext .tagValueList ,
589
- blindSigningContext .icon ,
590
- blindSigningContext .reviewTitle ,
591
- blindSigningContext .reviewSubTitle ,
592
- blindSigningContext .finishTitle ,
593
- blindSigningContext .tipBox ,
594
- blindSigningContext .choiceCallback ,
595
- false,
596
- true);
594
+ if (blindSigningContext .isStreaming ) {
595
+ useCaseReviewStreamingStart (blindSigningContext .operationType ,
596
+ blindSigningContext .icon ,
597
+ blindSigningContext .reviewTitle ,
598
+ blindSigningContext .reviewSubTitle ,
599
+ blindSigningContext .choiceCallback ,
600
+ false);
601
+ }
602
+ else {
603
+ useCaseReview (blindSigningContext .operationType ,
604
+ blindSigningContext .tagValueList ,
605
+ blindSigningContext .icon ,
606
+ blindSigningContext .reviewTitle ,
607
+ blindSigningContext .reviewSubTitle ,
608
+ blindSigningContext .finishTitle ,
609
+ blindSigningContext .tipBox ,
610
+ blindSigningContext .choiceCallback ,
611
+ false,
612
+ false);
613
+ }
597
614
}
598
615
}
599
616
else if (token == TIP_BOX_TOKEN ) {
@@ -1811,6 +1828,52 @@ static void useCaseReview(nbgl_operationType_t operationType,
1811
1828
displayGenericContextPage (0 , true);
1812
1829
}
1813
1830
1831
+ // function to factorize code for all streaming reviews
1832
+ static void useCaseReviewStreamingStart (nbgl_operationType_t operationType ,
1833
+ const nbgl_icon_details_t * icon ,
1834
+ const char * reviewTitle ,
1835
+ const char * reviewSubTitle ,
1836
+ nbgl_choiceCallback_t choiceCallback ,
1837
+ bool playNotifSound )
1838
+ {
1839
+ reset_callbacks ();
1840
+ memset (& genericContext , 0 , sizeof (genericContext ));
1841
+
1842
+ bundleNavContext .reviewStreaming .operationType = operationType ;
1843
+ bundleNavContext .reviewStreaming .choiceCallback = choiceCallback ;
1844
+ bundleNavContext .reviewStreaming .icon = icon ;
1845
+
1846
+ // memorize context
1847
+ onChoice = bundleNavReviewStreamingChoice ;
1848
+ navType = STREAMING_NAV ;
1849
+ pageTitle = NULL ;
1850
+
1851
+ genericContext .genericContents .contentsList = localContentsList ;
1852
+ genericContext .genericContents .nbContents = 1 ;
1853
+ memset (localContentsList , 0 , 1 * sizeof (nbgl_content_t ));
1854
+
1855
+ // First a centered info
1856
+ STARTING_CONTENT .type = EXTENDED_CENTER ;
1857
+ prepareReviewFirstPage (
1858
+ & STARTING_CONTENT .content .extendedCenter .contentCenter , icon , reviewTitle , reviewSubTitle );
1859
+
1860
+ // compute number of pages & fill navigation structure
1861
+ bundleNavContext .reviewStreaming .stepPageNb
1862
+ = nbgl_useCaseGetNbPagesForGenericContents (& genericContext .genericContents , 0 );
1863
+ prepareNavInfo (true, NBGL_NO_PROGRESS_INDICATOR , getRejectReviewText (operationType ));
1864
+ // no back button on first page
1865
+ navInfo .navWithButtons .backButton = false;
1866
+
1867
+ // Play notification sound if required
1868
+ if (playNotifSound ) {
1869
+ #ifdef HAVE_PIEZO_SOUND
1870
+ io_seproxyhal_play_tune (TUNE_LOOK_AT_ME );
1871
+ #endif // HAVE_PIEZO_SOUND
1872
+ }
1873
+
1874
+ displayGenericContextPage (0 , true);
1875
+ }
1876
+
1814
1877
/**********************
1815
1878
* GLOBAL FUNCTIONS
1816
1879
**********************/
@@ -3000,6 +3063,7 @@ void nbgl_useCaseReviewBlindSigning(nbgl_operationType_t operationT
3000
3063
{
3001
3064
memset (& blindSigningContext , 0 , sizeof (blindSigningContext ));
3002
3065
3066
+ blindSigningContext .isStreaming = false;
3003
3067
blindSigningContext .operationType = operationType | BLIND_OPERATION ;
3004
3068
blindSigningContext .tagValueList = tagValueList ;
3005
3069
blindSigningContext .icon = icon ;
@@ -3106,40 +3170,44 @@ void nbgl_useCaseReviewStreamingStart(nbgl_operationType_t operationType,
3106
3170
const char * reviewSubTitle ,
3107
3171
nbgl_choiceCallback_t choiceCallback )
3108
3172
{
3109
- reset_callbacks ();
3110
- memset (& genericContext , 0 , sizeof (genericContext ));
3111
-
3112
- bundleNavContext .reviewStreaming .operationType = operationType ;
3113
- bundleNavContext .reviewStreaming .choiceCallback = choiceCallback ;
3114
- bundleNavContext .reviewStreaming .icon = icon ;
3115
-
3116
- // memorize context
3117
- onChoice = bundleNavReviewStreamingChoice ;
3118
- navType = STREAMING_NAV ;
3119
- pageTitle = NULL ;
3120
-
3121
- genericContext .genericContents .contentsList = localContentsList ;
3122
- genericContext .genericContents .nbContents = 1 ;
3123
- memset (localContentsList , 0 , 1 * sizeof (nbgl_content_t ));
3173
+ useCaseReviewStreamingStart (
3174
+ operationType , icon , reviewTitle , reviewSubTitle , choiceCallback , true);
3175
+ }
3124
3176
3125
- // First a centered info
3126
- STARTING_CONTENT .type = EXTENDED_CENTER ;
3127
- prepareReviewFirstPage (
3128
- & STARTING_CONTENT .content .extendedCenter .contentCenter , icon , reviewTitle , reviewSubTitle );
3177
+ /**
3178
+ * @brief Start drawing the flow of pages of a blind-signing review. The review is preceded by a
3179
+ * warning page
3180
+ * @note This should be followed by calls to nbgl_useCaseReviewStreamingContinue and finally to
3181
+ * nbgl_useCaseReviewStreamingFinish.
3182
+ *
3183
+ * @param operationType type of operation (Operation, Transaction, Message)
3184
+ * @param icon icon used on first and last review page
3185
+ * @param reviewTitle string used in the first review page
3186
+ * @param reviewSubTitle string to set under reviewTitle (can be NULL)
3187
+ * @param choiceCallback callback called when more operation data are needed (param is true) or
3188
+ * operation is rejected (param is false)
3189
+ */
3190
+ void nbgl_useCaseReviewStreamingBlindSigningStart (nbgl_operationType_t operationType ,
3191
+ const nbgl_icon_details_t * icon ,
3192
+ const char * reviewTitle ,
3193
+ const char * reviewSubTitle ,
3194
+ nbgl_choiceCallback_t choiceCallback )
3195
+ {
3196
+ memset (& blindSigningContext , 0 , sizeof (blindSigningContext ));
3129
3197
3130
- // compute number of pages & fill navigation structure
3131
- bundleNavContext . reviewStreaming . stepPageNb
3132
- = nbgl_useCaseGetNbPagesForGenericContents ( & genericContext . genericContents , 0 ) ;
3133
- prepareNavInfo (true, NBGL_NO_PROGRESS_INDICATOR , getRejectReviewText ( operationType )) ;
3134
- // no back button on first page
3135
- navInfo . navWithButtons . backButton = false ;
3198
+ blindSigningContext . isStreaming = true;
3199
+ blindSigningContext . operationType = operationType | BLIND_OPERATION ;
3200
+ blindSigningContext . icon = icon ;
3201
+ blindSigningContext . reviewTitle = reviewTitle ;
3202
+ blindSigningContext . reviewSubTitle = reviewSubTitle ;
3203
+ blindSigningContext . choiceCallback = choiceCallback ;
3136
3204
3137
3205
#ifdef HAVE_PIEZO_SOUND
3138
3206
// Play notification sound
3139
3207
io_seproxyhal_play_tune (TUNE_LOOK_AT_ME );
3140
3208
#endif // HAVE_PIEZO_SOUND
3141
3209
3142
- displayGenericContextPage ( 0 , true );
3210
+ blindSigningWarning ( );
3143
3211
}
3144
3212
3145
3213
/**
0 commit comments