mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-08-01 19:38:33 +00:00
fix(core): don't enter/exit menu via horizontal swipe on Bolt
This commit is contained in:
parent
6d35f047b8
commit
0d87266bfc
1
core/.changelog.d/5189.removed.2
Normal file
1
core/.changelog.d/5189.removed.2
Normal file
@ -0,0 +1 @@
|
||||
[T2T1] Don't enter/exit menu via horizontal swipe.
|
@ -121,16 +121,6 @@ where
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_swipe_left(mut self) -> Self {
|
||||
self.swipe_left = true;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_swipe_right(mut self) -> Self {
|
||||
self.swipe_right = true;
|
||||
self
|
||||
}
|
||||
|
||||
fn setup_swipe(&mut self) {
|
||||
self.swipe.allow_up = self.scrollbar.has_next_page();
|
||||
self.swipe.allow_down = self.scrollbar.has_previous_page();
|
||||
|
@ -17,7 +17,6 @@ pub struct SimplePage<T> {
|
||||
swipe: Swipe,
|
||||
scrollbar: ScrollBar,
|
||||
axis: Axis,
|
||||
swipe_right_to_go_back: bool,
|
||||
fade: Cell<Option<u8>>,
|
||||
}
|
||||
|
||||
@ -33,7 +32,6 @@ where
|
||||
pad: Pad::with_background(background),
|
||||
scrollbar: ScrollBar::new(axis),
|
||||
axis,
|
||||
swipe_right_to_go_back: false,
|
||||
fade: Cell::new(None),
|
||||
}
|
||||
}
|
||||
@ -46,11 +44,6 @@ where
|
||||
Self::new(content, Axis::Vertical, background)
|
||||
}
|
||||
|
||||
pub fn with_swipe_right_to_go_back(mut self) -> Self {
|
||||
self.swipe_right_to_go_back = true;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn inner(&self) -> &T {
|
||||
&self.content
|
||||
}
|
||||
@ -58,12 +51,10 @@ where
|
||||
fn setup_swipe(&mut self) {
|
||||
if self.is_horizontal() {
|
||||
self.swipe.allow_left = self.scrollbar.has_next_page();
|
||||
self.swipe.allow_right =
|
||||
self.scrollbar.has_previous_page() || self.swipe_right_to_go_back;
|
||||
self.swipe.allow_right = self.scrollbar.has_previous_page();
|
||||
} else {
|
||||
self.swipe.allow_up = self.scrollbar.has_next_page();
|
||||
self.swipe.allow_down = self.scrollbar.has_previous_page();
|
||||
self.swipe.allow_right = self.swipe_right_to_go_back;
|
||||
}
|
||||
}
|
||||
|
||||
@ -137,11 +128,6 @@ where
|
||||
self.change_page(ctx, 1);
|
||||
return None;
|
||||
}
|
||||
(SwipeDirection::Right, _)
|
||||
if self.swipe_right_to_go_back && self.scrollbar.active_page == 0 =>
|
||||
{
|
||||
return Some(PageMsg::Cancelled);
|
||||
}
|
||||
(SwipeDirection::Right, Axis::Horizontal)
|
||||
| (SwipeDirection::Down, Axis::Vertical) => {
|
||||
self.change_page(ctx, -1);
|
||||
|
@ -298,9 +298,7 @@ impl FirmwareUI for UIBolt {
|
||||
Frame::left_aligned(
|
||||
theme::label_title(),
|
||||
title,
|
||||
ButtonPage::new(paragraphs, theme::BG)
|
||||
.with_hold()?
|
||||
.with_swipe_left(),
|
||||
ButtonPage::new(paragraphs, theme::BG).with_hold()?,
|
||||
)
|
||||
.with_info_button(),
|
||||
);
|
||||
@ -453,12 +451,9 @@ impl FirmwareUI for UIBolt {
|
||||
.add(Paragraph::new(&theme::TEXT_NORMAL, fee_label).no_break())
|
||||
.add(Paragraph::new(&theme::TEXT_MONO, fee));
|
||||
|
||||
let mut page = ButtonPage::new(paragraphs.into_paragraphs(), theme::BG)
|
||||
let page = ButtonPage::new(paragraphs.into_paragraphs(), theme::BG)
|
||||
.with_hold()?
|
||||
.with_cancel_button(verb_cancel);
|
||||
if info_button {
|
||||
page = page.with_swipe_left();
|
||||
}
|
||||
let mut frame = Frame::left_aligned(
|
||||
theme::label_title(),
|
||||
title.unwrap_or(TString::empty()),
|
||||
@ -775,8 +770,7 @@ impl FirmwareUI for UIBolt {
|
||||
ad.add_xpub(xtitle, text)?;
|
||||
}
|
||||
|
||||
let layout =
|
||||
RootComponent::new(SimplePage::horizontal(ad, theme::BG).with_swipe_right_to_go_back());
|
||||
let layout = RootComponent::new(SimplePage::horizontal(ad, theme::BG));
|
||||
Ok(layout)
|
||||
}
|
||||
|
||||
@ -981,8 +975,7 @@ impl FirmwareUI for UIBolt {
|
||||
Frame::left_aligned(
|
||||
theme::label_title(),
|
||||
title,
|
||||
SimplePage::new(paragraphs.into_paragraphs(), axis, theme::BG)
|
||||
.with_swipe_right_to_go_back(),
|
||||
SimplePage::new(paragraphs.into_paragraphs(), axis, theme::BG),
|
||||
)
|
||||
.with_cancel_button(),
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user