Skip to content

Commit 3fdfd79

Browse files
committed
gui: wording + add encrypted descriptor export
1 parent 792aa31 commit 3fdfd79

File tree

4 files changed

+24
-50
lines changed

4 files changed

+24
-50
lines changed

liana-gui/src/app/state/settings/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,9 @@ impl State for ImportExportSettingsState {
244244
return modal.update(m);
245245
};
246246
}
247-
Message::View(view::Message::Settings(view::SettingsMessage::ExportDescriptor)) => {
247+
Message::View(view::Message::Settings(
248+
view::SettingsMessage::ExportEncryptedDescriptor,
249+
)) => {
248250
if self.modal.is_none() {
249251
let modal = ExportModal::new(
250252
Some(daemon),

liana-gui/src/app/state/settings/wallet.rs

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pub struct WalletSettingsState {
5454
modal: Modal,
5555
processing: bool,
5656
updated: bool,
57-
config: Arc<Config>,
57+
_config: Arc<Config>,
5858
}
5959

6060
impl WalletSettingsState {
@@ -73,7 +73,7 @@ impl WalletSettingsState {
7373
modal: Modal::None,
7474
processing: false,
7575
updated: false,
76-
config,
76+
_config: config,
7777
}
7878
}
7979

@@ -271,41 +271,20 @@ impl State for WalletSettingsState {
271271
Task::none()
272272
}
273273
}
274-
Message::View(view::Message::Settings(view::SettingsMessage::ExportWallet)) => {
274+
Message::View(view::Message::Settings(
275+
view::SettingsMessage::ExportEncryptedDescriptor,
276+
)) => {
275277
if self.modal.is_none() {
276-
let datadir = cache.datadir_path.clone();
277-
let network = cache.network;
278-
let config = self.config.clone();
279-
let wallet = self.wallet.clone();
280-
let daemon = daemon.clone();
278+
let descriptor = self.wallet.main_descriptor.clone();
281279
let modal = ExportModal::new(
282280
Some(daemon),
283-
ImportExportType::ExportProcessBackup(datadir, network, config, wallet),
281+
ImportExportType::ExportEncryptedDescriptor(Box::new(descriptor)),
284282
);
285283
let launch = modal.launch(true);
286284
self.modal = Modal::ImportExport(modal);
287-
launch
288-
} else {
289-
Task::none()
290-
}
291-
}
292-
Message::View(view::Message::Settings(view::SettingsMessage::ImportWallet)) => {
293-
if self.modal.is_none() {
294-
let modal = ExportModal::new(
295-
Some(daemon),
296-
ImportExportType::ImportBackup {
297-
network_dir: cache.datadir_path.network_directory(cache.network),
298-
wallet: self.wallet.clone(),
299-
overwrite_labels: None,
300-
overwrite_aliases: None,
301-
},
302-
);
303-
let launch = modal.launch(false);
304-
self.modal = Modal::ImportExport(modal);
305-
launch
306-
} else {
307-
Task::none()
285+
return launch;
308286
}
287+
Task::none()
309288
}
310289
_ => match &mut self.modal {
311290
Modal::RegisterWallet(m) => m.update(daemon, cache, message),

liana-gui/src/app/view/message.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ pub enum SettingsMessage {
9292
RemoteBackendSettings(RemoteBackendSettingsMessage),
9393
EditWalletSettings,
9494
ImportExportSection,
95-
ExportDescriptor,
95+
ExportEncryptedDescriptor,
9696
ExportTransactions,
9797
ExportLabels,
9898
ExportWallet,

liana-gui/src/app/view/settings.rs

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,9 @@ pub fn import_export<'a>(cache: &'a Cache, warning: Option<&Error>) -> Element<'
208208

209209
let export_descriptor = export_section(
210210
"Descriptor only",
211-
"Descriptor file only, to use with other wallets.",
211+
"Plain-text descriptor file only, to use with other wallets.",
212212
icon::backup_icon(),
213-
Message::Settings(SettingsMessage::ExportDescriptor),
213+
Message::Settings(SettingsMessage::ExportEncryptedDescriptor),
214214
);
215215

216216
let export_transactions = export_section(
@@ -228,14 +228,14 @@ pub fn import_export<'a>(cache: &'a Cache, warning: Option<&Error>) -> Element<'
228228
);
229229

230230
let export_wallet = export_section(
231-
"Back up wallet",
232-
"File with wallet info needed to restore on other devices (no private keys).",
231+
"Export wallet",
232+
"File with wallet info useful to sync labels and data on other devices.",
233233
icon::backup_icon(),
234234
Message::Settings(SettingsMessage::ExportWallet),
235235
);
236236

237237
let import_wallet = export_section(
238-
"Restore wallet",
238+
"Import wallet",
239239
"Upload a backup file to update wallet info.",
240240
icon::restore_icon(),
241241
Message::Settings(SettingsMessage::ImportWallet),
@@ -1000,18 +1000,6 @@ pub fn wallet_settings<'a>(
10001000
) -> Element<'a, Message> {
10011001
let header = header("Wallet", SettingsMessage::EditWalletSettings);
10021002

1003-
let import_export = Row::new()
1004-
.push(
1005-
button::secondary(Some(icon::backup_icon()), "Backup")
1006-
.on_press(Message::Settings(SettingsMessage::ExportWallet)),
1007-
)
1008-
.push(Space::with_width(10))
1009-
.push(
1010-
button::secondary(Some(icon::restore_icon()), "Restore")
1011-
.on_press(Message::Settings(SettingsMessage::ImportWallet)),
1012-
)
1013-
.push(Space::with_width(Length::Fill));
1014-
10151003
let descr = card::simple(
10161004
Column::new()
10171005
.push(text("Wallet descriptor:").bold())
@@ -1029,6 +1017,12 @@ pub fn wallet_settings<'a>(
10291017
Row::new()
10301018
.spacing(10)
10311019
.push(Column::new().width(Length::Fill))
1020+
.push(
1021+
button::secondary(Some(icon::backup_icon()), "Back Up Descriptor")
1022+
.on_press(Message::Settings(
1023+
SettingsMessage::ExportEncryptedDescriptor,
1024+
)),
1025+
)
10321026
.push(
10331027
button::secondary(Some(icon::clipboard_icon()), "Copy")
10341028
.on_press(Message::Clipboard(descriptor.to_string())),
@@ -1108,7 +1102,6 @@ pub fn wallet_settings<'a>(
11081102
Column::new()
11091103
.spacing(20)
11101104
.push(header)
1111-
.push(import_export)
11121105
.push(descr)
11131106
.push(
11141107
card::simple(display_policy(

0 commit comments

Comments
 (0)