Merge pull request #5659 from 21pages/fix
install service period protection
This commit is contained in:
commit
2c2c828b47
@ -101,6 +101,7 @@ class ColorThemeExtension extends ThemeExtension<ColorThemeExtension> {
|
|||||||
required this.highlight,
|
required this.highlight,
|
||||||
required this.drag_indicator,
|
required this.drag_indicator,
|
||||||
required this.shadow,
|
required this.shadow,
|
||||||
|
required this.errorBannerBg,
|
||||||
});
|
});
|
||||||
|
|
||||||
final Color? border;
|
final Color? border;
|
||||||
@ -108,6 +109,7 @@ class ColorThemeExtension extends ThemeExtension<ColorThemeExtension> {
|
|||||||
final Color? highlight;
|
final Color? highlight;
|
||||||
final Color? drag_indicator;
|
final Color? drag_indicator;
|
||||||
final Color? shadow;
|
final Color? shadow;
|
||||||
|
final Color? errorBannerBg;
|
||||||
|
|
||||||
static final light = ColorThemeExtension(
|
static final light = ColorThemeExtension(
|
||||||
border: Color(0xFFCCCCCC),
|
border: Color(0xFFCCCCCC),
|
||||||
@ -115,6 +117,7 @@ class ColorThemeExtension extends ThemeExtension<ColorThemeExtension> {
|
|||||||
highlight: Color(0xFFE5E5E5),
|
highlight: Color(0xFFE5E5E5),
|
||||||
drag_indicator: Colors.grey[800],
|
drag_indicator: Colors.grey[800],
|
||||||
shadow: Colors.black,
|
shadow: Colors.black,
|
||||||
|
errorBannerBg: Color(0xFFFDEEEB),
|
||||||
);
|
);
|
||||||
|
|
||||||
static final dark = ColorThemeExtension(
|
static final dark = ColorThemeExtension(
|
||||||
@ -123,6 +126,7 @@ class ColorThemeExtension extends ThemeExtension<ColorThemeExtension> {
|
|||||||
highlight: Color(0xFF3F3F3F),
|
highlight: Color(0xFF3F3F3F),
|
||||||
drag_indicator: Colors.grey,
|
drag_indicator: Colors.grey,
|
||||||
shadow: Colors.grey,
|
shadow: Colors.grey,
|
||||||
|
errorBannerBg: Color(0xFF470F2D),
|
||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -132,6 +136,7 @@ class ColorThemeExtension extends ThemeExtension<ColorThemeExtension> {
|
|||||||
Color? highlight,
|
Color? highlight,
|
||||||
Color? drag_indicator,
|
Color? drag_indicator,
|
||||||
Color? shadow,
|
Color? shadow,
|
||||||
|
Color? errorBannerBg,
|
||||||
}) {
|
}) {
|
||||||
return ColorThemeExtension(
|
return ColorThemeExtension(
|
||||||
border: border ?? this.border,
|
border: border ?? this.border,
|
||||||
@ -139,6 +144,7 @@ class ColorThemeExtension extends ThemeExtension<ColorThemeExtension> {
|
|||||||
highlight: highlight ?? this.highlight,
|
highlight: highlight ?? this.highlight,
|
||||||
drag_indicator: drag_indicator ?? this.drag_indicator,
|
drag_indicator: drag_indicator ?? this.drag_indicator,
|
||||||
shadow: shadow ?? this.shadow,
|
shadow: shadow ?? this.shadow,
|
||||||
|
errorBannerBg: errorBannerBg ?? this.errorBannerBg,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,6 +160,7 @@ class ColorThemeExtension extends ThemeExtension<ColorThemeExtension> {
|
|||||||
highlight: Color.lerp(highlight, other.highlight, t),
|
highlight: Color.lerp(highlight, other.highlight, t),
|
||||||
drag_indicator: Color.lerp(drag_indicator, other.drag_indicator, t),
|
drag_indicator: Color.lerp(drag_indicator, other.drag_indicator, t),
|
||||||
shadow: Color.lerp(shadow, other.shadow, t),
|
shadow: Color.lerp(shadow, other.shadow, t),
|
||||||
|
errorBannerBg: Color.lerp(shadow, other.errorBannerBg, t),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ class _AddressBookState extends State<AddressBook> {
|
|||||||
child: Center(
|
child: Center(
|
||||||
child: Container(
|
child: Container(
|
||||||
height: height,
|
height: height,
|
||||||
color: Color.fromARGB(255, 253, 238, 235),
|
color: MyTheme.color(context).errorBannerBg,
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
@ -1537,9 +1537,14 @@ Widget _OptionCheckBox(BuildContext context, String label, String key,
|
|||||||
isServer
|
isServer
|
||||||
? await mainSetBoolOption(key, option)
|
? await mainSetBoolOption(key, option)
|
||||||
: await mainSetLocalBoolOption(key, option);
|
: await mainSetLocalBoolOption(key, option);
|
||||||
ref.value = isServer
|
final readOption = isServer
|
||||||
? mainGetBoolOptionSync(key)
|
? mainGetBoolOptionSync(key)
|
||||||
: mainGetLocalBoolOptionSync(key);
|
: mainGetLocalBoolOptionSync(key);
|
||||||
|
if (reverse) {
|
||||||
|
ref.value = !readOption;
|
||||||
|
} else {
|
||||||
|
ref.value = readOption;
|
||||||
|
}
|
||||||
update?.call();
|
update?.call();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1183,6 +1183,7 @@ pub fn uninstall_service(show_new_window: bool) -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn install_service() -> bool {
|
pub fn install_service() -> bool {
|
||||||
|
let _installing = crate::platform::InstallingService::new();
|
||||||
if !has_cmd("systemctl") {
|
if !has_cmd("systemctl") {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -23,9 +23,18 @@ pub mod linux_desktop_manager;
|
|||||||
|
|
||||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||||
use hbb_common::{message_proto::CursorData, ResultType};
|
use hbb_common::{message_proto::CursorData, ResultType};
|
||||||
|
use std::sync::{Arc, Mutex};
|
||||||
#[cfg(not(any(target_os = "macos", target_os = "android", target_os = "ios")))]
|
#[cfg(not(any(target_os = "macos", target_os = "android", target_os = "ios")))]
|
||||||
const SERVICE_INTERVAL: u64 = 300;
|
const SERVICE_INTERVAL: u64 = 300;
|
||||||
|
|
||||||
|
lazy_static::lazy_static! {
|
||||||
|
static ref INSTALLING_SERVICE: Arc<Mutex<bool>>= Default::default();
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn installing_service() -> bool {
|
||||||
|
INSTALLING_SERVICE.lock().unwrap().clone()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn is_xfce() -> bool {
|
pub fn is_xfce() -> bool {
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
{
|
{
|
||||||
@ -71,6 +80,21 @@ pub fn get_active_username() -> String {
|
|||||||
#[cfg(target_os = "android")]
|
#[cfg(target_os = "android")]
|
||||||
pub const PA_SAMPLE_RATE: u32 = 48000;
|
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)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
@ -2167,6 +2167,7 @@ pub fn uninstall_service(show_new_window: bool) -> bool {
|
|||||||
|
|
||||||
pub fn install_service() -> bool {
|
pub fn install_service() -> bool {
|
||||||
log::info!("Installing service...");
|
log::info!("Installing service...");
|
||||||
|
let _installing = crate::platform::InstallingService::new();
|
||||||
let (_, _, _, exe) = get_install_info();
|
let (_, _, _, exe) = get_install_info();
|
||||||
let tmp_path = std::env::temp_dir().to_string_lossy().to_string();
|
let tmp_path = std::env::temp_dir().to_string_lossy().to_string();
|
||||||
let tray_shortcut = get_tray_shortcut(&exe, &tmp_path).unwrap_or_default();
|
let tray_shortcut = get_tray_shortcut(&exe, &tmp_path).unwrap_or_default();
|
||||||
|
@ -79,7 +79,9 @@ impl RendezvousMediator {
|
|||||||
crate::platform::linux_desktop_manager::start_xdesktop();
|
crate::platform::linux_desktop_manager::start_xdesktop();
|
||||||
loop {
|
loop {
|
||||||
Config::reset_online();
|
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 {
|
if !nat_tested {
|
||||||
crate::test_nat_type();
|
crate::test_nat_type();
|
||||||
nat_tested = true;
|
nat_tested = true;
|
||||||
|
@ -2284,7 +2284,7 @@ impl Connection {
|
|||||||
lock_screen().await;
|
lock_screen().await;
|
||||||
}
|
}
|
||||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
#[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
|
ipc::Data::Disconnected
|
||||||
} else {
|
} else {
|
||||||
ipc::Data::Close
|
ipc::Data::Close
|
||||||
|
Loading…
x
Reference in New Issue
Block a user