simplify uri

This commit is contained in:
rustdesk 2023-06-09 21:36:12 +08:00
parent ee5c656e22
commit 1ad5d0b726

View File

@ -1598,18 +1598,25 @@ bool parseRustdeskUri(String uriPath) {
bool callUniLinksUriHandler(Uri uri) { bool callUniLinksUriHandler(Uri uri) {
debugPrint("uni links called: $uri"); debugPrint("uni links called: $uri");
// new connection // new connection
String peerId;
if (uri.authority == "connection" && uri.path.startsWith("/new/")) { if (uri.authority == "connection" && uri.path.startsWith("/new/")) {
final peerId = uri.path.substring("/new/".length); peerId = uri.path.substring("/new/".length);
var param = uri.queryParameters; } else if (uri.authority == "connect") {
String? switch_uuid = param["switch_uuid"]; peerId = uri.path.substring(1);
String? password = param["password"]; } else if (uri.authority.length > 2 && uri.path.length <= 1) {
Future.delayed(Duration.zero, () { // "/" or ""
rustDeskWinManager.newRemoteDesktop(peerId, peerId = uri.authority;
password: password, switch_uuid: switch_uuid); } else {
}); return false;
return true;
} }
return false; var param = uri.queryParameters;
String? switch_uuid = param["switch_uuid"];
String? password = param["password"];
Future.delayed(Duration.zero, () {
rustDeskWinManager.newRemoteDesktop(peerId,
password: password, switch_uuid: switch_uuid);
});
return true;
} }
connectMainDesktop(String id, connectMainDesktop(String id,