From 5f6661fbc700018762cddd62c046ee672f7ccdc9 Mon Sep 17 00:00:00 2001 From: Arthur Bonnaudet Date: Wed, 24 Jul 2024 16:49:20 +0200 Subject: [PATCH] nbgl_use_case: Fix blind sign warning icon Blind sign warning icon was always displayed during streaming review. Only display icon in first and last review page. --- lib_nbgl/src/nbgl_use_case.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lib_nbgl/src/nbgl_use_case.c b/lib_nbgl/src/nbgl_use_case.c index e1aa2afb..299fa328 100644 --- a/lib_nbgl/src/nbgl_use_case.c +++ b/lib_nbgl/src/nbgl_use_case.c @@ -907,12 +907,17 @@ static bool genericContextPreparePageContent(const nbgl_content_t *p_content, LOG_DEBUG(USE_CASE_LOGGER, "Unsupported type %d\n", pageContent->type); return false; } - // if first or last page of review and blind operation, add the top-right button - if (((p_content == &STARTING_CONTENT) || (p_content->type == INFO_LONG_PRESS)) - && (((navType == STREAMING_NAV) - && (bundleNavContext.reviewStreaming.operationType & BLIND_OPERATION)) - || ((navType == GENERIC_NAV) - && (bundleNavContext.review.operationType & BLIND_OPERATION)))) { + + bool isFirstOrLastPage + = (p_content->type == CENTERED_INFO) || (p_content->type == INFO_LONG_PRESS); + bool isStreamingNavAndBlindOperation + = (navType == STREAMING_NAV) + && (bundleNavContext.reviewStreaming.operationType & BLIND_OPERATION); + bool isGenericNavAndBlindOperation + = (navType == GENERIC_NAV) && (bundleNavContext.review.operationType & BLIND_OPERATION); + + // if first or last page of review and blind operation, add the warning top-right button + if (isFirstOrLastPage && (isStreamingNavAndBlindOperation || isGenericNavAndBlindOperation)) { pageContent->topRightIcon = &WARNING_ICON; pageContent->topRightToken = BLIND_WARNING_TOKEN; }