Skip to content

Commit

Permalink
Merge pull request #420 from Cypherock/fix/text-already-tapped-card
Browse files Browse the repository at this point in the history
fix(nfc): Error text updated for already tapped card
  • Loading branch information
amanCypherock authored Oct 20, 2023
2 parents f901b96 + 31dbbe8 commit db23e8f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/card_operations/card_fetch_share.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,16 @@ card_error_type_e card_fetch_share(const card_fetch_share_config_t *config,
if (CARD_OPERATION_CARD_REMOVED == card_data.error_type ||
CARD_OPERATION_RETAP_BY_USER_REQUIRED == card_data.error_type) {
const char *error_msg = card_data.error_message;

/**
* In case the same card as before is tapped, the user should be told to
* tap a different card instead of the default message "Wrong card
* sequence"
*/
if (SW_CONDITIONS_NOT_SATISFIED == card_data.nfc_data.status) {
error_msg = ui_text_tap_another_card;
}

if (CARD_OPERATION_SUCCESS == indicate_card_error(error_msg)) {
// Re-render the instruction screen
instruction_scr_init(config->frontend.msg, config->frontend.heading);
Expand Down
10 changes: 10 additions & 0 deletions src/card_operations/card_fetch_wallet_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,16 @@ card_error_type_e card_fetch_wallet_list(
if (CARD_OPERATION_CARD_REMOVED == card_data.error_type ||
CARD_OPERATION_RETAP_BY_USER_REQUIRED == card_data.error_type) {
const char *error_msg = card_data.error_message;

/**
* In case the same card as before is tapped, the user should be told to
* tap a different card instead of the default message "Wrong card
* sequence"
*/
if (SW_CONDITIONS_NOT_SATISFIED == card_data.nfc_data.status) {
error_msg = ui_text_tap_another_card;
}

if (CARD_OPERATION_SUCCESS == indicate_card_error(error_msg)) {
// Re-render the instruction screen
instruction_scr_init(config->frontend.msg, config->frontend.heading);
Expand Down
1 change: 1 addition & 0 deletions src/constant_texts.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ const char *ui_text_start_auth_from_CySync =
const char *ui_text_invalid_card_contact_cypherock =
"Authentication failed Contact Cypherock";
const char *ui_text_wrong_card_sequence = "Wrong card sequence";
const char *ui_text_tap_another_card = "Tap another card";
const char *ui_text_wallet_doesnt_exists_on_this_card =
"Wallet does not exist on this card";
const char *ui_text_wallet_verification_failed =
Expand Down
1 change: 1 addition & 0 deletions src/constant_texts.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ extern const char *ui_text_invalid_transaction;
// errors card flows
extern const char *ui_text_invalid_card_contact_cypherock;
extern const char *ui_text_wrong_card_sequence;
extern const char *ui_text_tap_another_card;
extern const char *ui_text_wallet_doesnt_exists_on_this_card;
extern const char *ui_text_wrong_wallet_is_now_locked;
extern const char *ui_text_wallet_already_unlocked;
Expand Down

0 comments on commit db23e8f

Please sign in to comment.