Skip to content

Commit

Permalink
feat(ar): add address check hint box
Browse files Browse the repository at this point in the history
  • Loading branch information
soralit committed Jul 1, 2024
1 parent c59050d commit 0558bb7
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 5 deletions.
23 changes: 22 additions & 1 deletion src/ui/gui_widgets/general/gui_home_widgets.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ static lv_obj_t *g_walletButton[HOME_WALLET_CARD_BUTT];
static lv_obj_t *g_cosmosPulldownImg = NULL;
static lv_obj_t *g_endCosmosLine = NULL;
static lv_obj_t *g_lastCosmosLine = NULL;
static lv_obj_t *g_noticeWindow = NULL;

static WalletState_t g_walletState[HOME_WALLET_CARD_BUTT] = {
{HOME_WALLET_CARD_BTC, false, "BTC", true},
Expand Down Expand Up @@ -531,6 +532,26 @@ void GuiShowRsaSetupasswordHintbox(void)
SetKeyboardWidgetSig(g_keyboardWidget, &sig);
}

static void GuiARAddressCheckConfirmHandler(lv_event_t *event) {
GUI_DEL_OBJ(g_noticeWindow);
GuiCreateAttentionHintbox(SIG_SETUP_RSA_PRIVATE_KEY_RECEIVE_CONFIRM);
}

static void GuiOpenARAddressNoticeWindow() {
g_noticeWindow = GuiCreateGeneralHintBox(&imgRedEye, _("ar_address_check"), _("ar_address_check_desc"), NULL, _("Not Now"), WHITE_COLOR_OPA20, _("Understand"), ORANGE_COLOR);
lv_obj_add_event_cb(lv_obj_get_child(g_noticeWindow, 0), CloseHintBoxHandler, LV_EVENT_CLICKED, &g_noticeWindow);

lv_obj_t *btn = GuiGetHintBoxRightBtn(g_noticeWindow);
lv_obj_set_width(btn, 192);
lv_obj_set_style_text_font(lv_obj_get_child(btn, 0), &buttonFont, 0);
lv_obj_add_event_cb(btn, GuiARAddressCheckConfirmHandler, LV_EVENT_CLICKED, &g_noticeWindow);

lv_obj_t *img = GuiCreateImg(g_noticeWindow, &imgClose);
lv_obj_add_flag(img, LV_OBJ_FLAG_CLICKABLE);
lv_obj_add_event_cb(img, CloseHintBoxHandler, LV_EVENT_CLICKED, &g_noticeWindow);
lv_obj_align_to(img, lv_obj_get_child(g_noticeWindow, 1), LV_ALIGN_TOP_RIGHT, -36, 36);
}

static void CoinDealHandler(lv_event_t *e)
{
HOME_WALLET_CARD_ENUM coin;
Expand All @@ -553,7 +574,7 @@ static void CoinDealHandler(lv_event_t *e)
case HOME_WALLET_CARD_ARWEAVE: {
bool shouldGenerateArweaveXPub = IsArweaveSetupComplete();
if (!shouldGenerateArweaveXPub) {
GuiCreateAttentionHintbox(SIG_SETUP_RSA_PRIVATE_KEY_RECEIVE_CONFIRM);
GuiOpenARAddressNoticeWindow();
break;
}
GuiFrameOpenViewWithParam(&g_standardReceiveView, &coin, sizeof(coin));
Expand Down
24 changes: 23 additions & 1 deletion src/ui/gui_widgets/gui_connect_wallet_widgets.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ static CoinState_t g_defaultFewchaState[FEWCHA_COINS_BUTT] = {
{SUI, false},
};

static lv_obj_t *g_noticeWindow = NULL;

typedef struct {
const char *accountType;
const char *path;
Expand Down Expand Up @@ -317,6 +319,26 @@ static bool IsSOL(int walletIndex)
}
#endif

static void GuiARAddressCheckConfirmHandler(lv_event_t *event) {
GUI_DEL_OBJ(g_noticeWindow);
GuiCreateAttentionHintbox(SIG_SETUP_RSA_PRIVATE_KEY_RECEIVE_CONFIRM);
}

static void GuiOpenARAddressNoticeWindow() {
g_noticeWindow = GuiCreateGeneralHintBox(&imgRedEye, _("ar_address_check"), _("ar_address_check_desc"), NULL, _("Not Now"), WHITE_COLOR_OPA20, _("Understand"), ORANGE_COLOR);
lv_obj_add_event_cb(lv_obj_get_child(g_noticeWindow, 0), CloseHintBoxHandler, LV_EVENT_CLICKED, &g_noticeWindow);

lv_obj_t *btn = GuiGetHintBoxRightBtn(g_noticeWindow);
lv_obj_set_width(btn, 192);
lv_obj_set_style_text_font(lv_obj_get_child(btn, 0), &buttonFont, 0);
lv_obj_add_event_cb(btn, GuiARAddressCheckConfirmHandler, LV_EVENT_CLICKED, &g_noticeWindow);

lv_obj_t *img = GuiCreateImg(g_noticeWindow, &imgClose);
lv_obj_add_flag(img, LV_OBJ_FLAG_CLICKABLE);
lv_obj_add_event_cb(img, CloseHintBoxHandler, LV_EVENT_CLICKED, &g_noticeWindow);
lv_obj_align_to(img, lv_obj_get_child(g_noticeWindow, 1), LV_ALIGN_TOP_RIGHT, -36, 36);
}

static void OpenQRCodeHandler(lv_event_t *e)
{
WalletListItem_t *wallet = lv_event_get_user_data(e);
Expand All @@ -335,7 +357,7 @@ static void OpenQRCodeHandler(lv_event_t *e)
}
bool skipGenerateArweaveKey = IsArweaveSetupComplete();
if (g_connectWalletTileView.walletIndex == WALLET_LIST_ARCONNECT && !skipGenerateArweaveKey) {
GuiCreateAttentionHintbox(SIG_SETUP_RSA_PRIVATE_KEY_CONNECT_CONFIRM);
GuiOpenARAddressNoticeWindow();
return;
}
#endif
Expand Down
4 changes: 3 additions & 1 deletion src/ui/lv_i18n/data.csv
Original file line number Diff line number Diff line change
Expand Up @@ -863,4 +863,6 @@ Wallet Profile,20,wallet_profile_mid_btn,Wallet Profile,Профиль коше
,20,tutorial_ton_mnemonic_desc,"TON uses its own unique algorithm to generate key pairs from mnemonic phrases, rather than following the common BIP39 standard. When creating and restoring a TON wallet, ensure that your mnemonic phrase is securely stored, as it is the sole means to recover your wallet. Always download wallet software from trusted sources to keep your assets safe.","TON использует собственный уникальный алгоритм для генерации ключевых пар из мнемонических фраз, вместо того чтобы следовать общему стандарту BIP39. При создании и восстановлении кошелька TON обязательно убедитесь в безопасном хранении вашей мнемонической фразы, так как она является единственным средством для восстановления кошелька. Всегда загружайте программное обеспечение кошелька только из надежных источников, чтобы сохранить безопасность своих активов.","TON은 일반적인 BIP39 표준을 따르지 않고 고유한 알고리즘을 사용하여 니모닉 문구로부터 키 쌍을 생성합니다. TON 지갑을 생성하거나 복구할 때, 니모닉 문구가 안전하게 저장되었는지 확인하여 지갑을 복구할 수 있는 유일한 수단임을 유의하십시오. 자산의 안전을 위해 항상 신뢰할 수 있는 소스에서 지갑 소프트웨어를 다운로드하십시오.","TON使用自己独特的算法生成助记词而不是遵循常见的BIP39标准.在创建和恢复TON钱包时,请确保安全地存储助记词,因为它是恢复钱包的唯一途径.始终从可信的来源下载钱包软件以保护您的资产安全.","TON utiliza su propio algoritmo único para generar pares de claves a partir de frases mnemotécnicas, en lugar de seguir el estándar común BIP39. Al crear y restaurar una billetera de TON, asegúrate de almacenar de forma segura tu frase mnemotécnica, ya que es el único medio para recuperar tu billetera. Siempre descarga el software de billetera de fuentes confiables para mantener seguros tus activos.","TON verwendet einen eigenen einzigartigen Algorithmus zur Generierung von Schlüsselpaaren aus Mnemonischen Phrasen und folgt nicht dem gängigen BIP39-Standard. Stellen Sie beim Erstellen und Wiederherstellen einer TON-Wallet sicher, dass Ihre mnemonische Phrase sicher aufbewahrt wird, da sie das einzige Mittel zur Wiederherstellung Ihrer Wallet ist. Laden Sie immer Wallet-Software von vertrauenswürdigen Quellen herunter, um Ihre Vermögenswerte sicher zu halten.",TONは一般的なBIP39規格に従うのではなく、独自のアルゴリズムを使用してニーモニックフレーズから鍵のペアを生成します. TONウォレットを作成または復元する際には、ニーモニックフレーズが安全に保存されていることを確認し、ウォレットを回復する唯一の手段であることを確認してください. 資産を安全に保つために常に信頼できるソースからウォレットソフトウェアをダウンロードしてください.,
,20,tutorial_ton_mnemonic_url,https://keyst.one/t/3rd/ton,https://keyst.one/t/3rd/ton,https://keyst.one/t/3rd/ton,https://keyst.one/t/3rd/ton,https://keyst.one/t/3rd/ton,https://keyst.one/t/3rd/ton,https://keyst.one/t/3rd/ton,
,20,ton_sign_proof_title,Confirm Connect,Подтвердить подключение,연결 확인,确认连接,Confirmar conexión,Verbindung bestätigen,接続確認,
,20,ton_comment_hint,"Comment is not transaction data. Please verify carefully.",,,,,,,
,20,ton_comment_hint,"Comment is not transaction data. Please verify carefully.",,,,,,,
,24,ar_address_check,"Address Check Needed",,,,,,,
,20,ar_address_check_desc,"Different wallets may generate AR addresses differently, resulting in different addresses from the same phrase. This is normal. After connecting to the software wallet, please compare the address to ensure it matches the hardware wallet.",,,,,,,
16 changes: 14 additions & 2 deletions src/ui/lv_i18n/lv_i18n.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ const static lv_i18n_phrase_t en_singulars[] = {
{"about_terms_title", "Terms of Use"},
{"about_terms_website_url", "https://keyst.one/terms"},
{"account_head", "Account"},
{"ar_address_check", "Address Check Needed"},
{"ar_address_check_desc", "Different wallets may generate AR addresses differently, resulting in different addresses from the same phrase. This is normal. After connecting to the software wallet, please compare the address to ensure it matches the hardware wallet."},
{"auto_shutdown", "Auto Shutdown"},
{"auto_shutdown_20", "Auto Shutdown"},
{"beta_version_notice_desc", "The current firmware is a beta version and may contain unknown bugs or risks. It is intended only for testing purposes."},
Expand Down Expand Up @@ -172,8 +174,6 @@ const static lv_i18n_phrase_t en_singulars[] = {
{"connect_safe_title2", "Safe (Mobile)"},
{"connect_solflare_link", "https://keyst.one/t/3rd/solflare"},
{"connect_solflare_title", "Solflare"},
{"connect_backpack_link", "https://keyst.one/t/3rd/backpack"},
{"connect_backpack_title", "Backpack"},
{"connect_sparrow_link", "https://keyst.one/t/3rd/sparrow"},
{"connect_sparrow_multisig_link", "https://keyst.one/t/3rd/Multisig/sparrow"},
{"connect_sparrow_title", "Sparrow"},
Expand Down Expand Up @@ -885,6 +885,8 @@ const static lv_i18n_phrase_t de_singulars[] = {
{"about_terms_title", "Nutzungsbedingungen"},
{"about_terms_website_url", "https://keyst.one/terms "},
{"account_head", "Konto"},
{"ar_address_check", ""},
{"ar_address_check_desc", ""},
{"auto_shutdown", "Autoabschaltung"},
{"auto_shutdown_20", "Autoabschaltung"},
{"beta_version_notice_desc", "Die aktuelle Firmware ist eine Betaversion und kann unbekannte Fehler oder Risiken enthalten. Sie ist ausschließlich für Testzwecke vorgesehen."},
Expand Down Expand Up @@ -1654,6 +1656,8 @@ const static lv_i18n_phrase_t es_singulars[] = {
{"about_terms_title", "Términos de Uso"},
{"about_terms_website_url", "https://keyst.one/terms"},
{"account_head", "Cuenta"},
{"ar_address_check", ""},
{"ar_address_check_desc", ""},
{"auto_shutdown", "Apagado automático"},
{"auto_shutdown_20", "Apagado automático"},
{"beta_version_notice_desc", "La versión actual del firmware es una versión beta y puede contener errores o riesgos desconocidos. Está diseñada únicamente para fines de prueba"},
Expand Down Expand Up @@ -2422,6 +2426,8 @@ const static lv_i18n_phrase_t ja_singulars[] = {
{"about_terms_title", "利用規約"},
{"about_terms_website_url", "https://keyst.one/terms"},
{"account_head", "アカウント"},
{"ar_address_check", ""},
{"ar_address_check_desc", ""},
{"auto_shutdown", "自動シャットダウン"},
{"auto_shutdown_20", "自動シャットダウン"},
{"beta_version_notice_desc", "現在のファームウェアはベータ版であり、未知のバグやリスクが含まれている可能性があります.これはテスト目的のみを意図しています."},
Expand Down Expand Up @@ -3189,6 +3195,8 @@ const static lv_i18n_phrase_t ko_singulars[] = {
{"about_terms_title", "이용약관"},
{"about_terms_website_url", "https://keyst.one/terms"},
{"account_head", "계정 전환"},
{"ar_address_check", ""},
{"ar_address_check_desc", ""},
{"auto_shutdown", "자동 종료 시간"},
{"auto_shutdown_20", "자동 종료 시간"},
{"beta_version_notice_desc", "현재 펌웨어는 베타 버전이며 알려지지 않은 버그 또는 위험을 포함할 수 있습니다. 테스트 목적으로만 사용되어야 합니다."},
Expand Down Expand Up @@ -3956,6 +3964,8 @@ const static lv_i18n_phrase_t ru_singulars[] = {
{"about_terms_title", "Условия использования"},
{"about_terms_website_url", "https://keyst.one/terms"},
{"account_head", "Счет"},
{"ar_address_check", ""},
{"ar_address_check_desc", ""},
{"auto_shutdown", "Выключение"},
{"auto_shutdown_20", "Выключение"},
{"beta_version_notice_desc", "Текущая прошивка является бета-версией и может содержать неизвестные ошибки или риски. Она предназначена только для тестирования."},
Expand Down Expand Up @@ -4728,6 +4738,8 @@ const static lv_i18n_phrase_t zh_cn_singulars[] = {
{"about_terms_title", "使用条款"},
{"about_terms_website_url", "https://keyst.one/terms"},
{"account_head", "账户"},
{"ar_address_check", ""},
{"ar_address_check_desc", ""},
{"auto_shutdown", "自动关闭"},
{"auto_shutdown_20", "自动关闭"},
{"beta_version_notice_desc", "当前的固件是一个测试版本,可能包含未知的错误或风险.仅供测试目的使用"},
Expand Down

0 comments on commit 0558bb7

Please sign in to comment.