diff --git a/liana-gui/src/installer/step/descriptor/editor/mod.rs b/liana-gui/src/installer/step/descriptor/editor/mod.rs index f9fbce32e..b4dfa94c8 100644 --- a/liana-gui/src/installer/step/descriptor/editor/mod.rs +++ b/liana-gui/src/installer/step/descriptor/editor/mod.rs @@ -651,7 +651,8 @@ impl DescriptorEditModal for EditThresholdModal { #[cfg(test)] mod tests { use super::*; - use iced_runtime::command::Action; + use iced::futures::StreamExt; + use iced_runtime::{task::into_stream, Action}; use std::path::PathBuf; use std::sync::{Arc, Mutex}; @@ -674,10 +675,11 @@ mod tests { pub async fn update(&self, message: Message) { let mut hws = HardwareWallets::new(PathBuf::from_str("/").unwrap(), Network::Bitcoin); let cmd = self.step.lock().unwrap().update(&mut hws, message); - for action in cmd.actions() { - if let Action::Future(f) = action { - let msg = f.await; - let _cmd = self.step.lock().unwrap().update(&mut hws, msg); + if let Some(mut stream) = into_stream(cmd) { + while let Some(action) = stream.next().await { + if let Action::Output(msg) = action { + let _cmd = self.step.lock().unwrap().update(&mut hws, msg); + } } } } diff --git a/liana-gui/src/loader.rs b/liana-gui/src/loader.rs index 005f5bd42..7fe9a0f5c 100644 --- a/liana-gui/src/loader.rs +++ b/liana-gui/src/loader.rs @@ -316,7 +316,7 @@ impl Loader { if self.internal_bitcoind.is_some() { let log_path = internal_bitcoind_debug_log_path(&self.datadir_path, self.network); iced::Subscription::run_with_id("bitcoind_log", get_bitcoind_log(log_path)) - .map(|msg| Message::BitcoindLog(msg)) + .map(Message::BitcoindLog) } else { Subscription::none() } diff --git a/liana-gui/src/utils/sandbox.rs b/liana-gui/src/utils/sandbox.rs index 4fe9c6254..ce3dc0f70 100644 --- a/liana-gui/src/utils/sandbox.rs +++ b/liana-gui/src/utils/sandbox.rs @@ -1,6 +1,7 @@ +use iced::futures::StreamExt; use std::sync::Arc; -use iced_runtime::command::Action; +use iced_runtime::{task::into_stream, Action}; use crate::{ app::{cache::Cache, message::Message, state::State, wallet::Wallet}, @@ -11,7 +12,7 @@ pub struct Sandbox { state: S, } -impl Sandbox { +impl Sandbox { pub fn new(state: S) -> Self { Self { state } } @@ -27,13 +28,13 @@ impl Sandbox { message: Message, ) -> Self { let cmd = self.state.update(daemon.clone(), cache, message); - for action in cmd.actions() { - if let Action::Future(f) = action { - let msg = f.await; - let _cmd = self.state.update(daemon.clone(), cache, msg); + if let Some(mut stream) = into_stream(cmd) { + while let Some(action) = stream.next().await { + if let Action::Output(msg) = action { + let _cmd = self.state.update(daemon.clone(), cache, msg); + } } } - self } @@ -44,10 +45,11 @@ impl Sandbox { wallet: Arc, ) -> Self { let cmd = self.state.reload(daemon.clone(), wallet); - for action in cmd.actions() { - if let Action::Future(f) = action { - let msg = f.await; - self = self.update(daemon.clone(), cache, msg).await; + if let Some(mut stream) = into_stream(cmd) { + while let Some(action) = stream.next().await { + if let Action::Output(msg) = action { + let _cmd = self.state.update(daemon.clone(), cache, msg); + } } }