Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[draft] Introduce trait UIFirmware #4322

Draft
wants to merge 36 commits into
base: main
Choose a base branch
from

Conversation

obrusvit
Copy link
Contributor

@obrusvit obrusvit commented Nov 5, 2024

DRAFT

@obrusvit obrusvit added core Trezor Core firmware. Runs on Trezor Model T and T2B1. blocked Blocked by external force. Third party inputs required. code Code improvements labels Nov 5, 2024
@obrusvit obrusvit self-assigned this Nov 5, 2024
Copy link

github-actions bot commented Nov 5, 2024

legacy UI changes device test(screens) main(screens)

Copy link

github-actions bot commented Nov 5, 2024

core UI changes device test click test persistence test
T2T1 Model T test(screens) main(screens) test(screens) main(screens) test(screens) main(screens)
T3B1 Safe 3 test(screens) main(screens) test(screens) main(screens) test(screens) main(screens)
T3T1 Safe 5 test(screens) main(screens) test(screens) main(screens) test(screens) main(screens)
All main(screens)

@obrusvit obrusvit force-pushed the obrusvit/ui-features-firmware3 branch 2 times, most recently from 65751cc to 5181685 Compare November 6, 2024 11:25
@obrusvit obrusvit force-pushed the obrusvit/ui-features-firmware3 branch from fd527ba to b3db3af Compare November 11, 2024 15:58
@obrusvit obrusvit force-pushed the obrusvit/mercury/refactor-rust-layout-upy-parsing branch 5 times, most recently from bbb65ed to 320eb1f Compare November 19, 2024 13:38
@obrusvit obrusvit force-pushed the obrusvit/mercury/refactor-rust-layout-upy-parsing branch from 320eb1f to abc7203 Compare November 19, 2024 14:39
Base automatically changed from obrusvit/mercury/refactor-rust-layout-upy-parsing to main November 19, 2024 15:19
The new module is the place for type definitions of the interface
between rust and micropython world.

The goal is to replace `trezorui2` with `trezorui_api` without
duplicated definitions.
This commit introduces a trait defining high level UI building blocks.
The trait is common for all models.

trezorui_api module exposes these functions to MicroPython world.

`show_info` is implemented as a first function.
Make layouts utilizing keyboards a part of UiFeaturesFirmware
- disable_animations
- check_homescreen_format
- this commit does not compile for mercury
- implement Confirm Homescreen for mercury according to Figma
- implementation as SwipeFlow also allows using it as `impl
LayoutMaybeTrace` return type for the UiFeatures
- in addition, to unify the trait function arguments, ButtonRequest was
moved from Rust side to uPy side for mercury
- checklist is now fixed to 3 items as they are not used in other way,
it can be switched to use heapless::Vec if the need for more items
appears.
- unify param to just one bool `recovery`
- title and button is determined in Rust based on the argument
- only supported for model_t
- dependence on Obj
- return type is Gc<LayoutObj>
- new_show_modal removed from model_t layout.rs
- replace `show_passphrase` of model_r with `show_simple`
@obrusvit obrusvit force-pushed the obrusvit/ui-features-firmware3 branch from b3db3af to 6bffb8e Compare November 19, 2024 15:48
@obrusvit obrusvit removed the blocked Blocked by external force. Third party inputs required. label Nov 19, 2024
// UIFeaturesFirmware`
// NOTE: `disable_animation` not a part of trait UiFeaturesFirmware

extern "C" fn new_confirm_action(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this be a good time to drop the new_ prefix? Or is there a reason to still keep it around?

@obrusvit obrusvit force-pushed the obrusvit/ui-features-firmware3 branch from 6bffb8e to ce1f988 Compare November 21, 2024 09:06
- `confirm_recovery` of model_t and model_r merged with
`flow_continue_recovery` of mercury into a `continue_recovery_homepage`
trait function
- parameters were renamed to be more descriptive
- model_t has also the remaining shares info passed in, but not used
- model_t version was moved from using plain Paragraph to a dedicated
component `ShareWords` so that it's consistent with other models. This
allowed to move formatting to Rust and allowed the trait function to
have `words` parameter of type `Vec<TString, 33>`
- model_r ShareWords::render slightly refactored to be consistent with
the new model_t version
- mercury uses a unique version. The reason is that mercury SwipeFlow
contains also the initial screen with instructions and prompt screen at
the end.
- decided to import stuff from micropython so that I don't have to write
`crate::micropython::yadayada` everywhere. I'll remove that from other
functions later during squash.
- not implemented for model_r
- model_t `ConfirmBlobParams` copied for now and the return type of
`into_layout` changed to `Result<Gc<LayoutObj>>`
- model_t ConfirmBlobParams removed from layout.rs
@obrusvit obrusvit force-pushed the obrusvit/ui-features-firmware3 branch from ce1f988 to 5d009d8 Compare November 21, 2024 12:38
- not implemented for mercury
- model_r `confirm_backup` and mercury `flow_prompt_backup` merged into
`prompt_backup`
- not implemented for model_t
- this fn is basically the same as confirm_action_simple for mercury
because the demibold font is the same as normal
- not implemented for model_r
@obrusvit obrusvit force-pushed the obrusvit/ui-features-firmware3 branch from 8ff9b58 to 97ec123 Compare November 25, 2024 07:23
@obrusvit obrusvit changed the title Introduce UiFeaturesFirmware trait [draft] Introduce trait UIFirmware Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code Code improvements core Trezor Core firmware. Runs on Trezor Model T and T2B1.
Projects
Status: 🏃‍♀️ In progress
Development

Successfully merging this pull request may close these issues.

2 participants