Add more information and checkbox to register descriptor step
close #297
This commit is contained in:
parent
c9238404d5
commit
697fb16db9
@ -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.";
|
||||
|
||||
@ -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,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user