From 7d22769049ef4bfe5a37800d87ed7ff594001e79 Mon Sep 17 00:00:00 2001
From: Bruno Muniz Azevedo Filho <bruno@elixxir.io>
Date: Wed, 3 Aug 2022 19:30:43 -0300
Subject: [PATCH] Update universal link

---
 App/client-ios/Resources/client-ios.entitlements   |  2 +-
 Sources/App/AppDelegate.swift                      |  4 ++--
 Sources/MenuFeature/ViewModels/MenuViewModel.swift |  2 +-
 Tests/AppTests/General/InvitationTests.swift       | 14 +++++++-------
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/App/client-ios/Resources/client-ios.entitlements b/App/client-ios/Resources/client-ios.entitlements
index c5460225..8e8b5bf0 100644
--- a/App/client-ios/Resources/client-ios.entitlements
+++ b/App/client-ios/Resources/client-ios.entitlements
@@ -6,7 +6,7 @@
 	<string>development</string>
 	<key>com.apple.developer.associated-domains</key>
 	<array>
-		<string>applinks:xx.network</string>
+		<string>applinks:elixxir.io</string>
 	</array>
 	<key>com.apple.developer.icloud-container-identifiers</key>
 	<array>
diff --git a/Sources/App/AppDelegate.swift b/Sources/App/AppDelegate.swift
index 40780f6f..4143a5f2 100644
--- a/Sources/App/AppDelegate.swift
+++ b/Sources/App/AppDelegate.swift
@@ -165,8 +165,8 @@ public class AppDelegate: UIResponder, UIApplicationDelegate {
 func getUsernameFromInvitationDeepLink(_ url: URL) -> String? {
     if let components = URLComponents(url: url, resolvingAgainstBaseURL: false),
        components.scheme == "https",
-       components.host == "xx.network",
-       components.path == "/messenger/invitation",
+       components.host == "elixxir.io",
+       components.path == "/connect",
        let queryItem = components.queryItems?.first(where: { $0.name == "username" }),
        let username = queryItem.value {
         return username
diff --git a/Sources/MenuFeature/ViewModels/MenuViewModel.swift b/Sources/MenuFeature/ViewModels/MenuViewModel.swift
index 20a9ebd2..b4ebd757 100644
--- a/Sources/MenuFeature/ViewModels/MenuViewModel.swift
+++ b/Sources/MenuFeature/ViewModels/MenuViewModel.swift
@@ -42,6 +42,6 @@ final class MenuViewModel {
     }
 
     var referralDeeplink: String {
-        "https://xx.network/messenger/invitation?username=\(username)"
+        "https://elixxir.io/connect?username=\(username)"
     }
 }
diff --git a/Tests/AppTests/General/InvitationTests.swift b/Tests/AppTests/General/InvitationTests.swift
index d29258e3..220f92a8 100644
--- a/Tests/AppTests/General/InvitationTests.swift
+++ b/Tests/AppTests/General/InvitationTests.swift
@@ -5,31 +5,31 @@ import XCTest
 final class AppDelegateTests: XCTestCase {
     func test_invitationUniversalLink() {
         XCTAssertNil(getUsernameFromInvitationDeepLink(
-            URL(string: "https://xx.network/messenger/invite?username=some")!
+            URL(string: "https://elixxir.io/connecting?username=some")!
         ))
 
         XCTAssertNil(getUsernameFromInvitationDeepLink(
-            URL(string: "http://xx.network/messenger/invitation?username=some")!
+            URL(string: "http://elixxir.io/connect?username=some")!
         ))
 
         XCTAssertNil(getUsernameFromInvitationDeepLink(
-            URL(string: "https://network.xx/messenger/invitation?username=some")!
+            URL(string: "https://io.elixxir/connect?username=some")!
         ))
 
         XCTAssertEqual(getUsernameFromInvitationDeepLink(
-            URL(string: "https://xx.network/messenger/invitation?username=brad")!
+            URL(string: "https://elixxir.io/connect?username=brad")!
         ), "brad")
 
         XCTAssertNil(getUsernameFromInvitationDeepLink(
-            URL(string: "https://xx.network/messenger/invitation?password=value")!
+            URL(string: "https://elixxir.io/connect?password=value")!
         ))
 
         XCTAssertNil(getUsernameFromInvitationDeepLink(
-            URL(string: "https://xx.network/xxmessenger/invitation?username=some")!
+            URL(string: "https://elixxir.io/connect?usernamer=some")!
         ))
 
         XCTAssertNotEqual(getUsernameFromInvitationDeepLink(
-            URL(string: "https://xx.network/messenger/invitation?username=anderson")!
+            URL(string: "https://elixxir.io/connect?username=anderson")!
         ), "silva")
     }
 }
-- 
GitLab