From a29a507e090734597838fc2eabfcfb23692fba0d Mon Sep 17 00:00:00 2001 From: Artur Guseinov Date: Mon, 2 Oct 2023 21:45:46 +0800 Subject: [PATCH 1/3] Check cancellation after build subscriptions --- .../NotifyWatchSubscriptionsResponseSubscriber.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sources/WalletConnectNotify/Client/Wallet/ProtocolEngine/wc_notifyWatchSubscriptions/NotifyWatchSubscriptionsResponseSubscriber.swift b/Sources/WalletConnectNotify/Client/Wallet/ProtocolEngine/wc_notifyWatchSubscriptions/NotifyWatchSubscriptionsResponseSubscriber.swift index 04dfd9934..e96c8c614 100644 --- a/Sources/WalletConnectNotify/Client/Wallet/ProtocolEngine/wc_notifyWatchSubscriptions/NotifyWatchSubscriptionsResponseSubscriber.swift +++ b/Sources/WalletConnectNotify/Client/Wallet/ProtocolEngine/wc_notifyWatchSubscriptions/NotifyWatchSubscriptionsResponseSubscriber.swift @@ -43,6 +43,8 @@ class NotifyWatchSubscriptionsResponseSubscriber { let oldSubscriptions = notifyStorage.getSubscriptions() let newSubscriptions = try await notifySubscriptionsBuilder.buildSubscriptions(responsePayload.subscriptions) + try Task.checkCancellation() + logger.debug("number of subscriptions: \(newSubscriptions.count)") guard newSubscriptions != oldSubscriptions else {return} From 16e67795e1b24420ac67af91c8bf388eba50f7e6 Mon Sep 17 00:00:00 2001 From: Alexander Lisovik Date: Tue, 3 Oct 2023 11:42:29 +0400 Subject: [PATCH 2/3] Fix WalletConnectURI for macOS --- .../WalletConnectUtils/WalletConnectURI.swift | 39 +++++++++++-------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/Sources/WalletConnectUtils/WalletConnectURI.swift b/Sources/WalletConnectUtils/WalletConnectURI.swift index 91973f209..2e16a652d 100644 --- a/Sources/WalletConnectUtils/WalletConnectURI.swift +++ b/Sources/WalletConnectUtils/WalletConnectURI.swift @@ -1,7 +1,6 @@ -import UIKit +import Foundation public struct WalletConnectURI: Equatable { - public let topic: String public let version: String public let symKey: String @@ -51,20 +50,6 @@ public struct WalletConnectURI: Equatable { } return nil } - - public init?(connectionOptions: UIScene.ConnectionOptions) { - if let uri = connectionOptions.urlContexts.first?.url.query?.replacingOccurrences(of: "uri=", with: "") { - self.init(string: uri) - } - return nil - } - - public init?(urlContext: UIOpenURLContext) { - if let uri = urlContext.url.query?.replacingOccurrences(of: "uri=", with: "") { - self.init(string: uri) - } - return nil - } private var relayQuery: String { var query = "relay-protocol=\(relay.protocol)" @@ -82,3 +67,25 @@ public struct WalletConnectURI: Equatable { return URLComponents(string: urlString) } } + +#if canImport(UIKit) + +import UIKit + +extension WalletConnectURI { + public init?(connectionOptions: UIScene.ConnectionOptions) { + if let uri = connectionOptions.urlContexts.first?.url.query?.replacingOccurrences(of: "uri=", with: "") { + self.init(string: uri) + } + return nil + } + + public init?(urlContext: UIOpenURLContext) { + if let uri = urlContext.url.query?.replacingOccurrences(of: "uri=", with: "") { + self.init(string: uri) + } + return nil + } +} + +#endif From 4931b29a4122f3f5a4c327ba795f5b788c8b60e4 Mon Sep 17 00:00:00 2001 From: alexander-lsvk Date: Tue, 3 Oct 2023 10:17:23 +0000 Subject: [PATCH 3/3] Set User Agent --- Sources/WalletConnectRelay/PackageConfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/WalletConnectRelay/PackageConfig.json b/Sources/WalletConnectRelay/PackageConfig.json index 9c34e0b9a..383bc8548 100644 --- a/Sources/WalletConnectRelay/PackageConfig.json +++ b/Sources/WalletConnectRelay/PackageConfig.json @@ -1 +1 @@ -{"version": "1.8.5"} +{"version": "1.8.6"}