Merge pull request #6051 from fufesou/fix/connect_the_same_peer

fix, connect the same peer
This commit is contained in:
RustDesk 2023-10-16 10:54:46 +08:00 committed by GitHub
commit a68c7bf019
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 18 deletions

View File

@ -4,8 +4,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_hbb/common.dart';
import 'package:flutter_hbb/models/state_model.dart';
const bool kOpenSamePeerInNewWindow = true;
const double kDesktopRemoteTabBarHeight = 28.0;
const int kInvalidWindowId = -1;
const int kMainWindowId = 0;

View File

@ -2,7 +2,6 @@ import 'dart:convert';
import 'dart:io';
import 'package:desktop_multi_window/desktop_multi_window.dart';
import 'package:flutter_hbb/models/platform_model.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@ -187,21 +186,11 @@ class RustDeskMultiWindowManager {
bool openInTabs = type != WindowType.RemoteDesktop ||
mainGetLocalBoolOptionSync(kOptionOpenNewConnInTabs);
if (kOpenSamePeerInNewWindow) {
// Open in new window if the peer is already connected.
// No need to care about the previous session type.
if (type == WindowType.RemoteDesktop &&
await bind.sessionGetFlutterOptionByPeerId(id: remoteId, k: '') !=
null) {
openInTabs = false;
}
} else {
if (windows.length > 1 || !openInTabs) {
for (final windowId in windows) {
if (await DesktopMultiWindow.invokeMethod(
windowId, kWindowEventActiveSession, remoteId)) {
return MultiWindowCallResult(windowId, null);
}
if (windows.length > 1 || !openInTabs) {
for (final windowId in windows) {
if (await DesktopMultiWindow.invokeMethod(
windowId, kWindowEventActiveSession, remoteId)) {
return MultiWindowCallResult(windowId, null);
}
}
}