@@ -33,6 +33,7 @@ pub struct Installer {
33
33
steps : Vec < Box < dyn Step > > ,
34
34
hws : HardwareWallets ,
35
35
signer : Arc < Mutex < Signer > > ,
36
+ back_button : bool ,
36
37
37
38
/// Context is data passed through each step.
38
39
context : Context ,
@@ -58,14 +59,21 @@ impl Installer {
58
59
pub fn new (
59
60
destination_path : PathBuf ,
60
61
network : bitcoin:: Network ,
62
+ back_button : bool ,
61
63
) -> ( Installer , Command < Message > ) {
64
+ let path = if back_button {
65
+ Some ( destination_path. clone ( ) )
66
+ } else {
67
+ None
68
+ } ;
62
69
(
63
70
Installer {
64
71
current : 0 ,
65
72
hws : HardwareWallets :: new ( destination_path. clone ( ) , network) ,
66
- steps : vec ! [ Welcome :: default ( ) . into( ) ] ,
73
+ steps : vec ! [ Welcome :: new ( path ) . into( ) ] ,
67
74
context : Context :: new ( network, destination_path) ,
68
75
signer : Arc :: new ( Mutex :: new ( Signer :: generate ( network) . unwrap ( ) ) ) ,
76
+ back_button,
69
77
} ,
70
78
Command :: none ( ) ,
71
79
)
@@ -134,10 +142,15 @@ impl Installer {
134
142
}
135
143
136
144
pub fn update ( & mut self , message : Message ) -> Command < Message > {
145
+ let path = if self . back_button {
146
+ Some ( self . context . data_dir . clone ( ) )
147
+ } else {
148
+ None
149
+ } ;
137
150
match message {
138
151
Message :: CreateWallet => {
139
152
self . steps = vec ! [
140
- Welcome :: default ( ) . into( ) ,
153
+ Welcome :: new ( path ) . into( ) ,
141
154
DefineDescriptor :: new( self . signer. clone( ) ) . into( ) ,
142
155
BackupMnemonic :: new( self . signer. clone( ) ) . into( ) ,
143
156
BackupDescriptor :: default ( ) . into( ) ,
@@ -151,7 +164,7 @@ impl Installer {
151
164
}
152
165
Message :: ParticipateWallet => {
153
166
self . steps = vec ! [
154
- Welcome :: default ( ) . into( ) ,
167
+ Welcome :: new ( path ) . into( ) ,
155
168
ParticipateXpub :: new( self . signer. clone( ) ) . into( ) ,
156
169
ImportDescriptor :: new( false ) . into( ) ,
157
170
BackupMnemonic :: new( self . signer. clone( ) ) . into( ) ,
@@ -166,7 +179,7 @@ impl Installer {
166
179
}
167
180
Message :: ImportWallet => {
168
181
self . steps = vec ! [
169
- Welcome :: default ( ) . into( ) ,
182
+ Welcome :: new ( path ) . into( ) ,
170
183
ImportDescriptor :: new( true ) . into( ) ,
171
184
RecoverMnemonic :: default ( ) . into( ) ,
172
185
RegisterDescriptor :: new_import_wallet( ) . into( ) ,
0 commit comments