Revert ctx state for remote backend when user clicks on previous

This commit is contained in:
edouardparis 2024-08-14 11:32:25 +02:00
parent cc57f8f749
commit 80077905a6
3 changed files with 11 additions and 0 deletions

View File

@ -72,6 +72,10 @@ impl Installer {
{
self.current -= 1;
}
if let Some(step) = self.steps.get(self.current) {
step.revert(&mut self.context)
}
}
pub fn new(

View File

@ -260,6 +260,12 @@ impl Step for ChooseBackend {
true
}
/// If user clicks on previous to get back to the select backend, we revert the applied remote
/// backend on the context.
fn revert(&self, ctx: &mut Context) {
ctx.remote_backend = None;
}
fn view<'a>(
&'a self,
_hws: &'a HardwareWallets,

View File

@ -50,6 +50,7 @@ pub trait Step {
fn apply(&mut self, _ctx: &mut Context) -> bool {
true
}
fn revert(&self, _ctx: &mut Context) {}
fn stop(&self) {}
}