Skip to content

Commit 0707349

Browse files
Merge pull request #785 from LedgerHQ/tdj/nbgl_use_case_cleanup
nbgl use case cleanup
2 parents c131633 + cda52e5 commit 0707349

File tree

4 files changed

+70
-373
lines changed

4 files changed

+70
-373
lines changed

lib_nbgl/doc/nbgl_use_case.dox

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,12 @@ A few APIs are available to draw typical Use-Cases, such as:
5858

5959
Some APIs have also been kept for backward compatibility, and for some rare cases:
6060

61-
- for Home Screen:
62-
- @ref nbgl_useCaseHome() to draw the home screen of an application.
63-
- @ref nbgl_useCaseHomeExt() to draw an extended version of home screen of an application (with action button)
64-
- @ref nbgl_useCasePlugInHome() to draw the home screen of a Plug-In application
6561
- for Settings:
6662
- @ref nbgl_useCaseSettings() to draw a level of settings pages
6763
- for most used reviews:
6864
- @ref nbgl_useCaseReviewStart() to draw the cover page of a review (initial page, without data)
6965
- @ref nbgl_useCaseStaticReview() to draw the data pages of a regular review, when all info are available from the beginning (all pages but the cover one)
7066
- @ref nbgl_useCaseRegularReview() to draw the data pages of a regular review (all pages but the cover one)
71-
- for address verification:
72-
- @ref nbgl_useCaseAddressConfirmation() to draw an address confirmation page, with a possibility to see it as QR Code
73-
- @ref nbgl_useCaseAddressConfirmationExt() to draw an address confirmation page, with a possibility to see it as QR Code and some extra tag/value pairs
74-
- for rare reviews:
75-
- @ref nbgl_useCaseForwardOnlyReview() to draw the pages of a forward-only review (without back key)
76-
- @ref nbgl_useCaseViewDetails() to draw the pages displaying the full value of a given long data of a review
7767

7868
@subsection use_case_home_settings Home & Settings screen Use Case
7969

lib_nbgl/doc/nbgl_use_case_nanos.dox

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,6 @@ A few APIs are available to draw typical Use-Cases, such as:
4646
- for most used reviews:
4747
- @ref nbgl_useCaseStaticReview() to draw the pages of a regular review, when all info are available from the beginning (see @subpage use_case_static_review)
4848
- @ref nbgl_useCaseRegularReview() to draw the pages of a regular review (all pages but the cover one) (see @subpage use_case_regular_review)
49-
- for rare reviews:
50-
- @ref nbgl_useCaseForwardOnlyReview() to draw the pages of a forward-only review (without back) (see @subpage use_case_forward_only_review)
51-
- for address verification:
52-
- @ref nbgl_useCaseAddressConfirmation() to draw an address confirmation page (see @subpage use_case_addr_confirm)
53-
- @ref nbgl_useCaseAddressConfirmationExt() to draw an address confirmation page, with some extra tag/value pairs (see @subpage use_case_addr_confirm_ext)
5449

5550
@subsection use_case_home Home screen Use Case
5651

@@ -247,79 +242,6 @@ void startReview(void) {
247242
}
248243
@endcode
249244

250-
@subsection use_case_forward_only_review Forward only Review Use Case
251-
252-
Some message/transaction reviews may be too long to be memorized, so it is only possible to move forward.
253-
254-
In this case, no backward navigation is possible, and the number of pages cannot be defined at start-up.
255-
256-
The API to initiate the display of the series of forward-only review pages is @ref nbgl_useCaseForwardOnlyReview(), providing:
257-
258-
- a navigation callback called when to retrieve the content of the next page. It is also called to fill the initial page.
259-
260-
Here is an example code:
261-
262-
@code
263-
264-
static uint8_t last_transaction_page;
265-
266-
static void onApprove(void) {
267-
// confirm transaction
268-
269-
// and go back to main
270-
appMain();
271-
}
272-
273-
static void onReject(void) {
274-
// reject transaction
275-
276-
// and go back to main
277-
appMain();
278-
}
279-
280-
// called to get the content of the given page
281-
static bool navCallback(uint8_t page, nbgl_pageContent_t *content) {
282-
memset(content, 0, sizeof(nbgl_pageContent_t));
283-
if (page == 0) {
284-
// the first page is used to display the title of the review
285-
content->text = "Review\ntransaction";
286-
content->icon = &C_icon_eye;
287-
}
288-
else if (page == (last_transaction+1)) {
289-
// try to get a new tag/value pair in this transaction
290-
char *tag;
291-
char *value;
292-
if (getNextTagValuePair(&tag, &value)) {
293-
content->text = tag;
294-
content->subText = value;
295-
last_transaction_page = page;
296-
}
297-
else {
298-
// this page is for approval
299-
content->text = "Approve";
300-
content->icon = &C_icon_validate;
301-
content->callback = onApprove;
302-
}
303-
}
304-
else if (page == (last_transaction+2)) {
305-
// this page is for rejection
306-
content->text = "Reject";
307-
content->icon = &C_icon_crossmark;
308-
content->callback = onReject;
309-
}
310-
else {
311-
return false;
312-
}
313-
// valid page so return true
314-
return true;
315-
}
316-
317-
void startForwardOnlyTransaction(void) {
318-
last_transaction_page = 0;
319-
nbgl_useCaseForwardOnlyReview(navCallback);
320-
}
321-
@endcode
322-
323245
@subsection use_case_static_review Static Review Use Case
324246

325247
\image{inline} html UseCase-Nano-Review1.png "caption" width=1000

lib_nbgl/include/nbgl_use_case.h

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -379,14 +379,6 @@ void nbgl_useCaseHomeExt(const char *appName,
379379
nbgl_callback_t actionCallback,
380380
nbgl_callback_t topRightCallback,
381381
nbgl_callback_t quitCallback);
382-
void nbgl_useCasePlugInHome(const char *plugInName,
383-
const char *appName,
384-
const nbgl_icon_details_t *appIcon,
385-
const char *tagline,
386-
const char *subTagline,
387-
bool withSettings,
388-
nbgl_callback_t topRightCallback,
389-
nbgl_callback_t quitCallback);
390382
void nbgl_useCaseSettings(const char *settingsTitle,
391383
uint8_t initPage,
392384
uint8_t nbPages,
@@ -416,14 +408,6 @@ void nbgl_useCaseRegularReview(uint8_t initPage,
416408
nbgl_layoutTouchCallback_t buttonCallback,
417409
nbgl_navCallback_t navCallback,
418410
nbgl_choiceCallback_t choiceCallback);
419-
void nbgl_useCaseForwardOnlyReview(const char *rejectText,
420-
nbgl_layoutTouchCallback_t buttonCallback,
421-
nbgl_navCallback_t navCallback,
422-
nbgl_choiceCallback_t choiceCallback);
423-
void nbgl_useCaseForwardOnlyReviewNoSkip(const char *rejectText,
424-
nbgl_layoutTouchCallback_t buttonCallback,
425-
nbgl_navCallback_t navCallback,
426-
nbgl_choiceCallback_t choiceCallback);
427411
void nbgl_useCaseStaticReview(const nbgl_contentTagValueList_t *tagValueList,
428412
const nbgl_pageInfoLongPress_t *infoLongPress,
429413
const char *rejectText,
@@ -432,7 +416,6 @@ void nbgl_useCaseStaticReviewLight(const nbgl_contentTagValueList_t *tagValueLis
432416
const nbgl_pageInfoLongPress_t *infoLongPress,
433417
const char *rejectText,
434418
nbgl_choiceCallback_t callback);
435-
void nbgl_useCaseViewDetails(const char *tag, const char *value, bool wrapping);
436419
void nbgl_useCaseAddressConfirmation(const char *address, nbgl_choiceCallback_t callback);
437420
void nbgl_useCaseAddressConfirmationExt(const char *address,
438421
nbgl_choiceCallback_t callback,
@@ -454,28 +437,6 @@ void nbgl_useCaseKeypadPIN(const char *title,
454437
tune_index_e tuneId,
455438
nbgl_pinValidCallback_t validatePinCallback,
456439
nbgl_layoutTouchCallback_t actionCallback);
457-
/**
458-
* @deprecated
459-
* See #nbgl_useCaseKeypadPIN
460-
*/
461-
DEPRECATED static inline void nbgl_useCaseKeypad(const char *title,
462-
uint8_t minDigits,
463-
uint8_t maxDigits,
464-
uint8_t backToken,
465-
bool shuffled,
466-
tune_index_e tuneId,
467-
nbgl_pinValidCallback_t validatePinCallback,
468-
nbgl_layoutTouchCallback_t actionCallback)
469-
{
470-
nbgl_useCaseKeypadPIN(title,
471-
minDigits,
472-
maxDigits,
473-
backToken,
474-
shuffled,
475-
tuneId,
476-
validatePinCallback,
477-
actionCallback);
478-
}
479440
#endif // NBGL_KEYPAD
480441
#endif // HAVE_SE_TOUCH
481442

0 commit comments

Comments
 (0)