Fixed key generated success message.
This commit is contained in:
+1
-1
@@ -5,7 +5,7 @@ pub enum Event {
|
|||||||
MinerStarted,
|
MinerStarted,
|
||||||
MinerStopped { success: bool, full: bool },
|
MinerStopped { success: bool, full: bool },
|
||||||
KeyGeneratorStarted,
|
KeyGeneratorStarted,
|
||||||
KeyGeneratorStopped { success: bool },
|
KeyGeneratorStopped,
|
||||||
KeyCreated { path: String, public: String, hash: String },
|
KeyCreated { path: String, public: String, hash: String },
|
||||||
KeyLoaded { path: String, public: String, hash: String },
|
KeyLoaded { path: String, public: String, hash: String },
|
||||||
KeySaved { path: String, public: String, hash: String },
|
KeySaved { path: String, public: String, hash: String },
|
||||||
|
|||||||
+1
-3
@@ -168,7 +168,6 @@ pub fn create_key(context: Arc<Mutex<Context>>) {
|
|||||||
let miners_count = miners_count.clone();
|
let miners_count = miners_count.clone();
|
||||||
thread::spawn(move || {
|
thread::spawn(move || {
|
||||||
miners_count.fetch_add(1, atomic::Ordering::SeqCst);
|
miners_count.fetch_add(1, atomic::Ordering::SeqCst);
|
||||||
let mut success = false;
|
|
||||||
match generate_key(KEYSTORE_DIFFICULTY, mining.clone()) {
|
match generate_key(KEYSTORE_DIFFICULTY, mining.clone()) {
|
||||||
None => {
|
None => {
|
||||||
debug!("Keystore mining finished");
|
debug!("Keystore mining finished");
|
||||||
@@ -180,12 +179,11 @@ pub fn create_key(context: Arc<Mutex<Context>>) {
|
|||||||
info!("Key mined successfully: {:?}, hash: {}", &keystore.get_public(), &hash);
|
info!("Key mined successfully: {:?}, hash: {}", &keystore.get_public(), &hash);
|
||||||
context.bus.post(Event::KeyCreated { path: keystore.get_path().to_owned(), public: keystore.get_public().to_string(), hash });
|
context.bus.post(Event::KeyCreated { path: keystore.get_path().to_owned(), public: keystore.get_public().to_string(), hash });
|
||||||
context.set_keystore(Some(keystore));
|
context.set_keystore(Some(keystore));
|
||||||
success = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let miners = miners_count.fetch_sub(1, atomic::Ordering::SeqCst) - 1;
|
let miners = miners_count.fetch_sub(1, atomic::Ordering::SeqCst) - 1;
|
||||||
if miners == 0 {
|
if miners == 0 {
|
||||||
context.lock().unwrap().bus.post(Event::KeyGeneratorStopped { success });
|
context.lock().unwrap().bus.post(Event::KeyGeneratorStopped);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-8
@@ -192,7 +192,9 @@ fn action_loaded(context: &Arc<Mutex<Context>>, web_view: &mut WebView<()>) {
|
|||||||
let eval = match e {
|
let eval = match e {
|
||||||
Event::KeyCreated { path, public, hash } => {
|
Event::KeyCreated { path, public, hash } => {
|
||||||
event_handle_luck(&handle, "Key successfully created! Don\\'t forget to save it!");
|
event_handle_luck(&handle, "Key successfully created! Don\\'t forget to save it!");
|
||||||
format!("keystoreChanged('{}', '{}', '{}');", &path, &public, &hash)
|
let mut s = format!("keystoreChanged('{}', '{}', '{}');", &path, &public, &hash);
|
||||||
|
s.push_str(" showSuccess('You've got a new key! Don't forget to save it!')");
|
||||||
|
s
|
||||||
}
|
}
|
||||||
Event::KeyLoaded { path, public, hash } |
|
Event::KeyLoaded { path, public, hash } |
|
||||||
Event::KeySaved { path, public, hash } => {
|
Event::KeySaved { path, public, hash } => {
|
||||||
@@ -224,18 +226,13 @@ fn action_loaded(context: &Arc<Mutex<Context>>, web_view: &mut WebView<()>) {
|
|||||||
}
|
}
|
||||||
s
|
s
|
||||||
}
|
}
|
||||||
Event::KeyGeneratorStopped {success} => {
|
Event::KeyGeneratorStopped => {
|
||||||
status.mining = false;
|
status.mining = false;
|
||||||
let mut s = if status.syncing {
|
if status.syncing {
|
||||||
String::from("setLeftStatusBarText('Syncing...'); showMiningIndicator(true, true);")
|
String::from("setLeftStatusBarText('Syncing...'); showMiningIndicator(true, true);")
|
||||||
} else {
|
} else {
|
||||||
String::from("setLeftStatusBarText('Idle'); showMiningIndicator(false, false);")
|
String::from("setLeftStatusBarText('Idle'); showMiningIndicator(false, false);")
|
||||||
};
|
|
||||||
match success {
|
|
||||||
true => { s.push_str(" showSuccess('Key pair successfully mined!<br>Don`t forget to save!')"); }
|
|
||||||
false => { s.push_str(" showSuccess('Key mining got nothing, sorry.')"); }
|
|
||||||
}
|
}
|
||||||
s
|
|
||||||
}
|
}
|
||||||
Event::Syncing { have, height } => {
|
Event::Syncing { have, height } => {
|
||||||
event_handle_info(&handle, "Syncing started...");
|
event_handle_info(&handle, "Syncing started...");
|
||||||
|
|||||||
Reference in New Issue
Block a user