-
-
Notifications
You must be signed in to change notification settings - Fork 675
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
Chunkifying the receiving address #3237
Conversation
Do we still want to show the dots representing the pages even after adding the new hints? Especially since you can't go back anyway ... |
The thing you cannot go back is a bug. Should be solved by #2888 (#2902). @grdddj We should display max 16 chunks per page, not more. See the image below. What is the vertical space between rows/chunks? Is it currently variable? Also, can we align the "next page" arrow to fit the last chunk (or block of text)? |
Is it worth doing this complexity, when the only addresses longer than 16 chunks are
Vertical space between coherent text (inside one paragraph) is constant, as in all other text
Yes, we can somehow, but same as above, it is only valid for |
Is it worth doing this complexity, when the only addresses longer than 16 chunks are Cardano? Others are fine even without this limit? Hmm, probably not. And we can set the cardano address to appear as a standard string.
We should make it larger in both, TT and TR. |
Do you want to increase the vertical margin in this special case of chunked address, or in all the screens in general? |
Only in this special case of chunked address. |
Also please increase the horizontal space between chunks on TT by 1 px. |
1d8d08f
to
798a2d2
Compare
Force-pushed after rebase on It includes increase in vertical spacing, as well as increase in TT's horizontal space |
048d592
to
141024f
Compare
Last commit introduces chunkifying also for the address in sign flow. In @Hannsek Please consider if this looks good enough - and please look at all the other changed screens in signing flow. |
We should render the label not chunked. |
Right, the font is an Seems there are no easy fixes, as the font is so small (narrow) that these four letters just cannot be made as narrow as other characters. Possible measures:
Do you see some other possibilities? |
Please delete "account" in receive flow.
Please try it |
d8baa5b
to
fa24f7f
Compare
361682b
to
c2d03d1
Compare
…ignTx protobuf messages
…es from CI [no changelog]
[no changelog]
[no changelog]
c2d03d1
to
dd38f2a
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.
non-Rust part LGTM, just some superfluous default arguments
@@ -12,11 +12,12 @@ async def transfer( | |||
common: NEMTransactionCommon, | |||
transfer: NEMTransfer, | |||
node: bip32.HDNode, | |||
chunkify: bool = 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.
argument here and in layout.ask_transfer does not need a default value
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.
Done in 7e03759
core/src/apps/monero/layout.py
Outdated
@@ -143,6 +145,7 @@ async def _require_confirm_output( | |||
dst: MoneroTransactionDestinationEntry, | |||
network_type: MoneroNetworkType, | |||
payment_id: bytes | None, | |||
chunkify: bool = 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.
remove default value
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.
Done in 7e03759
core/src/apps/cardano/layout.py
Outdated
@@ -210,6 +210,7 @@ async def confirm_sending( | |||
to: str, | |||
output_type: Literal["address", "change", "collateral-return"], | |||
network_id: int, | |||
chunkify: bool = 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.
remove default value
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.
Done in 7e03759
@@ -62,6 +62,7 @@ async def confirm_output( | |||
coin: CoinInfo, | |||
amount_unit: AmountUnit, | |||
output_index: int, | |||
chunkify: bool = 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.
remove default value
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.
Done in 7e03759
core/src/apps/binance/layout.py
Outdated
|
||
|
||
async def _confirm_transfer(inputs_outputs: Sequence[tuple[str, str, str]]) -> None: | ||
async def _confirm_transfer( | ||
inputs_outputs: Sequence[tuple[str, str, str]], chunkify: bool = 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.
remove default value
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.
Done in 7e03759
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.
Screens look good now. Commented some nits, also not super happy about the renderer changes but don't really see how we can come up with something better in short time.
@@ -110,6 +110,7 @@ message GetAddress { | |||
optional MultisigRedeemScriptType multisig = 4; // filled if we are showing a multisig address | |||
optional InputScriptType script_type = 5 [default=SPENDADDRESS]; // used to distinguish between various address formats (non-segwit, segwit, etc.) | |||
optional bool ignore_xpub_magic = 6; // ignore SLIP-0132 XPUB magic, use xpub/tpub prefix for all account types | |||
optional bool chunkify = 7; // display the address in chunks of 4 characters |
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.
Nit: thinking if we can come up with a more descriptive name, perhaps indicate that it is related to show_display
. show_chunks
? show_segmented
?
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.
Can change it to anything, if we agree. What is your preference? @matejcik
show_chunks
sounds good to me
/// How big will be the space between chunks (in pixels). | ||
pub x_offset: i16, | ||
/// Optional characters that are wider and should be accounted for | ||
pub wider_chars: Option<&'static str>, |
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.
Kinda hate this tbh (as well as the whole idea of trying to render variable-width font as a fixed-width font). Trying to think how to make this more general. Can we instead remember the width of a normal (or smallest) character and keep track of the actual chunk size when processing chunk?
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.
Nor am I happy with this, but this "almost-mono-font" can hardly be fixed to be "completely-mono", because of its small width, as I am describing here
Not sure I follow your suggestion - can you prototype some code for it?
Merging this does not need to be final, we can improve it in the future
line.advance.y = 0; | ||
// Decreasing the offset for each wider character in the chunk | ||
line.advance.x += chunkify_config.x_offset - chunks_wider_chars; | ||
return line; |
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 wonder if this can't break line-counting somewhere?
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.
The tests seem to be alright, it works even with longer addresses that paginate (Cardano ones)
Op::Chunkify(chunk) => { | ||
if let Some((chunk_config, extra_y_offset)) = chunk { | ||
self.layout.style.chunks = Some(chunk_config); | ||
self.layout.style.extra_y_line_advance = Some(extra_y_offset); | ||
} else { | ||
self.layout.style.chunks = None; | ||
self.layout.style.extra_y_line_advance = None; | ||
} | ||
} |
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.
Op::Chunkify(chunk) => { | |
if let Some((chunk_config, extra_y_offset)) = chunk { | |
self.layout.style.chunks = Some(chunk_config); | |
self.layout.style.extra_y_line_advance = Some(extra_y_offset); | |
} else { | |
self.layout.style.chunks = None; | |
self.layout.style.extra_y_line_advance = None; | |
} | |
} | |
Op::Chunkify(Some((chunk_config, extra_y_offset))) => { | |
self.layout.style.chunks = Some(chunk_config); | |
self.layout.style.extra_y_line_advance = Some(extra_y_offset); | |
} | |
Op::Chunkify(None) => { | |
self.layout.style.chunks = None; | |
self.layout.style.extra_y_line_advance = None; | |
} |
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 have simplified it in eb3cab9 by separating to two Op
enums
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'm OK with merging this, rename the parameter to show_chunks
if you want.
ddef752
to
7019b1a
Compare
…can send a button request in between [no changelog]
…ests to start with "is_" [no changelog]
…ce tests [no changelog]
[no changelog]
@prusnak please review the change request, it is blocking the merge. |
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 reviewed only protobuf def changes
Fixes #3210: