From c0390caa64293a221563fce75e1e5ed5ec9b2e93 Mon Sep 17 00:00:00 2001 From: Sorunome Date: Mon, 28 Sep 2020 15:14:16 +0200 Subject: [PATCH] fix: tapping on aliases not always working --- lib/utils/url_launcher.dart | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/utils/url_launcher.dart b/lib/utils/url_launcher.dart index 5603772b..1f99d657 100644 --- a/lib/utils/url_launcher.dart +++ b/lib/utils/url_launcher.dart @@ -39,7 +39,7 @@ class UrlLauncher { // we make the servers a set and later on convert to a list, so that we can easily // deduplicate servers added via alias lookup and query parameter var servers = {}; - if (room == null && roomIdOrAlias == '#') { + if (room == null && roomIdOrAlias.startsWith('#')) { // we were unable to find the room locally...so resolve it final response = await SimpleDialogs(context).tryRequestWithLoadingDialog( @@ -79,24 +79,23 @@ class UrlLauncher { if (roomIdOrAlias[0] == '!') { roomId = roomIdOrAlias; } - if (roomId == null) { - // we haven't found this room....so let's ignore it - return; - } if (await SimpleDialogs(context) .askConfirmation(titleText: 'Join room $roomIdOrAlias')) { final response = await SimpleDialogs(context).tryRequestWithLoadingDialog( matrix.client.joinRoomOrAlias( - Uri.encodeComponent(roomIdOrAlias), - servers: servers.toList(), + roomIdOrAlias, + servers: servers.isNotEmpty ? servers.toList() : null, ), ); if (response == false) return; + // wait for two seconds so that it probably came down /sync + await SimpleDialogs(context).tryRequestWithLoadingDialog( + Future.delayed(const Duration(seconds: 2))); await Navigator.pushAndRemoveUntil( context, AppRoute.defaultRoute( - context, ChatView(response['room_id'], scrollToEventId: event)), + context, ChatView(response, scrollToEventId: event)), (r) => r.isFirst, ); }