From 7b412bb8b970bd35d1337a7becf3e1451dea6c70 Mon Sep 17 00:00:00 2001 From: Krille Fear Date: Mon, 22 Nov 2021 19:19:18 +0100 Subject: [PATCH] feat: Open im.fluffychat uris --- lib/config/app_config.dart | 1 + lib/utils/url_launcher.dart | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/config/app_config.dart b/lib/config/app_config.dart index 76cb183f..1e53ef31 100644 --- a/lib/config/app_config.dart +++ b/lib/config/app_config.dart @@ -43,6 +43,7 @@ abstract class AppConfig { static const bool hideTypingUsernames = false; static const bool hideAllStateEvents = false; static const String inviteLinkPrefix = 'https://matrix.to/#/'; + static const String deepLinkPrefix = 'im.fluffychat://chat/'; static const String schemePrefix = 'matrix:'; static const String pushNotificationsChannelId = 'fluffychat_push'; static const String pushNotificationsChannelName = 'FluffyChat push channel'; diff --git a/lib/utils/url_launcher.dart b/lib/utils/url_launcher.dart index 8b04a67c..05f81e94 100644 --- a/lib/utils/url_launcher.dart +++ b/lib/utils/url_launcher.dart @@ -20,7 +20,8 @@ class UrlLauncher { const UrlLauncher(this.context, this.url); void launchUrl() { - if (url.toLowerCase().startsWith(AppConfig.inviteLinkPrefix) || + if (url.toLowerCase().startsWith(AppConfig.deepLinkPrefix) || + url.toLowerCase().startsWith(AppConfig.inviteLinkPrefix) || {'#', '@', '!', '+', '\$'}.contains(url[0]) || url.toLowerCase().startsWith(AppConfig.schemePrefix)) { return openMatrixToUrl();