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.
This commit is contained in:
jp1ac4 2023-08-21 10:25:59 +01:00
parent 557c775912
commit 765c68b02e
No known key found for this signature in database
GPG Key ID: A7ACD32423568D7B

View File

@ -299,6 +299,7 @@ pub fn define_descriptor<'a>(
.push(Space::with_height(Length::Fixed(20.0))) .push(Space::with_height(Length::Fixed(20.0)))
.spacing(50), .spacing(50),
false, false,
None,
) )
} }
@ -416,6 +417,7 @@ pub fn import_descriptor<'a>(
.push_maybe(error.map(|e| card::error("Invalid descriptor", e.to_string()))) .push_maybe(error.map(|e| card::error("Invalid descriptor", e.to_string())))
.spacing(50), .spacing(50),
true, true,
None,
) )
} }
@ -646,7 +648,8 @@ pub fn participate_xpub<'a>(
button::primary(None, "Next").width(Length::Fixed(200.0)) button::primary(None, "Next").width(Length::Fixed(200.0))
}) })
.spacing(50), .spacing(50),
true true,
None,
) )
} }
@ -738,6 +741,7 @@ pub fn register_descriptor<'a>(
}) })
.spacing(50), .spacing(50),
true, true,
None,
) )
} }
@ -805,6 +809,7 @@ pub fn backup_descriptor<'a>(
}) })
.spacing(50), .spacing(50),
true, true,
None,
) )
} }
@ -891,6 +896,7 @@ pub fn define_bitcoin<'a>(
) )
.spacing(50), .spacing(50),
true, true,
None,
) )
} }
@ -1049,6 +1055,7 @@ pub fn install<'a>(
.spacing(10) .spacing(10)
.width(Length::Fill), .width(Length::Fill),
true, true,
None,
) )
} }
@ -1558,6 +1565,7 @@ pub fn backup_mnemonic<'a>(
}) })
.spacing(50), .spacing(50),
true, true,
None,
) )
} }
@ -1660,6 +1668,7 @@ pub fn recover_mnemonic<'a>(
}) })
.spacing(50), .spacing(50),
true, true,
None,
) )
} }
@ -1668,6 +1677,7 @@ fn layout<'a>(
title: &'static str, title: &'static str,
content: impl Into<Element<'a, Message>>, content: impl Into<Element<'a, Message>>,
padding_left: bool, padding_left: bool,
previous_message: Option<Message>,
) -> Element<'a, Message> { ) -> Element<'a, Message> {
Container::new(scrollable( Container::new(scrollable(
Column::new() Column::new()
@ -1679,7 +1689,7 @@ fn layout<'a>(
.push( .push(
Container::new( Container::new(
button::transparent(Some(icon::previous_icon()), "Previous") button::transparent(Some(icon::previous_icon()), "Previous")
.on_press(Message::Previous), .on_press(previous_message.unwrap_or(Message::Previous)),
) )
.width(Length::FillPortion(2)) .width(Length::FillPortion(2))
.center_x(), .center_x(),