Merge pull request #6310 from 21pages/install_after_connect

fix install after connection
This commit is contained in:
RustDesk 2023-11-07 11:37:52 +08:00 committed by GitHub
commit 05a254c682
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 123 additions and 96 deletions

View File

@ -336,11 +336,17 @@ class _DesktopHomePageState extends State<DesktopHomePage>
}
if (Platform.isWindows) {
if (!bind.mainIsInstalled()) {
return buildInstallCard(
"", "install_tip", "Install", bind.mainGotoInstall);
return buildInstallCard("", "install_tip", "Install", () async {
await rustDeskWinManager.closeAllSubWindows();
bind.mainGotoInstall();
});
} else if (bind.mainIsInstalledLowerVersion()) {
return buildInstallCard("Status", "Your installation is lower version.",
"Click to upgrade", bind.mainUpdateMe);
return buildInstallCard(
"Status", "Your installation is lower version.", "Click to upgrade",
() async {
await rustDeskWinManager.closeAllSubWindows();
bind.mainUpdateMe();
});
}
} else if (Platform.isMacOS) {
if (!bind.mainIsCanScreenRecording(prompt: false)) {
@ -384,7 +390,10 @@ class _DesktopHomePageState extends State<DesktopHomePage>
final keyShowSelinuxHelpTip = "show-selinux-help-tip";
if (bind.mainGetLocalOption(key: keyShowSelinuxHelpTip) != 'N') {
LinuxCards.add(buildInstallCard(
"Warning", "selinux_tip", "", () async {},
"Warning",
"selinux_tip",
"",
() async {},
marginTop: LinuxCards.isEmpty ? 20.0 : 5.0,
help: 'Help',
link:
@ -418,7 +427,11 @@ class _DesktopHomePageState extends State<DesktopHomePage>
Widget buildInstallCard(String title, String content, String btnText,
GestureTapCallback onPressed,
{double marginTop = 20.0, String? help, String? link, bool? closeButton, String? closeOption}) {
{double marginTop = 20.0,
String? help,
String? link,
bool? closeButton,
String? closeOption}) {
void closeCard() async {
if (closeOption != null) {
await bind.mainSetLocalOption(key: closeOption, value: 'N');
@ -502,7 +515,8 @@ class _DesktopHomePageState extends State<DesktopHomePage>
child: Text(
translate(help),
style: TextStyle(
decoration: TextDecoration.underline,
decoration:
TextDecoration.underline,
color: Colors.white,
fontSize: 12),
)).marginOnly(top: 6)),

View File

@ -123,14 +123,21 @@ class CmFileModel {
}
int removeUnreadCount = 0;
if (data.dir) {
bool isChild(String parent, String child) {
if (child.startsWith(parent) && child.length > parent.length) {
final suffix = child.substring(parent.length);
return suffix.startsWith('/') || suffix.startsWith('\\');
}
return false;
}
removeUnreadCount = jobTable
.where((e) =>
e.action == CmFileAction.remove &&
e.fileName.startsWith(data.path))
isChild(data.path, e.fileName))
.length;
jobTable.removeWhere((e) =>
e.action == CmFileAction.remove &&
e.fileName.startsWith(data.path));
e.action == CmFileAction.remove && isChild(data.path, e.fileName));
}
jobTable.add(CmFileLog()
..id = data.id

View File

@ -49,6 +49,7 @@ use sha2::{Digest, Sha256};
use std::sync::atomic::Ordering;
use std::{
num::NonZeroI64,
path::PathBuf,
sync::{atomic::AtomicI64, mpsc as std_mpsc},
};
#[cfg(not(any(target_os = "android", target_os = "ios")))]
@ -2953,12 +2954,17 @@ impl FileRemoveLogControl {
fn on_remove_dir(&mut self, d: FileRemoveDir) -> Option<ipc::Data> {
self.instant = Instant::now();
self.removed_files.retain(|f| !f.path.starts_with(&d.path));
self.removed_dirs.retain(|x| !x.path.starts_with(&d.path));
let direct_child = |parent: &str, child: &str| {
PathBuf::from(child).parent().map(|x| x.to_path_buf()) == Some(PathBuf::from(parent))
};
self.removed_files
.retain(|f| !direct_child(&f.path, &d.path));
self.removed_dirs
.retain(|x| !direct_child(&d.path, &x.path));
if !self
.removed_dirs
.iter()
.any(|x| d.path.starts_with(&x.path))
.any(|x| direct_child(&x.path, &d.path))
{
self.removed_dirs.push(d.clone());
}