Merge #1530: Fix update of rescan state upon completion
130d004e79a1440e3d810ef35082f9671dc1ad81 refactor: do not include cache in message (Michael Mallan) 665c527dd08d027dbf95b22e58d44b1cb29212db fix: set rescan processing to false upon completion (Michael Mallan) 65e002dc528f3951d39e353b87bc531885a943a6 refactor: treat as dyn state to easily add others (Michael Mallan) Pull request description: This is to fix #1528. It updates the `processing` field of the rescan settings each time the cache is updated. ACKs for top commit: edouardparis: ACK 130d004e79a1440e3d810ef35082f9671dc1ad81 Tree-SHA512: 7edd744510edf799ab7f00cceee31e60ce316f3cd0c8377d7693064b4cf0c9ac12520f0c55a3c3305866c3cb98684378640ab2944c0dc76969cac9209ce3bce9
This commit is contained in:
commit
f46efa2a33
@ -19,7 +19,7 @@ use crate::{
|
||||
pub enum Message {
|
||||
Tick,
|
||||
UpdateCache(Result<Cache, Error>),
|
||||
UpdatePanelCache(/* is current panel */ bool, Result<Cache, Error>),
|
||||
UpdatePanelCache(/* is current panel */ bool),
|
||||
View(view::Message),
|
||||
LoadDaemonConfig(Box<DaemonConfig>),
|
||||
DaemonConfigLoaded(Result<(), Error>),
|
||||
|
||||
@ -317,14 +317,17 @@ impl App {
|
||||
let current = &self.panels.current;
|
||||
let daemon = self.daemon.clone();
|
||||
// These are the panels to update with the cache.
|
||||
let mut panels = [(&mut self.panels.home, Menu::Home)];
|
||||
let mut panels = [
|
||||
(&mut self.panels.home as &mut dyn State, Menu::Home),
|
||||
(&mut self.panels.settings as &mut dyn State, Menu::Settings),
|
||||
];
|
||||
let commands: Vec<_> = panels
|
||||
.iter_mut()
|
||||
.map(|(panel, menu)| {
|
||||
panel.update(
|
||||
daemon.clone(),
|
||||
&cache,
|
||||
Message::UpdatePanelCache(current == menu, Ok(cache.clone())),
|
||||
Message::UpdatePanelCache(current == menu),
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
|
||||
@ -254,7 +254,7 @@ impl State for Home {
|
||||
}
|
||||
}
|
||||
},
|
||||
Message::UpdatePanelCache(is_current, Ok(cache)) => {
|
||||
Message::UpdatePanelCache(is_current) => {
|
||||
let wallet_was_syncing = !self.sync_status.is_synced();
|
||||
self.sync_status = sync_status(
|
||||
daemon.backend(),
|
||||
|
||||
@ -136,6 +136,9 @@ impl State for BitcoindSettingsState {
|
||||
self.rescan_settings.past_possible_height = true;
|
||||
self.rescan_settings.processing = false;
|
||||
}
|
||||
Message::UpdatePanelCache(_) => {
|
||||
self.rescan_settings.processing = cache.rescan_progress.is_some_and(|p| p < 1.0);
|
||||
}
|
||||
Message::View(view::Message::Settings(view::SettingsMessage::BitcoindSettings(
|
||||
msg,
|
||||
))) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user