Skip to content

Commit

Permalink
Merge pull request #56 from blooo-io/feat/LDG-607--nano-app-implement…
Browse files Browse the repository at this point in the history
…-signtransferwithscheduleandme

Feat/LDG-607--nano-app-implement-signtransferwithscheduleandme
  • Loading branch information
n4l5u0r authored Dec 13, 2024
2 parents dafa419 + 3c1cd07 commit 7297c55
Show file tree
Hide file tree
Showing 83 changed files with 305 additions and 184 deletions.
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 @@ -799,19 +808,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 @@ -821,8 +880,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

0 comments on commit 7297c55

Please sign in to comment.