debug, refact, connection state

Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
dignow
2023-06-23 11:28:51 +08:00
parent 1b38986a82
commit ed53fa37fc
2 changed files with 21 additions and 5 deletions

View File

@@ -438,6 +438,7 @@ pub fn check_mouse_time() {
}
#[inline]
#[cfg(not(any(target_os = "android", target_os = "ios")))]
pub fn get_connect_status() -> UiStatus {
UI_STATUS.lock().unwrap().clone()
}
@@ -884,10 +885,13 @@ pub fn get_hostname() -> String {
#[cfg(not(any(target_os = "android", target_os = "ios")))]
#[tokio::main(flavor = "current_thread")]
async fn check_connect_status_(reconnect: bool, rx: mpsc::UnboundedReceiver<ipc::Data>) {
#[cfg(not(feature = "flutter"))]
let mut key_confirmed = false;
let mut rx = rx;
let mut mouse_time = 0;
#[cfg(not(feature = "flutter"))]
let mut id = "".to_owned();
#[cfg(target_os="windows")]
let mut enable_file_transfer = "".to_owned();
loop {
@@ -924,7 +928,10 @@ async fn check_connect_status_(reconnect: bool, rx: mpsc::UnboundedReceiver<ipc:
}
Ok(Some(ipc::Data::Config((name, Some(value))))) => {
if name == "id" {
id = value;
#[cfg(not(feature = "flutter"))]
{
id = value;
}
} else if name == "temporary-password" {
*TEMPORARY_PASSWD.lock().unwrap() = value;
}
@@ -933,6 +940,10 @@ async fn check_connect_status_(reconnect: bool, rx: mpsc::UnboundedReceiver<ipc:
if x > 0 {
x = 1
}
#[cfg(not(feature = "flutter"))]
{
key_confirmed = _c;
}
*UI_STATUS.lock().unwrap() = UiStatus {
status_num: x as _,
#[cfg(not(feature = "flutter"))]