Merge #315: Add more information and checkbox to register descriptor step

697fb16db976d0bc643381b10342f2df650a4386 Add more information and checkbox to register descriptor step (edouard)

Pull request description:

  ![2023-02-04T10:04:29,401091329+01:00](https://user-images.githubusercontent.com/6933020/216759166-1a4fc04f-aa4a-480d-a568-8f60a7d33d16.png)
  close #297

ACKs for top commit:
  darosior:
    utACK 697fb16db976d0bc643381b10342f2df650a4386 -- text looks good to me.

Tree-SHA512: 2bfdad9e512612e8cdc5247d0d2a4b35686f97b31fea508f6674baa5e7b1beb5a7929377a9cb3b843644597d186bff67f0200c1d08b6bd2d335477dbcaa83456
This commit is contained in:
edouard 2023-02-04 12:46:52 +01:00
commit 29a302bada
No known key found for this signature in database
GPG Key ID: E65F7A089C20DC8F
3 changed files with 20 additions and 6 deletions

View File

@ -6,3 +6,4 @@ pub const DEFINE_DESCRIPTOR_SEQUENCE_TOOLTIP: &str =
"Number of blocks after a coin is received \nfor which the recovery path is not available";
pub const DEFINE_DESCRIPTOR_FINGERPRINT_TOOLTIP: &str =
"The alias is applied on all the keys derived from the same seed";
pub const REGISTER_DESCRIPTOR_HELP: &str = "To be used with the wallet, a device needs the descriptor. Registration on a device is not a substitute for backing up the descriptor.";

View File

@ -1034,6 +1034,7 @@ pub struct RegisterDescriptor {
hmacs: Vec<(Fingerprint, DeviceKind, Option<[u8; 32]>)>,
registered: HashSet<Fingerprint>,
error: Option<Error>,
done: bool,
}
impl Step for RegisterDescriptor {
@ -1085,6 +1086,9 @@ impl Step for RegisterDescriptor {
self.hws = Vec::new();
return self.load();
}
Message::UserActionDone(done) => {
self.done = done;
}
_ => {}
};
Command::none()
@ -1111,6 +1115,7 @@ impl Step for RegisterDescriptor {
self.error.as_ref(),
self.processing,
self.chosen_hw,
self.done,
)
}
}

View File

@ -605,6 +605,7 @@ pub fn participate_xpub(
)
}
#[allow(clippy::too_many_arguments)]
pub fn register_descriptor<'a>(
progress: (usize, usize),
descriptor: String,
@ -613,10 +614,12 @@ pub fn register_descriptor<'a>(
error: Option<&Error>,
processing: bool,
chosen_hw: Option<usize>,
done: bool,
) -> Element<'a, Message> {
layout(
progress,
Column::new()
.max_width(1000)
.push(text("Register descriptor").bold().size(50))
.push(card::simple(
Column::new()
@ -628,9 +631,9 @@ pub fn register_descriptor<'a>(
.on_press(Message::Clibpboard(descriptor)),
),
)
.spacing(10)
.max_width(1000),
.spacing(10),
))
.push(text(prompt::REGISTER_DESCRIPTOR_HELP))
.push_maybe(error.map(|e| card::error("Failed to register descriptor", e.to_string())))
.push(
Column::new()
@ -640,7 +643,7 @@ pub fn register_descriptor<'a>(
.align_items(Alignment::Center)
.push(
Container::new(
text(format!("{} hardware wallets connected", hws.len()))
text("Select hardware wallet to register descriptor on:")
.bold(),
)
.width(Length::Fill),
@ -668,12 +671,17 @@ pub fn register_descriptor<'a>(
)
.width(Length::Fill),
)
.push(if processing {
button::primary(None, "Next").width(Length::Units(200))
} else {
.push(Checkbox::new(
"I have registered the descriptor on my device(s)",
done,
Message::UserActionDone,
))
.push(if done && !processing {
button::primary(None, "Next")
.on_press(Message::Next)
.width(Length::Units(200))
} else {
button::primary(None, "Next").width(Length::Units(200))
})
.width(Length::Fill)
.height(Length::Fill)