From a5dcac137f18b0ef34ddf115f11c5aea9406b211 Mon Sep 17 00:00:00 2001 From: 21pages Date: Mon, 11 Sep 2023 11:18:26 +0800 Subject: [PATCH 1/4] fix dark theme error banner background color Signed-off-by: 21pages --- flutter/lib/common.dart | 7 +++++++ flutter/lib/common/widgets/address_book.dart | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/flutter/lib/common.dart b/flutter/lib/common.dart index 33321c81a..fbbe6e254 100644 --- a/flutter/lib/common.dart +++ b/flutter/lib/common.dart @@ -101,6 +101,7 @@ class ColorThemeExtension extends ThemeExtension { required this.highlight, required this.drag_indicator, required this.shadow, + required this.errorBannerBg, }); final Color? border; @@ -108,6 +109,7 @@ class ColorThemeExtension extends ThemeExtension { final Color? highlight; final Color? drag_indicator; final Color? shadow; + final Color? errorBannerBg; static final light = ColorThemeExtension( border: Color(0xFFCCCCCC), @@ -115,6 +117,7 @@ class ColorThemeExtension extends ThemeExtension { highlight: Color(0xFFE5E5E5), drag_indicator: Colors.grey[800], shadow: Colors.black, + errorBannerBg: Color(0xFFFDEEEB), ); static final dark = ColorThemeExtension( @@ -123,6 +126,7 @@ class ColorThemeExtension extends ThemeExtension { highlight: Color(0xFF3F3F3F), drag_indicator: Colors.grey, shadow: Colors.grey, + errorBannerBg: Color(0xFF470F2D), ); @override @@ -132,6 +136,7 @@ class ColorThemeExtension extends ThemeExtension { Color? highlight, Color? drag_indicator, Color? shadow, + Color? errorBannerBg, }) { return ColorThemeExtension( border: border ?? this.border, @@ -139,6 +144,7 @@ class ColorThemeExtension extends ThemeExtension { highlight: highlight ?? this.highlight, drag_indicator: drag_indicator ?? this.drag_indicator, shadow: shadow ?? this.shadow, + errorBannerBg: errorBannerBg ?? this.errorBannerBg, ); } @@ -154,6 +160,7 @@ class ColorThemeExtension extends ThemeExtension { highlight: Color.lerp(highlight, other.highlight, t), drag_indicator: Color.lerp(drag_indicator, other.drag_indicator, t), shadow: Color.lerp(shadow, other.shadow, t), + errorBannerBg: Color.lerp(shadow, other.errorBannerBg, t), ); } } diff --git a/flutter/lib/common/widgets/address_book.dart b/flutter/lib/common/widgets/address_book.dart index 4af74e319..070c44126 100644 --- a/flutter/lib/common/widgets/address_book.dart +++ b/flutter/lib/common/widgets/address_book.dart @@ -76,7 +76,7 @@ class _AddressBookState extends State { child: Center( child: Container( height: height, - color: Color.fromARGB(255, 253, 238, 235), + color: MyTheme.color(context).errorBannerBg, child: Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, From e98aa8179486bc303f744159b1fa31137ffb4c58 Mon Sep 17 00:00:00 2001 From: 21pages Date: Mon, 11 Sep 2023 11:21:42 +0800 Subject: [PATCH 2/4] remove sciter keep cm open for file log Signed-off-by: 21pages --- src/server/connection.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/connection.rs b/src/server/connection.rs index c9f07eb78..fbf89e76e 100644 --- a/src/server/connection.rs +++ b/src/server/connection.rs @@ -2278,7 +2278,7 @@ impl Connection { lock_screen().await; } #[cfg(not(any(target_os = "android", target_os = "ios")))] - let data = if self.chat_unanswered || self.file_transferred { + let data = if self.chat_unanswered || self.file_transferred && cfg!(feature = "flutter") { ipc::Data::Disconnected } else { ipc::Data::Close From d0173fbdc58f39bddbf8188e8e1e3d4892f4873e Mon Sep 17 00:00:00 2001 From: 21pages Date: Mon, 11 Sep 2023 16:04:51 +0800 Subject: [PATCH 3/4] install service period protection how to reproduce: install, click stop service, click start service and click no on uac, it'll show "Service is not running" but can be connected. Signed-off-by: 21pages --- src/platform/linux.rs | 3 ++- src/platform/mod.rs | 24 ++++++++++++++++++++++++ src/platform/windows.rs | 1 + src/rendezvous_mediator.rs | 4 +++- 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/platform/linux.rs b/src/platform/linux.rs index 944e24c15..fb48a9307 100644 --- a/src/platform/linux.rs +++ b/src/platform/linux.rs @@ -1074,7 +1074,7 @@ mod desktop { pub fn refresh(&mut self) { if !self.sid.is_empty() && is_active_and_seat0(&self.sid) { - return; + return; } let seat0_values = get_values_of_seat0(&[0, 1, 2]); @@ -1183,6 +1183,7 @@ pub fn uninstall_service(show_new_window: bool) -> bool { } pub fn install_service() -> bool { + let _installing = crate::platform::InstallingService::new(); if !has_cmd("systemctl") { return false; } diff --git a/src/platform/mod.rs b/src/platform/mod.rs index e962ef9d5..6a428d9c3 100644 --- a/src/platform/mod.rs +++ b/src/platform/mod.rs @@ -23,9 +23,18 @@ pub mod linux_desktop_manager; #[cfg(not(any(target_os = "android", target_os = "ios")))] use hbb_common::{message_proto::CursorData, ResultType}; +use std::sync::{Arc, Mutex}; #[cfg(not(any(target_os = "macos", target_os = "android", target_os = "ios")))] const SERVICE_INTERVAL: u64 = 300; +lazy_static::lazy_static! { + static ref INSTALLING_SERVICE: Arc>= Default::default(); +} + +pub fn installing_service() -> bool { + INSTALLING_SERVICE.lock().unwrap().clone() +} + pub fn is_xfce() -> bool { #[cfg(target_os = "linux")] { @@ -71,6 +80,21 @@ pub fn get_active_username() -> String { #[cfg(target_os = "android")] pub const PA_SAMPLE_RATE: u32 = 48000; +pub(crate) struct InstallingService; // please use new + +impl InstallingService { + pub fn new() -> Self { + *INSTALLING_SERVICE.lock().unwrap() = true; + Self + } +} + +impl Drop for InstallingService { + fn drop(&mut self) { + *INSTALLING_SERVICE.lock().unwrap() = false; + } +} + #[cfg(test)] mod tests { use super::*; diff --git a/src/platform/windows.rs b/src/platform/windows.rs index feadffb2c..41ac9e5ea 100644 --- a/src/platform/windows.rs +++ b/src/platform/windows.rs @@ -2167,6 +2167,7 @@ pub fn uninstall_service(show_new_window: bool) -> bool { pub fn install_service() -> bool { log::info!("Installing service..."); + let _installing = crate::platform::InstallingService::new(); let (_, _, _, exe) = get_install_info(); let tmp_path = std::env::temp_dir().to_string_lossy().to_string(); let tray_shortcut = get_tray_shortcut(&exe, &tmp_path).unwrap_or_default(); diff --git a/src/rendezvous_mediator.rs b/src/rendezvous_mediator.rs index 924c0c709..20219cc89 100644 --- a/src/rendezvous_mediator.rs +++ b/src/rendezvous_mediator.rs @@ -79,7 +79,9 @@ impl RendezvousMediator { crate::platform::linux_desktop_manager::start_xdesktop(); loop { Config::reset_online(); - if Config::get_option("stop-service").is_empty() { + if Config::get_option("stop-service").is_empty() + && !crate::platform::installing_service() + { if !nat_tested { crate::test_nat_type(); nat_tested = true; From 4d0b660c73ddca3e82c089b0e8af5fc1ff5284f3 Mon Sep 17 00:00:00 2001 From: 21pages Date: Mon, 11 Sep 2023 16:42:01 +0800 Subject: [PATCH 4/4] fix lan option reaction Signed-off-by: 21pages --- flutter/lib/desktop/pages/desktop_setting_page.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/flutter/lib/desktop/pages/desktop_setting_page.dart b/flutter/lib/desktop/pages/desktop_setting_page.dart index 468886cb8..2da6ab1e7 100644 --- a/flutter/lib/desktop/pages/desktop_setting_page.dart +++ b/flutter/lib/desktop/pages/desktop_setting_page.dart @@ -1537,9 +1537,14 @@ Widget _OptionCheckBox(BuildContext context, String label, String key, isServer ? await mainSetBoolOption(key, option) : await mainSetLocalBoolOption(key, option); - ref.value = isServer + final readOption = isServer ? mainGetBoolOptionSync(key) : mainGetLocalBoolOptionSync(key); + if (reverse) { + ref.value = !readOption; + } else { + ref.value = readOption; + } update?.call(); } }