Skip to content

Commit

Permalink
Merge branch 'rustdesk:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangbo8418 authored Nov 26, 2024
2 parents d49399e + b99c540 commit cd83193
Show file tree
Hide file tree
Showing 48 changed files with 110 additions and 21 deletions.
45 changes: 29 additions & 16 deletions flutter/lib/common/widgets/address_book.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:math';

import 'package:bot_toast/bot_toast.dart';
import 'package:dropdown_button2/dropdown_button2.dart';
import 'package:dynamic_layouts/dynamic_layouts.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -316,13 +317,14 @@ class _AddressBookState extends State<AddressBook> {

Widget _buildTags() {
return Obx(() {
final List tags;
List tags;
if (gFFI.abModel.sortTags.value) {
tags = gFFI.abModel.currentAbTags.toList();
tags.sort();
} else {
tags = gFFI.abModel.currentAbTags;
tags = gFFI.abModel.currentAbTags.toList();
}
tags = [kUntagged, ...tags].toList();
final editPermission = gFFI.abModel.current.canWrite();
tagBuilder(String e) {
return AddressBookTag(
Expand Down Expand Up @@ -669,6 +671,14 @@ class _AddressBookState extends State<AddressBook> {
} else {
final tags = field.trim().split(RegExp(r"[\s,;\n]+"));
field = tags.join(',');
for (var t in [kUntagged, translate(kUntagged)]) {
if (tags.contains(t)) {
BotToast.showText(
contentColor: Colors.red, text: 'Tag name cannot be "$t"');
isInProgress = false;
return;
}
}
gFFI.abModel.addTags(tags);
// final currentPeers
}
Expand Down Expand Up @@ -741,12 +751,14 @@ class AddressBookTag extends StatelessWidget {
}

const double radius = 8;
final isUnTagged = name == kUntagged;
final showAction = showActionMenu && !isUnTagged;
return GestureDetector(
onTap: onTap,
onTapDown: showActionMenu ? setPosition : null,
onSecondaryTapDown: showActionMenu ? setPosition : null,
onSecondaryTap: showActionMenu ? () => _showMenu(context, pos) : null,
onLongPress: showActionMenu ? () => _showMenu(context, pos) : null,
onTapDown: showAction ? setPosition : null,
onSecondaryTapDown: showAction ? setPosition : null,
onSecondaryTap: showAction ? () => _showMenu(context, pos) : null,
onLongPress: showAction ? () => _showMenu(context, pos) : null,
child: Obx(() => Container(
decoration: BoxDecoration(
color: tags.contains(name)
Expand All @@ -758,17 +770,18 @@ class AddressBookTag extends StatelessWidget {
child: IntrinsicWidth(
child: Row(
children: [
Container(
width: radius,
height: radius,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: tags.contains(name)
? Colors.white
: gFFI.abModel.getCurrentAbTagColor(name)),
).marginOnly(right: radius / 2),
if (!isUnTagged)
Container(
width: radius,
height: radius,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: tags.contains(name)
? Colors.white
: gFFI.abModel.getCurrentAbTagColor(name)),
).marginOnly(right: radius / 2),
Expanded(
child: Text(name,
child: Text(isUnTagged ? translate(name) : name,
style: TextStyle(
overflow: TextOverflow.ellipsis,
color: tags.contains(name) ? Colors.white : null)),
Expand Down
12 changes: 10 additions & 2 deletions flutter/lib/common/widgets/peers_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_hbb/consts.dart';
import 'package:flutter_hbb/desktop/widgets/scroll_wrapper.dart';
import 'package:flutter_hbb/models/ab_model.dart';
import 'package:flutter_hbb/models/peer_tab_model.dart';
import 'package:flutter_hbb/models/state_model.dart';
import 'package:get/get.dart';
Expand Down Expand Up @@ -532,15 +533,22 @@ class AddressBookPeersView extends BasePeersView {
if (selectedTags.isEmpty) {
return true;
}
// The result of a no-tag union with normal tags, still allows normal tags to perform union or intersection operations.
final selectedNormalTags =
selectedTags.where((tag) => tag != kUntagged).toList();
if (selectedTags.contains(kUntagged)) {
if (idents.isEmpty) return true;
if (selectedNormalTags.isEmpty) return false;
}
if (gFFI.abModel.filterByIntersection.value) {
for (final tag in selectedTags) {
for (final tag in selectedNormalTags) {
if (!idents.contains(tag)) {
return false;
}
}
return true;
} else {
for (final tag in selectedTags) {
for (final tag in selectedNormalTags) {
if (idents.contains(tag)) {
return true;
}
Expand Down
27 changes: 24 additions & 3 deletions flutter/lib/mobile/pages/remote_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,19 @@ import '../widgets/dialog.dart';

final initText = '1' * 1024;

// Workaround for Android (default input method, Microsoft SwiftKey keyboard) when using physical keyboard.
// When connecting a physical keyboard, `KeyEvent.physicalKey.usbHidUsage` are wrong is using Microsoft SwiftKey keyboard.
// https://github.com/flutter/flutter/issues/159384
// https://github.com/flutter/flutter/issues/159383
void _disableAndroidSoftKeyboard({bool? isKeyboardVisible}) {
if (isAndroid) {
if (isKeyboardVisible != true) {
// `enable_soft_keyboard` will be set to `true` when clicking the keyboard icon, in `openKeyboard()`.
gFFI.invokeMethod("enable_soft_keyboard", false);
}
}
}

class RemotePage extends StatefulWidget {
RemotePage({Key? key, required this.id, this.password, this.isSharedPassword})
: super(key: key);
Expand Down Expand Up @@ -99,6 +112,8 @@ class _RemotePageState extends State<RemotePage> with WidgetsBindingObserver {
if (gFFI.recordingModel.start) {
showToast(translate('Automatically record outgoing sessions'));
}
_disableAndroidSoftKeyboard(
isKeyboardVisible: keyboardVisibilityController.isVisible);
});
WidgetsBinding.instance.addObserver(this);
}
Expand Down Expand Up @@ -1244,7 +1259,9 @@ void showOptions(
toggles +
[privacyModeWidget]),
);
}, clickMaskDismiss: true, backDismiss: true);
}, clickMaskDismiss: true, backDismiss: true).then((value) {
_disableAndroidSoftKeyboard();
});
}

TTextMenu? getVirtualDisplayMenu(FFI ffi, String id) {
Expand All @@ -1263,7 +1280,9 @@ TTextMenu? getVirtualDisplayMenu(FFI ffi, String id) {
children: children,
),
);
}, clickMaskDismiss: true, backDismiss: true);
}, clickMaskDismiss: true, backDismiss: true).then((value) {
_disableAndroidSoftKeyboard();
});
},
);
}
Expand Down Expand Up @@ -1305,7 +1324,9 @@ TTextMenu? getResolutionMenu(FFI ffi, String id) {
children: children,
),
);
}, clickMaskDismiss: true, backDismiss: true);
}, clickMaskDismiss: true, backDismiss: true).then((value) {
_disableAndroidSoftKeyboard();
});
},
);
}
Expand Down
3 changes: 3 additions & 0 deletions flutter/lib/models/ab_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ bool filterAbTagByIntersection() {
const _personalAddressBookName = "My address book";
const _legacyAddressBookName = "Legacy address book";

const kUntagged = "Untagged";

enum ForcePullAb {
listAndCurrent,
current,
Expand Down Expand Up @@ -424,6 +426,7 @@ class AbModel {

// #region tags
Future<bool> addTags(List<String> tagList) async {
tagList.removeWhere((e) => e == kUntagged);
final ret = await current.addTags(tagList, {});
await pullNonLegacyAfterChange();
_saveCache();
Expand Down
1 change: 1 addition & 0 deletions flutter/lib/models/model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2859,6 +2859,7 @@ class FFI {
canvasModel.scale,
ffiModel.pi.currentDisplay);
}
imageModel.callbacksOnFirstImage.clear();
await imageModel.update(null);
cursorModel.clear();
ffiModel.clear();
Expand Down
1 change: 1 addition & 0 deletions src/lang/ar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,5 +654,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Upload files", ""),
("Clipboard is synchronized", ""),
("Update client clipboard", ""),
("Untagged", ""),
].iter().cloned().collect();
}
1 change: 1 addition & 0 deletions src/lang/be.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,5 +654,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Upload files", ""),
("Clipboard is synchronized", ""),
("Update client clipboard", ""),
("Untagged", ""),
].iter().cloned().collect();
}
1 change: 1 addition & 0 deletions src/lang/bg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,5 +654,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Upload files", ""),
("Clipboard is synchronized", ""),
("Update client clipboard", ""),
("Untagged", ""),
].iter().cloned().collect();
}
1 change: 1 addition & 0 deletions src/lang/ca.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,5 +654,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Upload files", ""),
("Clipboard is synchronized", ""),
("Update client clipboard", ""),
("Untagged", ""),
].iter().cloned().collect();
}
1 change: 1 addition & 0 deletions src/lang/cn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,5 +654,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Upload files", "上传文件"),
("Clipboard is synchronized", "剪贴板已同步"),
("Update client clipboard", "更新客户端的粘贴板"),
("Untagged", "无标签"),
].iter().cloned().collect();
}
1 change: 1 addition & 0 deletions src/lang/cs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,5 +654,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Upload files", ""),
("Clipboard is synchronized", ""),
("Update client clipboard", ""),
("Untagged", ""),
].iter().cloned().collect();
}
1 change: 1 addition & 0 deletions src/lang/da.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,5 +654,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Upload files", ""),
("Clipboard is synchronized", ""),
("Update client clipboard", ""),
("Untagged", ""),
].iter().cloned().collect();
}
1 change: 1 addition & 0 deletions src/lang/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,5 +654,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Upload files", "Dateien hochladen"),
("Clipboard is synchronized", "Zwischenablage ist synchronisiert"),
("Update client clipboard", "Client-Zwischenablage aktualisieren"),
("Untagged", ""),
].iter().cloned().collect();
}
1 change: 1 addition & 0 deletions src/lang/el.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,5 +654,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Upload files", ""),
("Clipboard is synchronized", ""),
("Update client clipboard", ""),
("Untagged", ""),
].iter().cloned().collect();
}
1 change: 1 addition & 0 deletions src/lang/eo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,5 +654,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Upload files", ""),
("Clipboard is synchronized", ""),
("Update client clipboard", ""),
("Untagged", ""),
].iter().cloned().collect();
}
1 change: 1 addition & 0 deletions src/lang/es.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,5 +654,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Upload files", "Subir archivos"),
("Clipboard is synchronized", "Portapapeles sincronizado"),
("Update client clipboard", "Actualizar portapapeles del cliente"),
("Untagged", ""),
].iter().cloned().collect();
}
1 change: 1 addition & 0 deletions src/lang/et.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,5 +654,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Upload files", ""),
("Clipboard is synchronized", ""),
("Update client clipboard", ""),
("Untagged", ""),
].iter().cloned().collect();
}
1 change: 1 addition & 0 deletions src/lang/eu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,5 +654,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Upload files", ""),
("Clipboard is synchronized", ""),
("Update client clipboard", ""),
("Untagged", ""),
].iter().cloned().collect();
}
1 change: 1 addition & 0 deletions src/lang/fa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,5 +654,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Upload files", ""),
("Clipboard is synchronized", ""),
("Update client clipboard", ""),
("Untagged", ""),
].iter().cloned().collect();
}
1 change: 1 addition & 0 deletions src/lang/fr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,5 +654,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Upload files", ""),
("Clipboard is synchronized", ""),
("Update client clipboard", ""),
("Untagged", ""),
].iter().cloned().collect();
}
1 change: 1 addition & 0 deletions src/lang/he.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,5 +654,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Upload files", ""),
("Clipboard is synchronized", ""),
("Update client clipboard", ""),
("Untagged", ""),
].iter().cloned().collect();
}
1 change: 1 addition & 0 deletions src/lang/hr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,5 +654,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Upload files", ""),
("Clipboard is synchronized", ""),
("Update client clipboard", ""),
("Untagged", ""),
].iter().cloned().collect();
}
1 change: 1 addition & 0 deletions src/lang/hu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,5 +654,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Upload files", "Fájlok feltöltése"),
("Clipboard is synchronized", "A vágólap szinkronizálva van"),
("Update client clipboard", ""),
("Untagged", ""),
].iter().cloned().collect();
}
1 change: 1 addition & 0 deletions src/lang/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,5 +654,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Upload files", ""),
("Clipboard is synchronized", ""),
("Update client clipboard", ""),
("Untagged", ""),
].iter().cloned().collect();
}
1 change: 1 addition & 0 deletions src/lang/it.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,5 +654,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Upload files", "File upload"),
("Clipboard is synchronized", "Gli appunti sono sincronizzati"),
("Update client clipboard", "Aggiorna appunti client"),
("Untagged", ""),
].iter().cloned().collect();
}
1 change: 1 addition & 0 deletions src/lang/ja.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,5 +654,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Upload files", ""),
("Clipboard is synchronized", ""),
("Update client clipboard", ""),
("Untagged", ""),
].iter().cloned().collect();
}
1 change: 1 addition & 0 deletions src/lang/ko.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,5 +654,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Upload files", "파일 업로드"),
("Clipboard is synchronized", "클립보드가 동기화됨"),
("Update client clipboard", ""),
("Untagged", ""),
].iter().cloned().collect();
}
1 change: 1 addition & 0 deletions src/lang/kz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,5 +654,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Upload files", ""),
("Clipboard is synchronized", ""),
("Update client clipboard", ""),
("Untagged", ""),
].iter().cloned().collect();
}
1 change: 1 addition & 0 deletions src/lang/lt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,5 +654,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Upload files", ""),
("Clipboard is synchronized", ""),
("Update client clipboard", ""),
("Untagged", ""),
].iter().cloned().collect();
}
1 change: 1 addition & 0 deletions src/lang/lv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,5 +654,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Upload files", "Augšupielādēt failus"),
("Clipboard is synchronized", "Starpliktuve ir sinhronizēta"),
("Update client clipboard", ""),
("Untagged", ""),
].iter().cloned().collect();
}
1 change: 1 addition & 0 deletions src/lang/nb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,5 +654,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Upload files", ""),
("Clipboard is synchronized", ""),
("Update client clipboard", ""),
("Untagged", ""),
].iter().cloned().collect();
}
1 change: 1 addition & 0 deletions src/lang/nl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,5 +654,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Upload files", "Bestanden uploaden"),
("Clipboard is synchronized", "Klembord is gesynchroniseerd"),
("Update client clipboard", "Klembord van client bijwerken"),
("Untagged", ""),
].iter().cloned().collect();
}
Loading

0 comments on commit cd83193

Please sign in to comment.