Skip to content

Commit

Permalink
fix(legacy): fix OK-25083 & OK-25088 (#507)
Browse files Browse the repository at this point in the history
  • Loading branch information
lyxyx authored Dec 22, 2023
1 parent 8c675db commit ff9efe5
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 10 deletions.
5 changes: 2 additions & 3 deletions legacy/firmware/fsm_msg_nostr.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ void fsm_msgNostrGetPublicKey(const NostrGetPublicKey *msg) {

if (msg->has_show_display && msg->show_display) {
char desc[32] = {0};
strcat(desc, "Nostr");
strcat(desc, " ");
strcat(desc, _("Address:"));
strcat(desc, "Nostr ");
strcat(desc, _("Public Key"));
if (!fsm_layoutAddress(resp->npub, desc, false, 0, msg->address_n,
msg->address_n_count, true, NULL, 0, 0, NULL)) {
return;
Expand Down
2 changes: 2 additions & 0 deletions legacy/firmware/language.c
Original file line number Diff line number Diff line change
Expand Up @@ -1028,6 +1028,7 @@ const char *languages[][2] = {
{"Verify Address", "校验地址"},
{"Verify All Words", "依次核对"},
{"Verify PIN", "请输入原PIN码"},
{"Verify Public Key", "校验公钥"},
{"Verify Specified Word", "自由核对"},
// fsm_msg_coin.h
{"Verifying", ""},
Expand Down Expand Up @@ -1098,6 +1099,7 @@ const char *languages[][2] = {
// recovery.c
{"Your wallet has\nsuccessfully restored", "钱包恢复成功"},
{"[Address]", "[地址]"},
{"[Public Key]", "[公钥]"},
{"[QR Code]", "[二维码]"},
// layout2.c
{"actions which might", "具有潜在风险的"},
Expand Down
27 changes: 20 additions & 7 deletions legacy/firmware/layout2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1316,10 +1316,17 @@ void layoutAddress(const char *address, const char *desc, bool qrcode,
}
}
#if ONEKEY_MINI
layoutTransInformation(&bmp_button_up, NULL, NULL, &bmp_button_forward,
NULL, _("OK"), _("Verify Address"), _("[QR Code]"),
NULL, false, true,
ignorecase ? address_upcase : address);
if (address && (memcmp(address, "npub", 4) == 0)) {
layoutTransInformation(&bmp_button_up, NULL, NULL, &bmp_button_forward,
NULL, _("OK"), _("Verify Public Key"),
_("[QR Code]"), NULL, false, true,
ignorecase ? address_upcase : address);
} else {
layoutTransInformation(&bmp_button_up, NULL, NULL, &bmp_button_forward,
NULL, _("OK"), _("Verify Address"), _("[QR Code]"),
NULL, false, true,
ignorecase ? address_upcase : address);
}
#else
uint8_t codedata[qrcodegen_BUFFER_LEN_FOR_VERSION(QR_MAX_VERSION)] = {0};
uint8_t tempdata[qrcodegen_BUFFER_LEN_FOR_VERSION(QR_MAX_VERSION)] = {0};
Expand Down Expand Up @@ -1359,9 +1366,15 @@ void layoutAddress(const char *address, const char *desc, bool qrcode,
(void)address_n;
(void)address_n_count;
(void)desc;
layoutTransInformation(NULL, &bmp_button_down, NULL, &bmp_button_forward,
NULL, _("OK"), _("Verify Address"), _("[Address]"),
NULL, false, false, address);
if (address && (memcmp(address, "npub", 4) == 0)) {
layoutTransInformation(NULL, &bmp_button_down, NULL, &bmp_button_forward,
NULL, _("OK"), _("Verify Public Key"),
_("[Public Key]"), NULL, false, false, address);
} else {
layoutTransInformation(NULL, &bmp_button_down, NULL, &bmp_button_forward,
NULL, _("OK"), _("Verify Address"), _("[Address]"),
NULL, false, false, address);
}
#else
uint32_t i = 0;
if (desc) {
Expand Down
15 changes: 15 additions & 0 deletions legacy/firmware/polkadot/substrate/substrate_dispatch_V18.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,11 @@ const char* _getMethod_Name_V18(uint8_t moduleIdx, uint8_t callIdx) {

switch (callPrivIdx) {
case 1280: /* module 5 call 0 */
case 1287:
case 1024:
case 1031:
case 7936:
case 7943:
return STR_ME_TRANSFER;
case 1282: /* module 5 call 2 */
case 1026:
Expand Down Expand Up @@ -266,8 +269,11 @@ uint8_t _getMethod_NumItems_V18(uint8_t moduleIdx, uint8_t callIdx) {

switch (callPrivIdx) {
case 1280: /* module 5 call 0 */
case 1287:
case 1024:
case 1031:
case 7936:
case 7943:
return 2;
case 1282: /* module 5 call 2 */
case 1026:
Expand All @@ -294,8 +300,11 @@ const char* _getMethod_ItemName_V18(uint8_t moduleIdx, uint8_t callIdx,

switch (callPrivIdx) {
case 1280: /* module 5 call 0 */
case 1287:
case 1024:
case 1031:
case 7936:
case 7943:
switch (itemIdx) {
case 0:
return STR_IT_amount;
Expand Down Expand Up @@ -354,8 +363,11 @@ parser_error_t _getMethod_ItemValue_V18(pd_Method_V18_t* m, uint8_t moduleIdx,

switch (callPrivIdx) {
case 1280: /* module 5 call 0 */
case 1287: /* module 5 call 0 */
case 1024: /* module 5 call 0 */
case 1031: /* module 5 call 0 */
case 7936: /* module 5 call 0 */
case 7943:
switch (itemIdx) {
case 0: /* balances_transfer_V18 - amount */;
return _toStringCompactBalance(
Expand Down Expand Up @@ -439,8 +451,11 @@ bool _getMethod_IsNestingSupported_V18(uint8_t moduleIdx, uint8_t callIdx) {

switch (callPrivIdx) { // Balances & BlindSign
case 1280: /* module 5 call 0 */
case 1287: /* module 5 call 0 */
case 1024: /* module 5 call 0 */
case 1031: /* module 5 call 0 */
case 7936: /* module 5 call 0 */
case 7943:
case 1282:
case 1026:
case 7938:
Expand Down

0 comments on commit ff9efe5

Please sign in to comment.