fix closing PortForward page while closing msgbox

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages 2022-09-05 16:01:53 +08:00
parent 48998ded2e
commit 48481884b1
2 changed files with 19 additions and 1 deletions

View File

@ -27,6 +27,7 @@ var isWeb = false;
var isWebDesktop = false;
var version = "";
int androidVersion = 0;
late final DesktopType? desktopType;
typedef F = String Function(String);
typedef FMethod = String Function(String, dynamic);
@ -42,6 +43,15 @@ late final iconFile = MemoryImage(Uint8List.fromList(base64Decode(
late final iconRestart = MemoryImage(Uint8List.fromList(base64Decode(
'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAB7BAAAewQHDaVRTAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAbhJREFUWIXVlrFqFGEUhb+7UYxaWCQKlrKKxaZSQVGDJih2tj6MD2DnMwiWvoAIRnENIpZiYxEro6IooiS7SPwsMgNLkk3mjmYmnmb45/73nMNwz/x/qH3gMu2gH6rAU+Blw+Lngau4jpmGxVF7qp1iPWjaQKnZ2WnXbuP/NqAeUPc3ZkA9XDwvqc+BVWCgPlJ7tRwUKThZce819b46VH+pfXVRXVO/q2cSul3VOgZUl0ejq86r39TXI8mqZKDuDEwCw3IREQvAbWAGmMsQZQ0sAl3gHPB1Q+0e8BuYzRDuy2yOiFVgaUxtRf0ETGc4syk4rc6PqU0Cx9j8Zf6dAeAK8Fi9sUXtFjABvEgxJlNwRP2svlNPjbw/q35U36oTFbnyMSwabxb/gB/qA3VBHagrauV7RW0DRfP1IvMlXqkXkhz1DYyQTKtHa/Z2VVMx3IiI+PI3/bCHjuOpFrSnAMpL6QfgTcMGesDx0kBr2BMzsNyi/vtQu8CJlgwsRbZDnWP90NkKaxHxJMOXMqAeAn5u0ydwMCKGY+qbkB3C2W3EKWoXk5zVoHbUZ+6Mh7tl4G4F8RJ3qvL+AfV3r5Vdpj70AAAAAElFTkSuQmCC')));
enum DesktopType {
main,
remote,
fileTransfer,
cm,
portForward,
rdp,
}
class IconFont {
static const _family1 = 'Tabbar';
static const _family2 = 'PeerSearchbar';
@ -478,7 +488,9 @@ void msgBox(
submit() {
dialogManager.dismissAll();
// https://github.com/fufesou/rustdesk/blob/5e9a31340b899822090a3731769ae79c6bf5f3e5/src/ui/common.tis#L263
if (!type.contains("custom")) {
if (!type.contains("custom") &&
!(desktopType == DesktopType.portForward ||
desktopType == DesktopType.rdp)) {
closeConnection();
}
}

View File

@ -43,12 +43,16 @@ Future<Null> main(List<String> args) async {
WindowType wType = type.windowType;
switch (wType) {
case WindowType.RemoteDesktop:
desktopType = DesktopType.remote;
runRemoteScreen(argument);
break;
case WindowType.FileTransfer:
desktopType = DesktopType.fileTransfer;
runFileTransferScreen(argument);
break;
case WindowType.PortForward:
desktopType =
argument['isRDP'] ? DesktopType.rdp : DesktopType.portForward;
runPortForwardScreen(argument);
break;
default:
@ -56,9 +60,11 @@ Future<Null> main(List<String> args) async {
}
} else if (args.isNotEmpty && args.first == '--cm') {
print("--cm started");
desktopType = DesktopType.cm;
await windowManager.ensureInitialized();
runConnectionManagerScreen();
} else {
desktopType = DesktopType.main;
await windowManager.ensureInitialized();
windowManager.setPreventClose(true);
runMainApp(true);