mirror of
https://github.com/Cyrix126/gupaxx.git
synced 2024-12-22 14:49:21 +00:00
fix: donate amount lost between restarts
This commit is contained in:
parent
2259372482
commit
d1fe73cc95
2 changed files with 8 additions and 2 deletions
|
@ -526,10 +526,10 @@ impl App {
|
|||
|
||||
// Set saved Hero mode to runtime.
|
||||
app.xvb_api.lock().unwrap().stats_priv.runtime_mode = app.state.xvb.mode.clone().into();
|
||||
app.xvb_api.lock().unwrap().stats_priv.runtime_manual_amount = match app.state.xvb.amount.parse() {
|
||||
app.xvb_api.lock().unwrap().stats_priv.runtime_manual_amount = match app.state.xvb.amount.parse::<u64>() {
|
||||
Ok(n) => n,
|
||||
Err(_) => {
|
||||
warn!("Cannot parse [amount] to u64, defaulting to 0");
|
||||
error!("Cannot parse [amount] to u64, defaulting to 0");
|
||||
0
|
||||
}
|
||||
};
|
||||
|
|
|
@ -401,9 +401,12 @@ impl PubXvbApi {
|
|||
output.push_str(&buf);
|
||||
}
|
||||
let runtime_mode = std::mem::take(&mut gui_api.stats_priv.runtime_mode);
|
||||
let runtime_manual_amount = std::mem::take(&mut gui_api.stats_priv.runtime_manual_amount);
|
||||
|
||||
*gui_api = Self {
|
||||
output,
|
||||
stats_priv: XvbPrivStats {
|
||||
runtime_manual_amount,
|
||||
runtime_mode,
|
||||
..pub_api.stats_priv.clone()
|
||||
},
|
||||
|
@ -695,6 +698,8 @@ fn signal_interrupt(
|
|||
fn reset_data_xvb(pub_api: &Arc<Mutex<PubXvbApi>>, gui_api: &Arc<Mutex<PubXvbApi>>) {
|
||||
let current_node = mem::take(&mut lock!(pub_api).current_node.clone());
|
||||
let runtime_mode = mem::take(&mut lock!(gui_api).stats_priv.runtime_mode);
|
||||
let runtime_manual_amount = mem::take(&mut lock!(gui_api).stats_priv.runtime_manual_amount);
|
||||
|
||||
// let output = mem::take(&mut lock!(gui_api).output);
|
||||
*lock!(pub_api) = PubXvbApi::new();
|
||||
*lock!(gui_api) = PubXvbApi::new();
|
||||
|
@ -702,6 +707,7 @@ fn reset_data_xvb(pub_api: &Arc<Mutex<PubXvbApi>>, gui_api: &Arc<Mutex<PubXvbApi
|
|||
lock!(pub_api).current_node = current_node;
|
||||
// to not loose the information of runtime hero mode between restart
|
||||
lock!(gui_api).stats_priv.runtime_mode = runtime_mode;
|
||||
lock!(gui_api).stats_priv.runtime_manual_amount = runtime_manual_amount;
|
||||
// message while starting must be preserved.
|
||||
// lock!(pub_api).output = output;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue