Merge #1718: Clear descriptor cache

a51704fcc66fcfa7e5bc133eaf2f7c406ee19e8b installer: let user reset the descriptor template (pythcoiner)

Pull request description:

  closes #1715

  ![image](https://github.com/user-attachments/assets/de68d4a8-bef8-48d3-b2f5-b7c7d587950a)

  ![image](https://github.com/user-attachments/assets/1645455a-d150-4c9f-bcd5-ddc2c40b0ee6)

  ![image](https://github.com/user-attachments/assets/23a75923-be1d-4b0d-bc9a-d3b92bf7236b)

ACKs for top commit:
  jp1ac4:
    tACK a51704fcc66fcfa7e5bc133eaf2f7c406ee19e8b.

Tree-SHA512: 6d47dea9893999f0b3e15bc1a78e30a29dc6ce0a4551ac637d02dff435c14f16cdd0188e49e52512e59f934ad9dcde4a20649e87fd874f7a19f7dc477c2b63b3
This commit is contained in:
edouardparis 2025-05-22 13:41:43 +02:00
commit bd72e318d1
No known key found for this signature in database
GPG Key ID: E65F7A089C20DC8F
5 changed files with 36 additions and 7 deletions

View File

@ -165,6 +165,7 @@ pub enum DefineDescriptor {
AddSafetyNetPath,
KeyModal(ImportKeyModal),
ThresholdSequenceModal(ThresholdSequenceModal),
Reset,
}
#[allow(clippy::large_enum_variant)]

View File

@ -218,6 +218,12 @@ impl Step for DefineDescriptor {
self.modal = Some(Box::new(modal));
return cmd;
}
Message::DefineDescriptor(message::DefineDescriptor::Reset) => {
self.keys.clear();
self.paths.clear();
self.load_template(self.descriptor_template);
self.modal = None;
}
Message::DefineDescriptor(message::DefineDescriptor::Path(i, msg)) => {
match msg {
message::DefinePath::SequenceEdited(seq) => {

View File

@ -253,12 +253,20 @@ pub fn custom_template<'a>(
Message::DefineDescriptor(message::DefineDescriptor::Path(sn_index + 1, msg))
})
}))
.push(Space::with_height(10))
.push(
Row::new().push(Space::with_width(Length::Fill)).push(
button::primary(None, "Continue")
.width(Length::Fixed(200.0))
.on_press_maybe(if valid { Some(Message::Next) } else { None }),
),
Row::new()
.push(
button::secondary(None, "Clear All")
.width(Length::Fixed(200.0))
.on_press(Message::DefineDescriptor(message::DefineDescriptor::Reset)),
)
.push(Space::with_width(Length::Fill))
.push(
button::primary(None, "Continue")
.width(Length::Fixed(200.0))
.on_press_maybe(if valid { Some(Message::Next) } else { None }),
),
)
.push(Space::with_height(100.0))
.spacing(20),

View File

@ -160,11 +160,18 @@ pub fn inheritance_template<'a>(
)
.map(|msg| Message::DefineDescriptor(message::DefineDescriptor::Path(1, msg))),
)
.push(Space::with_height(10))
.push(
Row::new()
.push(
button::secondary(None, "Clear All")
.width(Length::Fixed(120.0))
.on_press(Message::DefineDescriptor(message::DefineDescriptor::Reset)),
)
.push(Space::with_width(40))
.push(
button::secondary(None, "Customize")
.width(Length::Fixed(200.0))
.width(Length::Fixed(120.0))
.on_press(Message::DefineDescriptor(
message::DefineDescriptor::ChangeTemplate(
context::DescriptorTemplate::Custom,

View File

@ -230,11 +230,18 @@ pub fn multisig_security_template<'a>(
}
}),
)
.push(Space::with_height(10))
.push(
Row::new()
.push(
button::secondary(None, "Clear All")
.width(Length::Fixed(120.0))
.on_press(Message::DefineDescriptor(message::DefineDescriptor::Reset)),
)
.push(Space::with_width(40))
.push(
button::secondary(None, "Customize")
.width(Length::Fixed(200.0))
.width(Length::Fixed(120.0))
.on_press(Message::DefineDescriptor(
message::DefineDescriptor::ChangeTemplate(
context::DescriptorTemplate::Custom,