From 12f8b267016608ca655d104d5ce67c308e108f07 Mon Sep 17 00:00:00 2001
From: Diego Mello <diegolmello@gmail.com>
Date: Fri, 1 Jun 2018 18:57:05 -0300
Subject: [PATCH] [FIX] iOS Universal links (#318)

---
 app/sagas/deepLinking.js                   | 10 ++++++++++
 ios/RocketChatRN/Info.plist                |  1 -
 ios/RocketChatRN/RocketChatRN.entitlements |  4 ++++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/app/sagas/deepLinking.js b/app/sagas/deepLinking.js
index 59b3e7d2f..9cd2d57f5 100644
--- a/app/sagas/deepLinking.js
+++ b/app/sagas/deepLinking.js
@@ -31,8 +31,18 @@ const handleOpen = function* handleOpen({ params }) {
 		yield take(types.APP.READY);
 	}
 
+	if (!params.host) {
+		return;
+	}
+
 	const host = `https://${ params.host }`;
 
+	try {
+		yield RocketChat.testServer(host);
+	} catch (error) {
+		return;
+	}
+
 	// TODO: needs better test
 	// if deep link is from same server
 	if (server === host) {
diff --git a/ios/RocketChatRN/Info.plist b/ios/RocketChatRN/Info.plist
index accf9760b..9f7b25264 100644
--- a/ios/RocketChatRN/Info.plist
+++ b/ios/RocketChatRN/Info.plist
@@ -30,7 +30,6 @@
 			<key>CFBundleURLSchemes</key>
 			<array>
 				<string>rocketchat</string>
-				<string>https://go.rocket.chat</string>
 			</array>
 		</dict>
 	</array>
diff --git a/ios/RocketChatRN/RocketChatRN.entitlements b/ios/RocketChatRN/RocketChatRN.entitlements
index 903def2af..1484e4f68 100644
--- a/ios/RocketChatRN/RocketChatRN.entitlements
+++ b/ios/RocketChatRN/RocketChatRN.entitlements
@@ -4,5 +4,9 @@
 <dict>
 	<key>aps-environment</key>
 	<string>development</string>
+	<key>com.apple.developer.associated-domains</key>
+	<array>
+		<string>applinks:go.rocket.chat</string>
+	</array>
 </dict>
 </plist>
-- 
GitLab