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/LDG-607--nano-app-implement-signtransferwithscheduleandme #56

Merged
104 changes: 94 additions & 10 deletions src/common/ui/display_nbgl.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

accountSender_t global_account_sender;
static nbgl_contentTagValue_t pairs[10];
static signTransferWithScheduleContext_t *ctx_sign_transfer_with_schedule =
&global.withDataBlob.signTransferWithScheduleContext;

static void review_choice(bool confirm) {
// Answer, display a status page and go back to main
Expand Down Expand Up @@ -40,6 +42,13 @@ static void review_choice_sign(bool confirm) {
}
}

static void keep_going_with_transaction(bool confirm) {
if (confirm) {
sendSuccessNoIdle();
} else {
sendUserRejection();
}
}
static void sendSuccessNoIdleCallback(bool confirm) {
(void)confirm; // Suppress unused parameter warning
sendSuccessNoIdle();
Expand Down Expand Up @@ -750,19 +759,69 @@ void uiSignTransferToPublicDisplay(volatile unsigned int *flags) {
*flags |= IO_ASYNCH_REPLY;
}

// Add this wrapper function before uiSignScheduledTransferPairFlowDisplay
static void processNextScheduledAmountWrapper(bool choice) {
if (choice) {
processNextScheduledAmount(ctx_sign_transfer_with_schedule->buffer);
} else {
sendUserRejection();
}
}

void uiSignScheduledTransferPairFlowDisplay(void) {
return;
// TODO: Implement this
// Setup data to display
uint8_t pairIndex = 0;
pairs[pairIndex].item = "Release time (UTC)";
pairs[pairIndex].value =
(char *)global.withDataBlob.signTransferWithScheduleContext.displayTimestamp;
pairIndex++;
pairs[pairIndex].item = "Amount";
pairs[pairIndex].value = (char *)global.withDataBlob.signTransferWithScheduleContext.displayStr;
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_useCaseReviewLight(TYPE_TRANSACTION,
&content,
&C_app_concordium_64px,
"Review Scheduled release",
NULL, // No subtitle
"Show next release",
processNextScheduledAmountWrapper);
}

void uiSignScheduledTransferPairFlowSignDisplay(void) {
return;
// TODO: Implement this
}
// Setup data to display
uint8_t pairIndex = 0;
pairs[pairIndex].item = "Release time (UTC)";
pairs[pairIndex].value =
(char *)global.withDataBlob.signTransferWithScheduleContext.displayTimestamp;
pairIndex++;
pairs[pairIndex].item = "Amount";
pairs[pairIndex].value = (char *)global.withDataBlob.signTransferWithScheduleContext.displayStr;
pairIndex++;

void uiSignScheduledTransferPairFlowFinalDisplay(void) {
return;
// TODO: Implement this
// 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 Scheduled release",
NULL, // No subtitle
"Sign transaction",
review_choice_sign);
}

void uiVerifyAddress(volatile unsigned int *flags) {
Expand All @@ -772,8 +831,33 @@ void uiVerifyAddress(volatile unsigned int *flags) {
}

void startInitialScheduledTransferDisplay(bool displayMemo) {
displayMemo = false;
// TODO: Implement this
uint8_t index = 0;
pairs[index].item = "Sender";
pairs[index].value = (char *)global_account_sender.sender;
index++;
pairs[index].item = "Recipient";
pairs[index].value = (char *)global.withDataBlob.signTransferWithScheduleContext.displayStr;
index++;
if (displayMemo) {
pairs[index].item = "Memo";
pairs[index].value = (char *)global.withDataBlob.cborContext.display;
index++;
}
// Create the page content
nbgl_contentTagValueList_t content;
content.nbPairs = index;
content.pairs = pairs;
content.smallCaseForValue = false;
content.nbMaxLinesForValue = 0;
content.startIndex = 0;
// Setup the review screen
nbgl_useCaseReviewLight(TYPE_TRANSACTION,
&content,
&C_app_concordium_64px,
"Review Transfer with schedule",
NULL, // No subtitle
"Continue with transfer",
keep_going_with_transaction);
}

void uiDeployModuleDisplay(void) {
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
Loading