trezor-firmware icon indicating copy to clipboard operation
trezor-firmware copied to clipboard

Rust UI: introduce Icon type

Open matejcik opened this issue 3 years ago • 2 comments

The code especially in #2471 is getting a little messy in places because we don't have a convenient ui::Icon type with size() and pub data: &'static [u8] and similar methods, which need to be laboriously explicitly written out in all usage sites.

Let's not block the above PR for that, but we should introduce Icon and factor out these things everywhere.

I believe there's some work on that in #2277 already?

matejcik avatar Sep 14 '22 09:09 matejcik

I believe there's some work on that in https://github.com/trezor/trezor-firmware/pull/2277 already?

Yeah, I have defined an Icon struct - https://github.com/trezor/trezor-firmware/blob/7a938de855d03e173e40bed8c30b0835b42a9ca4/core/embed/rust/src/ui/display.rs#L1066-L1131

The global objects are then IconAndName - https://github.com/trezor/trezor-firmware/blob/7a938de855d03e173e40bed8c30b0835b42a9ca4/core/embed/rust/src/ui/model_tr/theme.rs#L31-L65

grdddj avatar Sep 14 '22 12:09 grdddj

to resolve this issue, Icon type should include the same fields as ToifInfo, in addition to the data cut off at the right point (i.e. a slice of toif_bytes[12..])

(also probably should not be Copy unless there is a strong reason)

matejcik avatar Sep 14 '22 13:09 matejcik