-
-
Notifications
You must be signed in to change notification settings - Fork 671
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
refactor confirm_summary #4412
refactor confirm_summary #4412
Conversation
|
|
41daa08
to
ff7f6ea
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beautiful refactor!
Some comments added.
theme::ICON_CANCEL, | ||
cancel_text.unwrap_or(TR::send__cancel_sign.into()), | ||
); | ||
if content_extra.is_some() && menu_items.len() < 2 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really like the hardcoded "2" here. Ideally it would be somehow computed based on the screen size, but a big step forward (probably good enough) would be a constant in vertical_menu.rs
- something like MAX_ITEMS_ON_SCREEN
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.get(Qstr::MP_QSTR_extra_items) | ||
.unwrap_or_else(|_| Obj::const_none()) | ||
.try_into_option()?; | ||
let cancel_arrow: bool = kwargs.get_or(Qstr::MP_QSTR_cancel_arrow, false)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that on model R it should be verb_cancel = "^"
versus verb_cancel = ""
to mark the "up arrow" versus the "x" icon. I've seen that used in other places. Introducing the concept of "cancel_arrow" seems wrong, not just because it's unclear what it means, but also because it is not portable across models.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both TT
and TR
either uses "x" or "^" as the cancel button so that you can use "^" if the summary is a part of uPy flow.
TT
uses cancel_arrow
now and it used it before.
TR
used cancel_cross
before in altcoin_tx_summary
which was basically the opposite of what cancel_arrow
does. So I unified it.
Lincoln
will probably need it as well given current designs.
Mercury
does not need it but maybe it will if the designs change in the future based on Lincoln.
Having verb_cancel
there might make more sense. Let me try.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
made a mistake for TR
, fixed here: 61448aa
why make |
@matejcik EDIT: we agreed to change to just |
- model_t confirm_total refactored to confirm_summary - parameter set changed to pave the way for unification across models [no changelog]
6a25ea7
to
f57d045
Compare
code ACK, waiting for device tests before approving |
- altcoin_tx_summary removed and replaced with confirm_summary [no changelog]
- old confirm_total removed - flow_confirm_summary refactored to confirm_summary [no changelog]
f57d045
to
69eab66
Compare
This is a refactor of a transaction summary confirmation dialog:
confirm_summary
. The reason is to unify the rust function signature across models. This paves the way for easier work on #3658. uPy functions were refactored accordingly. The rust functions of all three models now have these parameters:amount
amount_label
fee
fee_label
title
(Optional)account_items
(Optional) - KV pairs of "send from" info (e.g. account name, derivation paths, etc.)extra_items
(Optional) - KV pairs of whatever other info, typically used for other fee info (e.g. fee rate, gas price of ETH, etc.) or some other coin-specific info (e.g.TTL
for Cardano)extra_title
(Optional) - title forextra_items
verb_cancel
(Optional) - cancel button verb, can be used onTR
andTT
to signify whether the button is arrow up (^
), meaning a user can go back one step in uPy flowChanges:
TT
]confirm_total
replaced byconfirm_summary
_items
are passed to rust but are actually not used there as they are used within uPy flow ofwith_info
TR
]confirm_total
andaltcoin_tx
summary were merged toconfirm_summary
. The function now handles all Optional info placed one after another.Mercury
]flow_confirm_summary
replaced byconfirm_summary
confirm_total
removed - it wasn't usedUI diff:
TR
]vertically_centered()
instead of manual.newline()
, lots of negligible diffs