Show relay hint regardless of whether data is received or not
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
@@ -1801,7 +1801,11 @@ impl LoginConfigHandler {
|
||||
crate::flutter::push_global_event(crate::flutter::APP_TYPE_MAIN, evt);
|
||||
}
|
||||
if config.keyboard_mode.is_empty() {
|
||||
if is_keyboard_mode_supported(&KeyboardMode::Map, get_version_number(&pi.version), &pi.platform) {
|
||||
if is_keyboard_mode_supported(
|
||||
&KeyboardMode::Map,
|
||||
get_version_number(&pi.version),
|
||||
&pi.platform,
|
||||
) {
|
||||
config.keyboard_mode = KeyboardMode::Map.to_string();
|
||||
} else {
|
||||
config.keyboard_mode = KeyboardMode::Legacy.to_string();
|
||||
@@ -2670,21 +2674,25 @@ pub trait Interface: Send + Clone + 'static + Sized {
|
||||
let lc = self.get_lch();
|
||||
let direct = lc.read().unwrap().direct;
|
||||
let received = lc.read().unwrap().received;
|
||||
let relay_condition = direct == Some(true) && !received;
|
||||
|
||||
let mut relay_hint = false;
|
||||
let mut relay_hint_type = "relay-hint";
|
||||
// force relay
|
||||
let errno = errno::errno().0;
|
||||
log::error!("Connection closed: {err}({errno})");
|
||||
if relay_condition
|
||||
&& (cfg!(windows) && (errno == 10054 || err.contains("10054"))
|
||||
|| !cfg!(windows) && (errno == 104 || err.contains("104")))
|
||||
if direct == Some(true)
|
||||
&& ((cfg!(windows) && (errno == 10054 || err.contains("10054")))
|
||||
|| (!cfg!(windows) && (errno == 104 || err.contains("104"))))
|
||||
{
|
||||
lc.write().unwrap().force_relay = true;
|
||||
relay_hint = true;
|
||||
if !received {
|
||||
relay_hint_type = "relay-hint2"
|
||||
}
|
||||
}
|
||||
|
||||
// relay-hint
|
||||
if cfg!(feature = "flutter") && relay_condition {
|
||||
self.msgbox("relay-hint", title, &text, "");
|
||||
if cfg!(feature = "flutter") && relay_hint {
|
||||
self.msgbox(relay_hint_type, title, &text, "");
|
||||
} else {
|
||||
self.msgbox("error", title, &text, "");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user