Skip to content

Commit 257f5e5

Browse files
committed
iced v0.13
1 parent 3c8e412 commit 257f5e5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+2621
-2714
lines changed

Cargo.lock

+379-412
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

-5
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,3 @@ members = [
88
"liana-ui",
99
]
1010
default-members = ["liana", "lianad", "liana-gui", "liana-ui"]
11-
12-
[patch.crates-io]
13-
iced_style = { git = "https://github.com/edouardparis/iced", branch = "patch-0.12.3"}
14-
iced_winit = { git = "https://github.com/edouardparis/iced", branch = "patch-0.12.3"}
15-
iced_futures = { git = "https://github.com/edouardparis/iced", branch = "patch-0.12.3"}

liana-gui/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ async-trait = "0.1"
1818
async-hwi = { version = "0.0.26" }
1919
liana = { path = "../liana" }
2020
lianad = { path = "../lianad", default-features = false, features = ["nonblocking_shutdown"] }
21-
liana-ui = { path = "../liana-ui" }
21+
liana-ui = { path = "../liana-ui"}
2222
backtrace = "0.3"
2323
hex = "0.4.3"
2424

25-
iced = { version = "0.12.1", default-features = false, features = ["tokio", "svg", "qr_code", "image", "lazy", "wgpu", "advanced"] }
26-
iced_runtime = "0.12.1"
25+
iced = { version = "0.13.1", default-features = false, features = ["tokio", "svg", "qr_code", "image", "lazy", "wgpu", "advanced"] }
26+
iced_runtime = "0.13.1"
2727

2828
# Used to verify RFC-compliance of an email
2929
email_address = "0.2.7"

liana-gui/src/app/mod.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use std::path::PathBuf;
1515
use std::sync::Arc;
1616
use std::time::Duration;
1717

18-
use iced::{clipboard, time, Command, Subscription};
18+
use iced::{clipboard, time, Subscription, Task};
1919
use tokio::runtime::Handle;
2020
use tracing::{error, info, warn};
2121

@@ -148,7 +148,7 @@ impl App {
148148
daemon: Arc<dyn Daemon + Sync + Send>,
149149
data_dir: PathBuf,
150150
internal_bitcoind: Option<Bitcoind>,
151-
) -> (App, Command<Message>) {
151+
) -> (App, Task<Message>) {
152152
let mut panels = Panels::new(
153153
&cache,
154154
wallet.clone(),
@@ -170,7 +170,7 @@ impl App {
170170
)
171171
}
172172

173-
fn set_current_panel(&mut self, menu: Menu) -> Command<Message> {
173+
fn set_current_panel(&mut self, menu: Menu) -> Task<Message> {
174174
self.panels.current_mut().interrupt();
175175

176176
match &menu {
@@ -183,7 +183,7 @@ impl App {
183183
}) {
184184
self.panels.transactions.preselect(tx);
185185
self.panels.current = menu;
186-
return Command::none();
186+
return Task::none();
187187
};
188188
}
189189
menu::Menu::PsbtPreSelected(txid) => {
@@ -198,7 +198,7 @@ impl App {
198198
}) {
199199
self.panels.psbts.preselect(spend_tx);
200200
self.panels.current = menu;
201-
return Command::none();
201+
return Task::none();
202202
};
203203
}
204204
menu::Menu::RefreshCoins(preselected) => {
@@ -279,14 +279,14 @@ impl App {
279279
}
280280
}
281281

282-
pub fn update(&mut self, message: Message) -> Command<Message> {
282+
pub fn update(&mut self, message: Message) -> Task<Message> {
283283
match message {
284284
Message::Tick => {
285285
let daemon = self.daemon.clone();
286286
let datadir_path = self.cache.datadir_path.clone();
287287
let network = self.cache.network;
288288
let last_poll_at_startup = self.cache.last_poll_at_startup;
289-
Command::perform(
289+
Task::perform(
290290
async move {
291291
// we check every 10 second if the daemon poller is alive
292292
// or if the access token is not expired.
@@ -331,11 +331,11 @@ impl App {
331331
)
332332
})
333333
.collect();
334-
return Command::batch(commands);
334+
return Task::batch(commands);
335335
}
336336
Err(e) => tracing::error!("Failed to update cache: {}", e),
337337
}
338-
Command::none()
338+
Task::none()
339339
}
340340
Message::LoadDaemonConfig(cfg) => {
341341
let path = self.config.daemon_config_path.clone().expect(

liana-gui/src/app/state/coins.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::collections::HashMap;
22
use std::sync::Arc;
33
use std::{cmp::Ordering, collections::HashSet};
44

5-
use iced::Command;
5+
use iced::Task;
66

77
use liana_ui::widget::Element;
88
use lianad::commands::CoinStatus;
@@ -113,7 +113,7 @@ impl State for CoinsPanel {
113113
daemon: Arc<dyn Daemon + Sync + Send>,
114114
_cache: &Cache,
115115
message: Message,
116-
) -> Command<Message> {
116+
) -> Task<Message> {
117117
match message {
118118
Message::Coins(res) => match res {
119119
Err(e) => self.warning = Some(e),
@@ -150,18 +150,18 @@ impl State for CoinsPanel {
150150
}
151151
_ => {}
152152
};
153-
Command::none()
153+
Task::none()
154154
}
155155

156156
fn reload(
157157
&mut self,
158158
daemon: Arc<dyn Daemon + Sync + Send>,
159159
_wallet: Arc<Wallet>,
160-
) -> Command<Message> {
160+
) -> Task<Message> {
161161
let daemon1 = daemon.clone();
162162
let daemon2 = daemon.clone();
163-
Command::batch(vec![
164-
Command::perform(
163+
Task::batch(vec![
164+
Task::perform(
165165
async move {
166166
daemon1
167167
.list_coins(&[CoinStatus::Unconfirmed, CoinStatus::Confirmed], &[])
@@ -171,7 +171,7 @@ impl State for CoinsPanel {
171171
},
172172
Message::Coins,
173173
),
174-
Command::perform(
174+
Task::perform(
175175
async move {
176176
let coins = daemon2
177177
.list_coins(&[CoinStatus::Unconfirmed, CoinStatus::Confirmed], &[])

liana-gui/src/app/state/export.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::{
33
sync::{Arc, Mutex},
44
};
55

6-
use iced::{Command, Subscription};
6+
use iced::{Subscription, Task};
77
use liana_ui::{component::modal::Modal, widget::Element};
88
use tokio::task::JoinHandle;
99

@@ -37,13 +37,13 @@ impl ExportModal {
3737
}
3838
}
3939

40-
pub fn launch(&self) -> Command<Message> {
41-
Command::perform(get_path(), |m| {
40+
pub fn launch(&self) -> Task<Message> {
41+
Task::perform(get_path(), |m| {
4242
Message::View(view::Message::Export(ExportMessage::Path(m)))
4343
})
4444
}
4545

46-
pub fn update(&mut self, message: Message) -> Command<Message> {
46+
pub fn update(&mut self, message: Message) -> Task<Message> {
4747
if let Message::View(view::Message::Export(m)) = message {
4848
match m {
4949
ExportMessage::ExportProgress(m) => match m {
@@ -73,16 +73,16 @@ impl ExportModal {
7373
self.path = Some(path);
7474
self.start();
7575
} else {
76-
return Command::perform(async {}, |_| {
76+
return Task::perform(async {}, |_| {
7777
Message::View(view::Message::Export(ExportMessage::Close))
7878
});
7979
}
8080
}
8181
ExportMessage::Close | ExportMessage::Open => { /* unreachable */ }
8282
}
83-
Command::none()
83+
Task::none()
8484
} else {
85-
Command::none()
85+
Task::none()
8686
}
8787
}
8888
pub fn view<'a>(&'a self, content: Element<'a, view::Message>) -> Element<view::Message> {

liana-gui/src/app/state/label.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::{
99
Daemon,
1010
},
1111
};
12-
use iced::Command;
12+
use iced::Task;
1313
use liana_ui::component::form;
1414

1515
#[derive(Default)]
@@ -24,7 +24,7 @@ impl LabelsEdited {
2424
daemon: Arc<dyn Daemon + Sync + Send>,
2525
message: Message,
2626
targets: T,
27-
) -> Result<Command<Message>, Error> {
27+
) -> Result<Task<Message>, Error> {
2828
match message {
2929
Message::View(view::Message::Label(items, msg)) => match msg {
3030
view::LabelMessage::Edited(value) => {
@@ -64,7 +64,7 @@ impl LabelsEdited {
6464
}
6565
}
6666
}
67-
return Ok(Command::perform(
67+
return Ok(Task::perform(
6868
async move {
6969
daemon.update_labels(&updated_labels).await?;
7070
Ok(updated_labels_str)
@@ -88,7 +88,7 @@ impl LabelsEdited {
8888
},
8989
_ => {}
9090
};
91-
Ok(Command::none())
91+
Ok(Task::none())
9292
}
9393
}
9494

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

+16-16
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use std::convert::TryInto;
1313
use std::sync::Arc;
1414
use std::time::{SystemTime, UNIX_EPOCH};
1515

16-
use iced::{Command, Subscription};
16+
use iced::{Subscription, Task};
1717
use liana::miniscript::bitcoin::{Amount, OutPoint};
1818
use liana_ui::widget::*;
1919
use lianad::commands::CoinStatus;
@@ -50,8 +50,8 @@ pub trait State {
5050
_daemon: Arc<dyn Daemon + Sync + Send>,
5151
_cache: &Cache,
5252
_message: Message,
53-
) -> Command<Message> {
54-
Command::none()
53+
) -> Task<Message> {
54+
Task::none()
5555
}
5656
fn subscription(&self) -> Subscription<Message> {
5757
Subscription::none()
@@ -61,14 +61,14 @@ pub trait State {
6161
&mut self,
6262
_daemon: Arc<dyn Daemon + Sync + Send>,
6363
_wallet: Arc<Wallet>,
64-
) -> Command<Message> {
65-
Command::none()
64+
) -> Task<Message> {
65+
Task::none()
6666
}
6767
}
6868

6969
/// redirect to another state with a message menu
70-
pub fn redirect(menu: Menu) -> Command<Message> {
71-
Command::perform(async { menu }, |menu| {
70+
pub fn redirect(menu: Menu) -> Task<Message> {
71+
Task::perform(async { menu }, |menu| {
7272
Message::View(view::Message::Menu(menu))
7373
})
7474
}
@@ -201,7 +201,7 @@ impl State for Home {
201201
daemon: Arc<dyn Daemon + Sync + Send>,
202202
cache: &Cache,
203203
message: Message,
204-
) -> Command<Message> {
204+
) -> Task<Message> {
205205
match message {
206206
Message::Coins(res) => match res {
207207
Err(e) => self.warning = Some(e),
@@ -277,7 +277,7 @@ impl State for Home {
277277
}
278278
},
279279
Message::View(view::Message::SelectPayment(outpoint)) => {
280-
return Command::perform(
280+
return Task::perform(
281281
async move {
282282
let tx = daemon.get_history_txs(&[outpoint.txid]).await?.remove(0);
283283
Ok((tx, outpoint.vout as usize))
@@ -318,7 +318,7 @@ impl State for Home {
318318
let daemon = daemon.clone();
319319
let last_event_date = last.time.unwrap();
320320
self.processing = true;
321-
return Command::perform(
321+
return Task::perform(
322322
async move {
323323
let last_event_date = last_event_date.timestamp() as u32;
324324
let mut limit = HISTORY_EVENT_PAGE_SIZE;
@@ -359,20 +359,20 @@ impl State for Home {
359359
}
360360
_ => {}
361361
};
362-
Command::none()
362+
Task::none()
363363
}
364364

365365
fn reload(
366366
&mut self,
367367
daemon: Arc<dyn Daemon + Sync + Send>,
368368
wallet: Arc<Wallet>,
369-
) -> Command<Message> {
369+
) -> Task<Message> {
370370
// If the wallet is syncing, we expect it to finish soon and so better to wait for
371371
// updated data before reloading. Besides, if the wallet is syncing, the DB may be
372372
// locked if the poller is running and we wouldn't be able to reload data until
373373
// syncing completes anyway.
374374
if self.sync_status.wallet_is_syncing() {
375-
return Command::none();
375+
return Task::none();
376376
}
377377
self.selected_event = None;
378378
self.wallet = wallet;
@@ -383,8 +383,8 @@ impl State for Home {
383383
.as_secs()
384384
.try_into()
385385
.unwrap();
386-
Command::batch(vec![
387-
Command::perform(
386+
Task::batch(vec![
387+
Task::perform(
388388
async move {
389389
let mut payments = daemon
390390
.list_confirmed_payments(0, now, HISTORY_EVENT_PAGE_SIZE)
@@ -397,7 +397,7 @@ impl State for Home {
397397
},
398398
Message::Payments,
399399
),
400-
Command::perform(
400+
Task::perform(
401401
async move {
402402
daemon2
403403
.list_coins(&[CoinStatus::Unconfirmed, CoinStatus::Confirmed], &[])

0 commit comments

Comments
 (0)