Skip to content

Commit

Permalink
fixup! fix(core): rebase on current drawlib
Browse files Browse the repository at this point in the history
  • Loading branch information
mmilata committed Mar 15, 2024
1 parent 25b0e3b commit 38cb5c3
Show file tree
Hide file tree
Showing 7 changed files with 1,371 additions and 1,350 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ where
let background_color = theme::BG;
let inactive_color = background_color.blend(active_color, 85);

let start = (self.value - 100) % 1000;
let end = (self.value + 100) % 1000;
let start = ((start as i32 * 8 * PI4 as i32) / 1000) as i16;
let end = ((end as i32 * 8 * PI4 as i32) / 1000) as i16;
let start = (self.value as i32 - 100) % 1000;
let end = (self.value as i32 + 100) % 1000;
let start = ((start * 8 * PI4 as i32) / 1000) as i16;
let end = ((end * 8 * PI4 as i32) / 1000) as i16;

shape::Circle::new(center, LOADER_OUTER)
.with_bg(inactive_color)
Expand Down
19 changes: 18 additions & 1 deletion core/embed/rust/src/ui/model_mercury/component/fido.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,19 @@ where
page_swipe.allow_right = scrollbar.has_previous_page();
page_swipe.allow_left = scrollbar.has_next_page();

let current_account = get_account(scrollbar.active_page);
// NOTE: This is an ugly hotfix for the erroneous behavior of
// TextLayout used in the account_name Label. In this
// particular case, TextLayout calculates the wrong height of
// fitted text that's higher than the TextLayout bound itself.
//
// The following two lines should be swapped when the problem with
// TextLayout is fixed.
//
// See also, continuation of this hotfix in the place() function.

// let current_account = get_account(scrollbar.active_page);
let current_account = "".into();


Self {
app_name: Label::centered(app_name, theme::TEXT_DEMIBOLD),
Expand Down Expand Up @@ -147,6 +159,11 @@ where
self.app_name.place(app_name_area);
self.account_name.place(account_name_area);

// NOTE: This is a hotfix used due to the erroneous behavior of TextLayout.
// This line should be removed when the problem with TextLayout is fixed.
// See also the code for FidoConfirm::new().
self.account_name.set_text((self.get_account)(self.scrollbar.active_page));

bounds
}

Expand Down
2 changes: 1 addition & 1 deletion core/embed/rust/src/ui/shape/model/model_mercury.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl BasicCanvas for DisplayModelMercury {
self.size
}

fn fill_rect(&mut self, r: Rect, color: Color) {
fn fill_rect(&mut self, r: Rect, color: Color, _alpha: u8) {
let r = r.translate(self.viewport.origin);
Dma2d::wnd565_fill(r, self.viewport.clip, color);
}
Expand Down
13 changes: 8 additions & 5 deletions core/src/trezor/ui/layouts/mercury/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,11 +655,16 @@ async def confirm_output(
return


async def confirm_payment_request(
async def should_show_payment_request_details(
recipient_name: str,
amount: str,
memos: list[str],
) -> bool:
"""Return True if the user wants to show payment request details (they click a
special button) and False when the user wants to continue without showing details.
Raises ActionCancelled if the user cancels.
"""
result = await interact(
RustLayout(
trezorui2.confirm_with_info(
Expand All @@ -674,12 +679,10 @@ async def confirm_payment_request(
ButtonRequestType.ConfirmOutput,
)

# When user pressed INFO, returning False, which gets processed in higher function
# to differentiate it from CONFIRMED. Raising otherwise.
if result is CONFIRMED:
return True
elif result is INFO:
return False
elif result is INFO:
return True
else:
raise ActionCancelled

Expand Down
1 change: 1 addition & 0 deletions tests/device_tests/bitcoin/test_signmessage.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ def test_signmessage_pagination(client: Client, message: str):

@pytest.mark.skip_t1b1
@pytest.mark.skip_t2b1(reason="Different screen size")
@pytest.mark.skip_t3t1(reason="Different fonts")
def test_signmessage_pagination_trailing_newline(client: Client):
message = "THIS\nMUST\nNOT\nBE\nPAGINATED\n"
# The trailing newline must not cause a new paginated screen to appear.
Expand Down
2 changes: 1 addition & 1 deletion tests/input_flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ def __init__(self, client: Client, lock_time_str: str):
def assert_func(self, debug: DebugLink, br: messages.ButtonRequest) -> None:
layout_text = get_text_possible_pagination(debug, br)
TR.assert_in(layout_text, "bitcoin__locktime_set_to")
assert self.lock_time_str in layout_text
assert self.lock_time_str.replace(' ', '') in layout_text.replace(' ', '')

def input_flow_tt(self) -> BRGeneratorType:
yield from lock_time_input_flow_tt(self.debug, self.assert_func)
Expand Down
Loading

0 comments on commit 38cb5c3

Please sign in to comment.