1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-18 12:28:09 +00:00

fix(core): add dynamic title to the FIDO dialogue for model R

[no changelog]
This commit is contained in:
grdddj 2023-06-14 14:15:36 +02:00 committed by Jiří Musil
parent 207ffcd0da
commit 55bff602fa
4 changed files with 6 additions and 10 deletions

View File

@ -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 { extern "C" fn new_confirm_fido(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
let block = move |_args: &[Obj], kwargs: &Map| { 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 app_name: StrBuffer = kwargs.get(Qstr::MP_QSTR_app_name)?.try_into()?;
let accounts: Gc<List> = kwargs.get(Qstr::MP_QSTR_accounts)?.try_into()?; let accounts: Gc<List> = kwargs.get(Qstr::MP_QSTR_accounts)?.try_into()?;
// Cache the page count so that we can move `accounts` into the closure. // Cache the page count so that we can move `accounts` into the closure.
let page_count = accounts.len(); 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. // Closure to lazy-load the information on given page index.
// Done like this to allow arbitrarily many pages without // Done like this to allow arbitrarily many pages without
// the need of any allocation here in Rust. // the need of any allocation here in Rust.
@ -1420,7 +1415,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
/// def confirm_fido( /// def confirm_fido(
/// *, /// *,
/// title: str, # unused on TR /// title: str,
/// app_name: str, /// app_name: str,
/// icon_name: str | None, # unused on TR /// icon_name: str | None, # unused on TR
/// accounts: list[str | None], /// accounts: list[str | None],

View File

@ -162,7 +162,7 @@ def confirm_modify_fee(
# rust/src/ui/model_tr/layout.rs # rust/src/ui/model_tr/layout.rs
def confirm_fido( def confirm_fido(
*, *,
title: str, # unused on TR title: str,
app_name: str, app_name: str,
icon_name: str | None, # unused on TR icon_name: str | None, # unused on TR
accounts: list[str | None], accounts: list[str | None],

View File

@ -20,7 +20,8 @@ async def confirm_fido(
) -> int: ) -> int:
"""Webauthn confirmation for one or more credentials.""" """Webauthn confirmation for one or more credentials."""
confirm = RustLayout( 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, app_name=app_name,
accounts=accounts, accounts=accounts,
) )

View File

@ -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_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": "f617f8ba0365183578a4bc7cb48adbbb586cdc318d30269508d9a547bf4217f9",
"TR_tezos-test_sign_tx.py::test_tezos_smart_contract_transfer_to_contract": "edb0067a1761ed27b54f4d405a5f8debabac16dd9c3a1b7934c0c43dced8fe63", "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_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_external_presigned": "1b8667fe36eaaf077c0e59f451091dffea61b40a19487a32bdfe7a8285d62e41",
"TR_zcash-test_sign_tx.py::test_one_two": "e06dac38a6ba8f0384eb63571df00af430d8133b50d7a8b5d1cfa53989afd614", "TR_zcash-test_sign_tx.py::test_one_two": "e06dac38a6ba8f0384eb63571df00af430d8133b50d7a8b5d1cfa53989afd614",