From 55bff602fabf01ee00bcae928d270eeba4ef6165 Mon Sep 17 00:00:00 2001 From: grdddj Date: Wed, 14 Jun 2023 14:15:36 +0200 Subject: [PATCH] fix(core): add dynamic title to the FIDO dialogue for model R [no changelog] --- core/embed/rust/src/ui/model_tr/layout.rs | 9 ++------- core/mocks/generated/trezorui2.pyi | 2 +- core/src/trezor/ui/layouts/tr/fido.py | 3 ++- tests/ui_tests/fixtures.json | 2 +- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/core/embed/rust/src/ui/model_tr/layout.rs b/core/embed/rust/src/ui/model_tr/layout.rs index 73aa1138de..11997e304b 100644 --- a/core/embed/rust/src/ui/model_tr/layout.rs +++ b/core/embed/rust/src/ui/model_tr/layout.rs @@ -788,18 +788,13 @@ extern "C" fn new_confirm_modify_fee(n_args: usize, args: *const Obj, kwargs: *m extern "C" fn new_confirm_fido(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj { let block = move |_args: &[Obj], kwargs: &Map| { + let title: StrBuffer = kwargs.get(Qstr::MP_QSTR_title)?.try_into()?; let app_name: StrBuffer = kwargs.get(Qstr::MP_QSTR_app_name)?.try_into()?; let accounts: Gc = kwargs.get(Qstr::MP_QSTR_accounts)?.try_into()?; // Cache the page count so that we can move `accounts` into the closure. let page_count = accounts.len(); - let title: StrBuffer = if page_count > 1 { - "IMPORT".into() - } else { - "IMPORT CREDENTIAL".into() - }; - // Closure to lazy-load the information on given page index. // Done like this to allow arbitrarily many pages without // the need of any allocation here in Rust. @@ -1420,7 +1415,7 @@ pub static mp_module_trezorui2: Module = obj_module! { /// def confirm_fido( /// *, - /// title: str, # unused on TR + /// title: str, /// app_name: str, /// icon_name: str | None, # unused on TR /// accounts: list[str | None], diff --git a/core/mocks/generated/trezorui2.pyi b/core/mocks/generated/trezorui2.pyi index a84092e89c..9bcc2af84a 100644 --- a/core/mocks/generated/trezorui2.pyi +++ b/core/mocks/generated/trezorui2.pyi @@ -162,7 +162,7 @@ def confirm_modify_fee( # rust/src/ui/model_tr/layout.rs def confirm_fido( *, - title: str, # unused on TR + title: str, app_name: str, icon_name: str | None, # unused on TR accounts: list[str | None], diff --git a/core/src/trezor/ui/layouts/tr/fido.py b/core/src/trezor/ui/layouts/tr/fido.py index 27ee589a9d..8d80eb3be5 100644 --- a/core/src/trezor/ui/layouts/tr/fido.py +++ b/core/src/trezor/ui/layouts/tr/fido.py @@ -20,7 +20,8 @@ async def confirm_fido( ) -> int: """Webauthn confirmation for one or more credentials.""" confirm = RustLayout( - trezorui2.confirm_fido( # type: ignore [Arguments missing] + trezorui2.confirm_fido( # type: ignore [Argument missing for parameter "icon_name"] + title=header.upper(), app_name=app_name, accounts=accounts, ) diff --git a/tests/ui_tests/fixtures.json b/tests/ui_tests/fixtures.json index 44c8ee332a..ac4088ba40 100644 --- a/tests/ui_tests/fixtures.json +++ b/tests/ui_tests/fixtures.json @@ -1869,7 +1869,7 @@ "TR_tezos-test_sign_tx.py::test_tezos_smart_contract_delegation": "0bfa467f184a2199144fc4a9af7d294e932e416534968276fbc0a110992e8d45", "TR_tezos-test_sign_tx.py::test_tezos_smart_contract_transfer": "f617f8ba0365183578a4bc7cb48adbbb586cdc318d30269508d9a547bf4217f9", "TR_tezos-test_sign_tx.py::test_tezos_smart_contract_transfer_to_contract": "edb0067a1761ed27b54f4d405a5f8debabac16dd9c3a1b7934c0c43dced8fe63", -"TR_webauthn-test_msg_webauthn.py::test_add_remove": "88fba47850635c4f6c13262196bfe39e747b9b320b864cbd0d7fdae307944999", +"TR_webauthn-test_msg_webauthn.py::test_add_remove": "9a3b2ed2dabf6986fc6817d2f56132b721e4114fbcc87b02f738039c2f1e97f3", "TR_webauthn-test_u2f_counter.py::test_u2f_counter": "7be38df32071aa68585cd535a089c1920732d8067ff7783b8f03430ab7f23dc8", "TR_zcash-test_sign_tx.py::test_external_presigned": "1b8667fe36eaaf077c0e59f451091dffea61b40a19487a32bdfe7a8285d62e41", "TR_zcash-test_sign_tx.py::test_one_two": "e06dac38a6ba8f0384eb63571df00af430d8133b50d7a8b5d1cfa53989afd614",