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/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/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 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) }