Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added Flex|Stax display for Configure Delegation #46

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 52 additions & 59 deletions src/common/ui/display_nbgl.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,10 @@ static void review_choice(bool confirm) {
}
static void review_choice_sign(bool confirm) {
// Answer, display a status page and go back to main
// validate_transaction(confirm);
if (confirm) {
buildAndSignTransactionHash();
// nbgl_useCaseReviewStatus(STATUS_TYPE_TRANSACTION_SIGNED, ui_menu_main);
} else {
sendUserRejection();
// nbgl_useCaseReviewStatus(STATUS_TYPE_TRANSACTION_REJECTED, ui_menu_main);
}
}

Expand Down Expand Up @@ -77,62 +74,58 @@ void startConfigureBakerUrlDisplay(bool lastUrlPage) {

// TODO: To fix
void startConfigureDelegationDisplay(void) {
// // Get context from global state
// signConfigureDelegationContext_t *ctx = &global.signConfigureDelegation;

// // Create tag-value pairs for the content
// nbgl_layoutTagValue_t pairs[4]; // Maximum possible pairs
// uint8_t pairIndex = 0;

// // Add sender address
// pairs[pairIndex].item = "Sender";
// pairs[pairIndex].value = (char *) global_account_sender.sender;
// pairIndex++;

// // Add capital amount if present
// if (ctx->hasCapital) {
// if (ctx->stopDelegation) {
// pairs[pairIndex].item = "Action";
// pairs[pairIndex].value = "Stop delegation";
// } else {
// pairs[pairIndex].item = "Amount to delegate";
// pairs[pairIndex].value = (char *) ctx->displayCapital;
// }
// pairIndex++;
// }

// // Add restake earnings if present
// if (ctx->hasRestakeEarnings) {
// pairs[pairIndex].item = "Restake earnings";
// pairs[pairIndex].value = (char *) ctx->displayRestake;
// pairIndex++;
// }

// // Add delegation target if present
// if (ctx->hasDelegationTarget) {
// pairs[pairIndex].item = "Delegation target";
// pairs[pairIndex].value = (char *) ctx->displayDelegationTarget;
// pairIndex++;
// }

// // Create the page content
// nbgl_pageContent_t content;
// content.type = TAG_VALUE_LIST;
// content.title = "Review Transaction";
// content.isTouchableTitle = true;
// content.topRightIcon = NULL;
// content.tagValueList.nbPairs = pairIndex;
// content.tagValueList.pairs = pairs;
// content.tagValueList.smallCaseForValue = false;
// content.tagValueList.nbMaxLinesForValue = 0;

// // Setup the review screen
// nbgl_useCaseReviewStart(&C_app_concordium_64px,
// "Review Transaction",
// NULL, // No subtitle
// "Reject transaction",
// buildAndSignTransactionHash,
// sendUserRejection);
// Get context from global state
signConfigureDelegationContext_t *ctx = &global.signConfigureDelegation;

// Create tag-value pairs for the content
uint8_t pairIndex = 0;
// Add sender address
pairs[pairIndex].item = "Sender";
pairs[pairIndex].value = (char *) global_account_sender.sender;
pairIndex++;

// Add capital amount if present
if (ctx->hasCapital) {
if (ctx->stopDelegation) {
pairs[pairIndex].item = "Action";
pairs[pairIndex].value = "Stop delegation";
} else {
pairs[pairIndex].item = "Amount to delegate";
pairs[pairIndex].value = (char *) ctx->displayCapital;
}
pairIndex++;
}

// Add restake earnings if present
if (ctx->hasRestakeEarnings) {
pairs[pairIndex].item = "Restake earnings";
pairs[pairIndex].value = (char *) ctx->displayRestake;
pairIndex++;
}

// Add delegation target if present
if (ctx->hasDelegationTarget) {
pairs[pairIndex].item = "Delegation target";
pairs[pairIndex].value = (char *) ctx->displayDelegationTarget;
pairIndex++;
}

// Create the page content
nbgl_contentTagValueList_t content;
content.nbPairs = pairIndex;
content.pairs = pairs;
content.smallCaseForValue = false;
content.nbMaxLinesForValue = 0;
content.startIndex = 0;

// Setup the review screen
nbgl_useCaseReview(TYPE_TRANSACTION,
&content,
&C_app_concordium_64px,
"Review Transaction",
NULL, // No subtitle
"Sign transaction",
review_choice_sign);
}

void uiSignUpdateCredentialThresholdDisplay(volatile unsigned int *flags) {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading