-
-
Notifications
You must be signed in to change notification settings - Fork 670
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
Allow mercury footer/header update based on content #4165
Allow mercury footer/header update based on content #4165
Conversation
|
(TR::instructions__swipe_up.into(), TR::recovery__more_shares_needed.into()) | ||
} else { | ||
(TString::empty(), TString::empty()) | ||
}; |
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.
Possibly unnecessary, PageHint already contains logic to display empty strings under single-page content (footer.rs:444).
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.
you're right, addressed on rebase
maybe not in this PR but ... how about flipping the dependency relationship and making |
@matejcik If I understand your suggestion correctly, that's what was happening before and it leads to creating more and more structs around the components and implementing struct SomeComplexScreen {
frame: Frame<Something>,
footer: Footer,
}
impl Component for SomeComplexScreen {
fn event(...) {
frame.footer.update_instruction(...);
...
}
} It seems to me cleaner to create those screens right away using regular components for the flow, now with the ability to change their content. Frame::new(title, Something::new()).with_footer(...).register_footer_update_fn(some_fn); I'm willing to discuss further. |
what I have in mind is removing you need |
This commit enables registering function for updating footer and header based on the content. This eliminates the need to create wrappers around Frame to update them. [no changelog]
[no changelog]
8e161a0
to
4d2a4d3
Compare
|
This PR modifies the mercury
Frame
so that it's able to hold a function pointer into aFooter
updating function andHeader
updating function. This is useful so that theFooter
orHeader
can react to the changes in the footer'scontent
without making additional wrappers aroundFrame
.This functionality is applied to
ShowShareWords
,ConfirmFido
and it also adds a footer page hint functionality toRemainingShares
window which didn't make it in #4142 . Another candidate might beaddress_detail.rs
In addition, the PR removes some unused code from the
Frame
.For future reference, other approaches were considered for the update functionality:
content
to theFooter
which would be something like&dyn InternallySwipable
. This is difficult to do because of lifetimes.content
wasInternallySwipable
. This would require "specialization" feature which is not stabilizedFn
instead of a function pointerfn
. This is difficult becauseFrame
must implementClone
andFn
is notSized
and we do not have a smart pointer wrapper.