mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
add sigchat busy status text
This commit is contained in:
parent
e5bb114c71
commit
2be426131c
2 changed files with 19 additions and 1 deletions
|
|
@ -74,6 +74,10 @@
|
||||||
"en": "Signal online",
|
"en": "Signal online",
|
||||||
"en-tts": "Signal online"
|
"en-tts": "Signal online"
|
||||||
},
|
},
|
||||||
|
"sigchat.status.probing": {
|
||||||
|
"en": "probing host for trusted tls",
|
||||||
|
"en-tts": "probing host for trusted tls"
|
||||||
|
},
|
||||||
"sigchat.wifi.connected": {
|
"sigchat.wifi.connected": {
|
||||||
"en": "WiFi connected",
|
"en": "WiFi connected",
|
||||||
"en-tts": "WiFi connected",
|
"en-tts": "WiFi connected",
|
||||||
|
|
|
||||||
|
|
@ -172,16 +172,24 @@ impl<'a> SigChat<'a> {
|
||||||
/// true if at least 1 Certificate Authority is trusted
|
/// true if at least 1 Certificate Authority is trusted
|
||||||
///
|
///
|
||||||
fn probe_host(&self, host: &str) -> bool {
|
fn probe_host(&self, host: &str) -> bool {
|
||||||
|
self.chat
|
||||||
|
.set_status_text(t!("sigchat.status.probing", locales::LANG));
|
||||||
|
self.chat.set_busy_state(true);
|
||||||
let tls = Tls::new();
|
let tls = Tls::new();
|
||||||
match tls.probe(host) {
|
match tls.probe(host) {
|
||||||
Ok(0) => {
|
Ok(0) => {
|
||||||
self.modals
|
self.modals
|
||||||
.show_notification(t!("sigchat.account.abort", locales::LANG), None)
|
.show_notification(t!("sigchat.account.abort", locales::LANG), None)
|
||||||
.expect("abort failed");
|
.expect("abort failed");
|
||||||
|
self.chat.set_busy_state(false);
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
Ok(_count) => true,
|
Ok(_count) => {
|
||||||
|
self.chat.set_busy_state(false);
|
||||||
|
true
|
||||||
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
self.chat.set_busy_state(false);
|
||||||
self.modals
|
self.modals
|
||||||
.show_notification(&format!("{}", e), None)
|
.show_notification(&format!("{}", e), None)
|
||||||
.expect("qrcode failed");
|
.expect("qrcode failed");
|
||||||
|
|
@ -213,18 +221,24 @@ impl<'a> SigChat<'a> {
|
||||||
DEFAULT_DEVICE_NAME,
|
DEFAULT_DEVICE_NAME,
|
||||||
t!("sigchat.account.link.name", locales::LANG),
|
t!("sigchat.account.link.name", locales::LANG),
|
||||||
);
|
);
|
||||||
|
self.chat
|
||||||
|
.set_status_text(t!("sigchat.status.connecting", locales::LANG));
|
||||||
|
self.chat.set_busy_state(true);
|
||||||
match manager.link(Some(&name), Some(&host)) {
|
match manager.link(Some(&name), Some(&host)) {
|
||||||
Ok(true) => {
|
Ok(true) => {
|
||||||
log::info!("Linked Signal Account");
|
log::info!("Linked Signal Account");
|
||||||
|
self.chat.set_busy_state(false);
|
||||||
}
|
}
|
||||||
Ok(false) => {
|
Ok(false) => {
|
||||||
log::info!("failed to link Signal Account");
|
log::info!("failed to link Signal Account");
|
||||||
|
self.chat.set_busy_state(false);
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
log::warn!("error while linking Signal Account: {e}");
|
log::warn!("error while linking Signal Account: {e}");
|
||||||
Account::delete(SIGCHAT_ACCOUNT).unwrap_or_else(|e| {
|
Account::delete(SIGCHAT_ACCOUNT).unwrap_or_else(|e| {
|
||||||
log::warn!("failed to delete unregistered account from pddb: {e}")
|
log::warn!("failed to delete unregistered account from pddb: {e}")
|
||||||
});
|
});
|
||||||
|
self.chat.set_busy_state(false);
|
||||||
self.modals
|
self.modals
|
||||||
.show_notification(&format!("{}", e), None)
|
.show_notification(&format!("{}", e), None)
|
||||||
.expect("notification failed");
|
.expect("notification failed");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue