From 61388a728c3972ca32d73124def313e99f99f3ec Mon Sep 17 00:00:00 2001 From: rommex Date: Tue, 23 Jan 2024 19:20:47 +0200 Subject: [PATCH 1/2] updated prefix to 'unstoppabledomains' --- unstoppable-ios-app/Dev-Env-Info.plist | 4 ++-- unstoppable-ios-app/domains-manager-ios/Info.plist | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/unstoppable-ios-app/Dev-Env-Info.plist b/unstoppable-ios-app/Dev-Env-Info.plist index 183cddda1..fdd91ae25 100644 --- a/unstoppable-ios-app/Dev-Env-Info.plist +++ b/unstoppable-ios-app/Dev-Env-Info.plist @@ -27,7 +27,7 @@ com.unstoppabledomains.manager CFBundleURLSchemes - unstoppable + unstoppabledomains @@ -53,7 +53,7 @@ kleverwallet mathwallet metamask - rainbow + rainbow okex celo zel diff --git a/unstoppable-ios-app/domains-manager-ios/Info.plist b/unstoppable-ios-app/domains-manager-ios/Info.plist index af74b7bec..243ea7062 100644 --- a/unstoppable-ios-app/domains-manager-ios/Info.plist +++ b/unstoppable-ios-app/domains-manager-ios/Info.plist @@ -27,7 +27,7 @@ com.unstoppabledomains.manager CFBundleURLSchemes - unstoppable + unstoppabledomains @@ -56,7 +56,7 @@ mathwallet metamask rainbow - okex + okex celo zel fuse.cash From b2e07e112cddf320753389cb2149127deee1148c Mon Sep 17 00:00:00 2001 From: rommex Date: Tue, 23 Jan 2024 21:46:16 +0200 Subject: [PATCH 2/2] parsing native links with wc url --- .../domains-manager-ios/Extensions/String.swift | 7 +++++++ .../Services/DeepLinksService/DeepLinksService.swift | 11 ++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/unstoppable-ios-app/domains-manager-ios/Extensions/String.swift b/unstoppable-ios-app/domains-manager-ios/Extensions/String.swift index d41abc7a4..4abc2c2dc 100644 --- a/unstoppable-ios-app/domains-manager-ios/Extensions/String.swift +++ b/unstoppable-ios-app/domains-manager-ios/Extensions/String.swift @@ -118,3 +118,10 @@ extension String { return self } } + +extension String { + func deletingPrefix(_ prefix: String) -> String? { + guard self.hasPrefix(prefix) else { return nil } + return String(self.dropFirst(prefix.count)) + } +} diff --git a/unstoppable-ios-app/domains-manager-ios/Services/DeepLinksService/DeepLinksService.swift b/unstoppable-ios-app/domains-manager-ios/Services/DeepLinksService/DeepLinksService.swift index 1daf2c40a..621966295 100644 --- a/unstoppable-ios-app/domains-manager-ios/Services/DeepLinksService/DeepLinksService.swift +++ b/unstoppable-ios-app/domains-manager-ios/Services/DeepLinksService/DeepLinksService.swift @@ -14,6 +14,7 @@ final class DeepLinksService { private var listeners: [DeepLinkListenerHolder] = [] private let deepLinkPath = "/mobile" private let wcScheme = "wc" + private let customURLScheme = "unstoppabledomains" private var isExpectingWCInteraction = false init(externalEventsService: ExternalEventsServiceProtocol, @@ -158,12 +159,16 @@ private extension DeepLinksService { func isWCDeepLinkUrl(from components: NSURLComponents) -> Bool { (components.path == deepLinkPath) || (components.path == (deepLinkPath + "/" + wcScheme)) || - (components.scheme == wcScheme) + (components.scheme == wcScheme) || (components.scheme == customURLScheme) } func parseWalletConnectURL(from components: NSURLComponents, in url: URL) -> URL? { - if components.scheme == wcScheme { + if components.scheme == wcScheme{ return url + } else if (components.scheme == customURLScheme), + let query = components.query, + let urlExtracted = query.deletingPrefix("uri=") { + return URL(string: urlExtracted) } else if isWCDeepLinkUrl(from: components), let params = components.queryItems, let uri = params.findValue(forDeepLinkKey: DeepLinksParameterKey.uri), @@ -172,7 +177,7 @@ private extension DeepLinksService { } return nil } - + func handleWCDeepLink(_ incomingURL: URL, receivedState: ExternalEventReceivedState) { externalEventsService.receiveEvent(.wcDeepLink(incomingURL), receivedState: receivedState) }