From 260d2b61cdb6b0e4318bc1bd59b4e2deef86d2a5 Mon Sep 17 00:00:00 2001
From: Bruno Windels <brunow@element.io>
Date: Fri, 5 Feb 2021 13:00:26 +0100
Subject: [PATCH] don't use trusted web instance for iOS

as it only intercepts the default app.element.io
---
 src/open/clients/Element.js | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/open/clients/Element.js b/src/open/clients/Element.js
index a3d3830..6993b9e 100644
--- a/src/open/clients/Element.js
+++ b/src/open/clients/Element.js
@@ -62,9 +62,12 @@ export class Element {
 				fragmentPath = `room/${link.identifier}/${link.eventId}`;
 				break;
 		}
-		if (platform === Platform.DesktopWeb || platform === Platform.MobileWeb || platform === Platform.iOS) {
+        const isWebPlatform = platform === Platform.DesktopWeb || platform === Platform.MobileWeb;
+		if (isWebPlatform || platform === Platform.iOS) {
             let instanceHost = trustedWebInstances[0];
-            if (trustedWebInstances.includes(link.webInstances[this.id])) {
+            // we use app.element.io which iOS will intercept, but it likely won't intercept any other trusted instances
+            // so only use a preferred web instance for true web links.
+            if (isWebPlatform && trustedWebInstances.includes(link.webInstances[this.id])) {
                 instanceHost = link.webInstances[this.id];
             }
 			return `https://${instanceHost}/#/${fragmentPath}`;
-- 
GitLab