mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-12-12 10:19:09 +08:00
Merge branch 'master' into master
This commit is contained in:
commit
ae13582101
@ -1290,11 +1290,24 @@ bool callUniLinksUriHandler(Uri uri) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
connectMainDesktop(String id,
|
||||||
|
{required bool isFileTransfer,
|
||||||
|
required bool isTcpTunneling,
|
||||||
|
required bool isRDP}) async {
|
||||||
|
if (isFileTransfer) {
|
||||||
|
await rustDeskWinManager.newFileTransfer(id);
|
||||||
|
} else if (isTcpTunneling || isRDP) {
|
||||||
|
await rustDeskWinManager.newPortForward(id, isRDP);
|
||||||
|
} else {
|
||||||
|
await rustDeskWinManager.newRemoteDesktop(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Connect to a peer with [id].
|
/// Connect to a peer with [id].
|
||||||
/// If [isFileTransfer], starts a session only for file transfer.
|
/// If [isFileTransfer], starts a session only for file transfer.
|
||||||
/// If [isTcpTunneling], starts a session only for tcp tunneling.
|
/// If [isTcpTunneling], starts a session only for tcp tunneling.
|
||||||
/// If [isRDP], starts a session only for rdp.
|
/// If [isRDP], starts a session only for rdp.
|
||||||
void connect(BuildContext context, String id,
|
connect(BuildContext context, String id,
|
||||||
{bool isFileTransfer = false,
|
{bool isFileTransfer = false,
|
||||||
bool isTcpTunneling = false,
|
bool isTcpTunneling = false,
|
||||||
bool isRDP = false}) async {
|
bool isRDP = false}) async {
|
||||||
@ -1304,12 +1317,20 @@ void connect(BuildContext context, String id,
|
|||||||
"more than one connect type");
|
"more than one connect type");
|
||||||
|
|
||||||
if (isDesktop) {
|
if (isDesktop) {
|
||||||
if (isFileTransfer) {
|
if (desktopType == DesktopType.main) {
|
||||||
await rustDeskWinManager.newFileTransfer(id);
|
await connectMainDesktop(
|
||||||
} else if (isTcpTunneling || isRDP) {
|
id,
|
||||||
await rustDeskWinManager.newPortForward(id, isRDP);
|
isFileTransfer: isFileTransfer,
|
||||||
|
isTcpTunneling: isTcpTunneling,
|
||||||
|
isRDP: isRDP,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
await rustDeskWinManager.newRemoteDesktop(id);
|
await rustDeskWinManager.call(WindowType.Main, kWindowConnect, {
|
||||||
|
'id': id,
|
||||||
|
'isFileTransfer': isFileTransfer,
|
||||||
|
'isTcpTunneling': isTcpTunneling,
|
||||||
|
'isRDP': isRDP,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isFileTransfer) {
|
if (isFileTransfer) {
|
||||||
|
@ -11,9 +11,12 @@ const String kAppTypeDesktopRemote = "remote";
|
|||||||
const String kAppTypeDesktopFileTransfer = "file transfer";
|
const String kAppTypeDesktopFileTransfer = "file transfer";
|
||||||
const String kAppTypeDesktopPortForward = "port forward";
|
const String kAppTypeDesktopPortForward = "port forward";
|
||||||
|
|
||||||
|
const String kWindowMainWindowOnTop = "main_window_on_top";
|
||||||
|
const String kWindowGetWindowInfo = "get_window_info";
|
||||||
const String kWindowActionRebuild = "rebuild";
|
const String kWindowActionRebuild = "rebuild";
|
||||||
const String kWindowEventHide = "hide";
|
const String kWindowEventHide = "hide";
|
||||||
const String kWindowEventShow = "show";
|
const String kWindowEventShow = "show";
|
||||||
|
const String kWindowConnect = "connect";
|
||||||
|
|
||||||
const String kUniLinksPrefix = "rustdesk://";
|
const String kUniLinksPrefix = "rustdesk://";
|
||||||
const String kActionNewConnection = "connection/new/";
|
const String kActionNewConnection = "connection/new/";
|
||||||
|
@ -14,11 +14,8 @@ import 'package:flutter_hbb/desktop/widgets/scroll_wrapper.dart';
|
|||||||
import 'package:flutter_hbb/models/platform_model.dart';
|
import 'package:flutter_hbb/models/platform_model.dart';
|
||||||
import 'package:flutter_hbb/models/server_model.dart';
|
import 'package:flutter_hbb/models/server_model.dart';
|
||||||
import 'package:flutter_hbb/utils/multi_window_manager.dart';
|
import 'package:flutter_hbb/utils/multi_window_manager.dart';
|
||||||
import 'package:flutter_hbb/utils/tray_manager.dart';
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:tray_manager/tray_manager.dart';
|
|
||||||
import 'package:window_manager/window_manager.dart';
|
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
import 'package:window_size/window_size.dart' as window_size;
|
import 'package:window_size/window_size.dart' as window_size;
|
||||||
|
|
||||||
@ -34,7 +31,7 @@ class DesktopHomePage extends StatefulWidget {
|
|||||||
const borderColor = Color(0xFF2F65BA);
|
const borderColor = Color(0xFF2F65BA);
|
||||||
|
|
||||||
class _DesktopHomePageState extends State<DesktopHomePage>
|
class _DesktopHomePageState extends State<DesktopHomePage>
|
||||||
with TrayListener, AutomaticKeepAliveClientMixin {
|
with AutomaticKeepAliveClientMixin {
|
||||||
final _leftPaneScrollController = ScrollController();
|
final _leftPaneScrollController = ScrollController();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -428,35 +425,6 @@ class _DesktopHomePageState extends State<DesktopHomePage>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
void onTrayIconMouseDown() {
|
|
||||||
windowManager.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onTrayIconRightMouseDown() {
|
|
||||||
// linux does not support popup menu manually.
|
|
||||||
// linux will handle popup action ifself.
|
|
||||||
if (Platform.isMacOS || Platform.isWindows) {
|
|
||||||
trayManager.popUpContextMenu();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onTrayMenuItemClick(MenuItem menuItem) {
|
|
||||||
switch (menuItem.key) {
|
|
||||||
case kTrayItemQuitKey:
|
|
||||||
windowManager.close();
|
|
||||||
break;
|
|
||||||
case kTrayItemShowKey:
|
|
||||||
windowManager.show();
|
|
||||||
windowManager.focus();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
@ -492,17 +460,14 @@ class _DesktopHomePageState extends State<DesktopHomePage>
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
Get.put<RxBool>(svcStopped, tag: 'stop-service');
|
Get.put<RxBool>(svcStopped, tag: 'stop-service');
|
||||||
// disable this tray because we use tray function provided by rust now
|
|
||||||
// initTray();
|
|
||||||
trayManager.addListener(this);
|
|
||||||
rustDeskWinManager.registerActiveWindowListener(onActiveWindowChanged);
|
rustDeskWinManager.registerActiveWindowListener(onActiveWindowChanged);
|
||||||
|
|
||||||
rustDeskWinManager.setMethodHandler((call, fromWindowId) async {
|
rustDeskWinManager.setMethodHandler((call, fromWindowId) async {
|
||||||
debugPrint(
|
debugPrint(
|
||||||
"[Main] call ${call.method} with args ${call.arguments} from window $fromWindowId");
|
"[Main] call ${call.method} with args ${call.arguments} from window $fromWindowId");
|
||||||
if (call.method == "main_window_on_top") {
|
if (call.method == kWindowMainWindowOnTop) {
|
||||||
window_on_top(null);
|
window_on_top(null);
|
||||||
} else if (call.method == "get_window_info") {
|
} else if (call.method == kWindowGetWindowInfo) {
|
||||||
final screen = (await window_size.getWindowInfo()).screen;
|
final screen = (await window_size.getWindowInfo()).screen;
|
||||||
if (screen == null) {
|
if (screen == null) {
|
||||||
return "";
|
return "";
|
||||||
@ -529,6 +494,13 @@ class _DesktopHomePageState extends State<DesktopHomePage>
|
|||||||
rustDeskWinManager.registerActiveWindow(call.arguments["id"]);
|
rustDeskWinManager.registerActiveWindow(call.arguments["id"]);
|
||||||
} else if (call.method == kWindowEventHide) {
|
} else if (call.method == kWindowEventHide) {
|
||||||
rustDeskWinManager.unregisterActiveWindow(call.arguments["id"]);
|
rustDeskWinManager.unregisterActiveWindow(call.arguments["id"]);
|
||||||
|
} else if (call.method == kWindowConnect) {
|
||||||
|
await connectMainDesktop(
|
||||||
|
call.arguments['id'],
|
||||||
|
isFileTransfer: call.arguments['isFileTransfer'],
|
||||||
|
isTcpTunneling: call.arguments['isTcpTunneling'],
|
||||||
|
isRDP: call.arguments['isRDP'],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_uniLinksSubscription = listenUniLinks();
|
_uniLinksSubscription = listenUniLinks();
|
||||||
@ -536,10 +508,6 @@ class _DesktopHomePageState extends State<DesktopHomePage>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
// destoryTray();
|
|
||||||
// fix: disable unregister to prevent from receiving events from other windows
|
|
||||||
// rustDeskWinManager.unregisterActiveWindowListener(onActiveWindowChanged);
|
|
||||||
trayManager.removeListener(this);
|
|
||||||
_uniLinksSubscription?.cancel();
|
_uniLinksSubscription?.cancel();
|
||||||
Get.delete<RxBool>(tag: 'stop-service');
|
Get.delete<RxBool>(tag: 'stop-service');
|
||||||
_updateTimer?.cancel();
|
_updateTimer?.cancel();
|
||||||
|
@ -8,6 +8,7 @@ import 'package:flutter/services.dart';
|
|||||||
import 'package:flutter_hbb/models/chat_model.dart';
|
import 'package:flutter_hbb/models/chat_model.dart';
|
||||||
import 'package:flutter_hbb/models/state_model.dart';
|
import 'package:flutter_hbb/models/state_model.dart';
|
||||||
import 'package:flutter_hbb/consts.dart';
|
import 'package:flutter_hbb/consts.dart';
|
||||||
|
import 'package:flutter_hbb/utils/multi_window_manager.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:rxdart/rxdart.dart' as rxdart;
|
import 'package:rxdart/rxdart.dart' as rxdart;
|
||||||
@ -201,7 +202,8 @@ class _RemoteMenubarState extends State<RemoteMenubar> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_updateScreen() async {
|
_updateScreen() async {
|
||||||
final v = await DesktopMultiWindow.invokeMethod(0, 'get_window_info', '');
|
final v = await rustDeskWinManager.call(
|
||||||
|
WindowType.Main, kWindowGetWindowInfo, '');
|
||||||
final String valueStr = v;
|
final String valueStr = v;
|
||||||
if (valueStr.isEmpty) {
|
if (valueStr.isEmpty) {
|
||||||
_screen = null;
|
_screen = null;
|
||||||
|
@ -1033,8 +1033,8 @@ class AddButton extends StatelessWidget {
|
|||||||
return ActionIcon(
|
return ActionIcon(
|
||||||
message: 'New Connection',
|
message: 'New Connection',
|
||||||
icon: IconFont.add,
|
icon: IconFont.add,
|
||||||
onTap: () =>
|
onTap: () => rustDeskWinManager.call(
|
||||||
rustDeskWinManager.call(WindowType.Main, "main_window_on_top", ""),
|
WindowType.Main, kWindowMainWindowOnTop, ""),
|
||||||
isClose: false);
|
isClose: false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -383,8 +383,8 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
path: "."
|
path: "."
|
||||||
ref: bfb19c84a8244771488bc05cc5f9c9b5e0324cfd
|
ref: "74b1b314142b6775c1243067a3503ac568ebc74b"
|
||||||
resolved-ref: bfb19c84a8244771488bc05cc5f9c9b5e0324cfd
|
resolved-ref: "74b1b314142b6775c1243067a3503ac568ebc74b"
|
||||||
url: "https://github.com/Kingtous/rustdesk_flutter_custom_cursor"
|
url: "https://github.com/Kingtous/rustdesk_flutter_custom_cursor"
|
||||||
source: git
|
source: git
|
||||||
version: "0.0.1"
|
version: "0.0.1"
|
||||||
@ -617,13 +617,6 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.1.4"
|
version: "0.1.4"
|
||||||
menu_base:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: menu_base
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "0.1.1"
|
|
||||||
meta:
|
meta:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -892,13 +885,6 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.3"
|
version: "1.0.3"
|
||||||
shortid:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: shortid
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "0.1.2"
|
|
||||||
sky_engine:
|
sky_engine:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description: flutter
|
description: flutter
|
||||||
@ -988,15 +974,6 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.4.0"
|
version: "1.4.0"
|
||||||
tray_manager:
|
|
||||||
dependency: "direct main"
|
|
||||||
description:
|
|
||||||
path: "."
|
|
||||||
ref: "3aa37c86e47ea748e7b5507cbe59f2c54ebdb23a"
|
|
||||||
resolved-ref: "3aa37c86e47ea748e7b5507cbe59f2c54ebdb23a"
|
|
||||||
url: "https://github.com/Kingtous/rustdesk_tray_manager"
|
|
||||||
source: git
|
|
||||||
version: "0.1.8"
|
|
||||||
tuple:
|
tuple:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@ -1210,7 +1187,7 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.0"
|
version: "2.2.0"
|
||||||
win32:
|
win32:
|
||||||
dependency: transitive
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: win32
|
name: win32
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
|
@ -65,10 +65,6 @@ dependencies:
|
|||||||
url: https://github.com/Kingtous/rustdesk_desktop_multi_window
|
url: https://github.com/Kingtous/rustdesk_desktop_multi_window
|
||||||
ref: cb086219bd4760a95a483cb14c1791d2a39ca5a0
|
ref: cb086219bd4760a95a483cb14c1791d2a39ca5a0
|
||||||
freezed_annotation: ^2.0.3
|
freezed_annotation: ^2.0.3
|
||||||
tray_manager:
|
|
||||||
git:
|
|
||||||
url: https://github.com/Kingtous/rustdesk_tray_manager
|
|
||||||
ref: 3aa37c86e47ea748e7b5507cbe59f2c54ebdb23a
|
|
||||||
flutter_custom_cursor:
|
flutter_custom_cursor:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/Kingtous/rustdesk_flutter_custom_cursor
|
url: https://github.com/Kingtous/rustdesk_flutter_custom_cursor
|
||||||
|
Loading…
Reference in New Issue
Block a user