From 765c68b02e87dbea7d14935642ff9a91dcbc9ee2 Mon Sep 17 00:00:00 2001 From: jp1ac4 <121959000+jp1ac4@users.noreply.github.com> Date: Mon, 21 Aug 2023 10:25:59 +0100 Subject: [PATCH] installer: allow for different previous messages Clicking the "Previous" button during installation will default to the current behaviour, unless a different message is passed to the function by any given step. --- gui/src/installer/view.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gui/src/installer/view.rs b/gui/src/installer/view.rs index d8e636cb..a7c0b805 100644 --- a/gui/src/installer/view.rs +++ b/gui/src/installer/view.rs @@ -299,6 +299,7 @@ pub fn define_descriptor<'a>( .push(Space::with_height(Length::Fixed(20.0))) .spacing(50), false, + None, ) } @@ -416,6 +417,7 @@ pub fn import_descriptor<'a>( .push_maybe(error.map(|e| card::error("Invalid descriptor", e.to_string()))) .spacing(50), true, + None, ) } @@ -646,7 +648,8 @@ pub fn participate_xpub<'a>( button::primary(None, "Next").width(Length::Fixed(200.0)) }) .spacing(50), - true + true, + None, ) } @@ -738,6 +741,7 @@ pub fn register_descriptor<'a>( }) .spacing(50), true, + None, ) } @@ -805,6 +809,7 @@ pub fn backup_descriptor<'a>( }) .spacing(50), true, + None, ) } @@ -891,6 +896,7 @@ pub fn define_bitcoin<'a>( ) .spacing(50), true, + None, ) } @@ -1049,6 +1055,7 @@ pub fn install<'a>( .spacing(10) .width(Length::Fill), true, + None, ) } @@ -1558,6 +1565,7 @@ pub fn backup_mnemonic<'a>( }) .spacing(50), true, + None, ) } @@ -1660,6 +1668,7 @@ pub fn recover_mnemonic<'a>( }) .spacing(50), true, + None, ) } @@ -1668,6 +1677,7 @@ fn layout<'a>( title: &'static str, content: impl Into>, padding_left: bool, + previous_message: Option, ) -> Element<'a, Message> { Container::new(scrollable( Column::new() @@ -1679,7 +1689,7 @@ fn layout<'a>( .push( Container::new( button::transparent(Some(icon::previous_icon()), "Previous") - .on_press(Message::Previous), + .on_press(previous_message.unwrap_or(Message::Previous)), ) .width(Length::FillPortion(2)) .center_x(),