From a7a10f4eaaacdb6910c8fe4e374ac5d3a91c6be3 Mon Sep 17 00:00:00 2001 From: fufesou Date: Sun, 14 Apr 2024 21:25:26 +0800 Subject: [PATCH] Refact. Win, file copy paste, default true (#7719) * Refact. Win, file copy paste, default true Signed-off-by: fufesou * Fix. File copy and paste menu, compatible with 1.2.3 Signed-off-by: fufesou --------- Signed-off-by: fufesou --- flutter/lib/common/widgets/toolbar.dart | 11 +++++++++-- libs/hbb_common/src/config.rs | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/flutter/lib/common/widgets/toolbar.dart b/flutter/lib/common/widgets/toolbar.dart index a8638a302..e38e3fb75 100644 --- a/flutter/lib/common/widgets/toolbar.dart +++ b/flutter/lib/common/widgets/toolbar.dart @@ -441,10 +441,17 @@ Future> toolbarDisplayToggle( child: Text(translate('Mute')))); } // file copy and paste + // If the version is less than 1.2.4, file copy and paste is supported on Windows only. + final isSupportIfPeer_1_2_3 = versionCmp(pi.version, '1.2.4') < 0 && + isWindows && + pi.platform == kPeerPlatformWindows; + // If the version is 1.2.4 or later, file copy and paste is supported when kPlatformAdditionsHasFileClipboard is set. + final isSupportIfPeer_1_2_4 = versionCmp(pi.version, '1.2.4') >= 0 && + bind.mainHasFileClipboard() && + pi.platformAdditions.containsKey(kPlatformAdditionsHasFileClipboard); if (ffiModel.keyboard && perms['file'] != false && - bind.mainHasFileClipboard() && - pi.platformAdditions.containsKey(kPlatformAdditionsHasFileClipboard)) { + (isSupportIfPeer_1_2_3 || isSupportIfPeer_1_2_4)) { final enabled = !ffiModel.viewOnly; final option = 'enable-file-transfer'; final value = diff --git a/libs/hbb_common/src/config.rs b/libs/hbb_common/src/config.rs index 1c58ae9b2..4acfb2cdf 100644 --- a/libs/hbb_common/src/config.rs +++ b/libs/hbb_common/src/config.rs @@ -1561,6 +1561,7 @@ impl UserDefaultConfig { } "custom_image_quality" => self.get_double_string(key, 50.0, 10.0, 0xFFF as f64), "custom-fps" => self.get_double_string(key, 30.0, 5.0, 120.0), + "enable_file_transfer" => self.get_string(key, "Y", vec![""]), _ => self .get_after(key) .map(|v| v.to_string())