From 1365df898fd7af2eba7d5728adf1761574e6ab24 Mon Sep 17 00:00:00 2001 From: Sahil Yeole Date: Fri, 3 Nov 2023 18:31:30 +0530 Subject: [PATCH] support connect, play & file-transfer on mobile uri Signed-off-by: Sahil Yeole --- flutter/lib/common.dart | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/flutter/lib/common.dart b/flutter/lib/common.dart index 1211f304b..4d23614ca 100644 --- a/flutter/lib/common.dart +++ b/flutter/lib/common.dart @@ -1955,6 +1955,7 @@ bool handleUriLink({List? cmdArgs, Uri? uri, String? uriString}) { List? urlLinkToCmdArgs(Uri uri) { String? command; String? id; + final options = ["connect", "play", "file-transfer", "port-forward", "rdp"]; if (uri.authority.isEmpty && uri.path.split('').every((char) => char == '/')) { return []; @@ -1962,12 +1963,20 @@ List? urlLinkToCmdArgs(Uri uri) { // For compatibility command = '--connect'; id = uri.path.substring("/new/".length); - } else if (['connect', "play", 'file-transfer', 'port-forward', 'rdp'] - .contains(uri.authority) && !isMobile) { + } else if (options.contains(uri.authority)) { + final optionIndex = options.indexOf(uri.authority); command = '--${uri.authority}'; if (uri.path.length > 1) { id = uri.path.substring(1); } + if (isMobile && id != null) { + if (optionIndex == 0 || optionIndex == 1) { + connect(Get.context!, id); + } else if (optionIndex == 2) { + connect(Get.context!, id, isFileTransfer: true); + } + return null; + } } else if (uri.authority.length > 2 && uri.path.length <= 1) { // rustdesk:// command = '--connect';