add: file transfer multi tab support

Signed-off-by: Kingtous <kingtous@qq.com>
This commit is contained in:
Kingtous
2022-06-17 22:57:41 +08:00
parent 330a2ce5a5
commit 77b86ddb6b
7 changed files with 778 additions and 23 deletions

View File

@@ -33,6 +33,7 @@ class RustDeskMultiWindowManager {
static final instance = RustDeskMultiWindowManager._();
int? _remoteDesktopWindowId;
int? _fileTransferWindowId;
Future<dynamic> new_remote_desktop(String remote_id) async {
final msg =
@@ -60,6 +61,31 @@ class RustDeskMultiWindowManager {
}
}
Future<dynamic> new_file_transfer(String remote_id) async {
final msg =
jsonEncode({"type": WindowType.FileTransfer.index, "id": remote_id});
try {
final ids = await DesktopMultiWindow.getAllSubWindowIds();
if (!ids.contains(_fileTransferWindowId)) {
_fileTransferWindowId = null;
}
} on Error {
_fileTransferWindowId = null;
}
if (_fileTransferWindowId == null) {
final fileTransferController = await DesktopMultiWindow.createWindow(msg);
fileTransferController
..setFrame(const Offset(0, 0) & const Size(1280, 720))
..center()
..setTitle("rustdesk - file transfer")
..show();
_fileTransferWindowId = fileTransferController.windowId;
} else {
return call(WindowType.FileTransfer, "new_file_transfer", msg);
}
}
Future<dynamic> call(WindowType type, String methodName, dynamic args) async {
int? windowId = findWindowByType(type);
if (windowId == null) {