Fixed #60. Now domains are shown as they should be. Rewised events a bit.

This commit is contained in:
Revertron
2021-04-27 19:52:05 +02:00
parent a01cbf14db
commit 50b7d26098
+11 -5
View File
@@ -235,6 +235,7 @@ fn action_loaded(context: &Arc<Mutex<Context>>, web_view: &mut WebView<()>) {
if full { if full {
match success { match success {
true => { true => {
load_domains(&mut context, &handle);
event_handle_luck(&handle, "Mining is successful!"); event_handle_luck(&handle, "Mining is successful!");
s.push_str(" showSuccess('Block successfully mined!')"); s.push_str(" showSuccess('Block successfully mined!')");
} }
@@ -266,10 +267,12 @@ fn action_loaded(context: &Arc<Mutex<Context>>, web_view: &mut WebView<()>) {
} }
} }
Event::Syncing { have, height } => { Event::Syncing { have, height } => {
event_handle_info(&handle, "Syncing started...");
status.syncing = true; status.syncing = true;
status.synced_blocks = have; status.synced_blocks = have;
status.sync_height = height; if height != status.sync_height {
event_handle_info(&handle, "Syncing started...");
status.sync_height = height;
}
if status.mining { if status.mining {
String::from("setLeftStatusBarText('Mining...'); showMiningIndicator(true, false);") String::from("setLeftStatusBarText('Mining...'); showMiningIndicator(true, false);")
} else { } else {
@@ -277,6 +280,7 @@ fn action_loaded(context: &Arc<Mutex<Context>>, web_view: &mut WebView<()>) {
} }
} }
Event::SyncFinished => { Event::SyncFinished => {
load_domains(&mut context, &handle);
event_handle_info(&handle, "Syncing finished."); event_handle_info(&handle, "Syncing finished.");
status.syncing = false; status.syncing = false;
if status.mining { if status.mining {
@@ -325,9 +329,11 @@ fn action_loaded(context: &Arc<Mutex<Context>>, web_view: &mut WebView<()>) {
c.bus.post(Event::KeyLoaded { path, public, hash }); c.bus.post(Event::KeyLoaded { path, public, hash });
} }
let index = c.chain.get_height(); let index = c.chain.get_height();
c.bus.post(Event::BlockchainChanged { index }); if index > 0 {
if let Ok(zones) = serde_json::to_string(&c.chain.get_zones()) { c.bus.post(Event::BlockchainChanged { index });
let _ = web_view.eval(&format!("zonesChanged('{}');", &zones)); if let Ok(zones) = serde_json::to_string(&c.chain.get_zones()) {
let _ = web_view.eval(&format!("zonesChanged('{}');", &zones));
}
} }
event_info(web_view, "Application loaded"); event_info(web_view, "Application loaded");
} }