diff --git a/Sources/WalletConnectRelay/Dispatching.swift b/Sources/WalletConnectRelay/Dispatching.swift index 1dee272d..118bf7cf 100644 --- a/Sources/WalletConnectRelay/Dispatching.swift +++ b/Sources/WalletConnectRelay/Dispatching.swift @@ -6,7 +6,6 @@ protocol Dispatching { var isSocketConnected: Bool { get } var networkConnectionStatusPublisher: AnyPublisher { get } var socketConnectionStatusPublisher: AnyPublisher { get } - func send(_ string: String, completion: @escaping (Error?) -> Void) func protectedSend(_ string: String, completion: @escaping (Error?) -> Void) func protectedSend(_ string: String) async throws func connect() throws @@ -58,11 +57,7 @@ final class Dispatcher: NSObject, Dispatching { setUpWebSocketSession() } - func send(_ string: String, completion: @escaping (Error?) -> Void) { - guard socket.isConnected else { - completion(NetworkError.connectionFailed) - return - } + private func send(_ string: String, completion: @escaping (Error?) -> Void) { socket.write(string: string) { completion(nil) } diff --git a/Sources/WalletConnectRelay/PackageConfig.json b/Sources/WalletConnectRelay/PackageConfig.json index 3c29341a..c10a76ab 100644 --- a/Sources/WalletConnectRelay/PackageConfig.json +++ b/Sources/WalletConnectRelay/PackageConfig.json @@ -1 +1 @@ -{"version": "1.0.0"} +{"version": "1.0.1"} diff --git a/Sources/WalletConnectRelay/SocketConnectionHandler/AutomaticSocketConnectionHandler.swift b/Sources/WalletConnectRelay/SocketConnectionHandler/AutomaticSocketConnectionHandler.swift index 15a90d81..81eab614 100644 --- a/Sources/WalletConnectRelay/SocketConnectionHandler/AutomaticSocketConnectionHandler.swift +++ b/Sources/WalletConnectRelay/SocketConnectionHandler/AutomaticSocketConnectionHandler.swift @@ -318,6 +318,7 @@ extension AutomaticSocketConnectionHandler: SocketConnectionHandler { isConnecting = false handleFailedConnectionAndReconnectIfNeeded() // Trigger reconnection } + logger.debug("Will throw an error \(NetworkError.connectionFailed)") continuation.resume(throwing: NetworkError.connectionFailed) } } diff --git a/Tests/RelayerTests/DispatcherTests.swift b/Tests/RelayerTests/DispatcherTests.swift index 3b41c460..91c1eb2c 100644 --- a/Tests/RelayerTests/DispatcherTests.swift +++ b/Tests/RelayerTests/DispatcherTests.swift @@ -51,7 +51,7 @@ final class DispatcherTests: XCTestCase { func testSendWhileConnected() { try! sut.connect() - sut.send("1") {_ in} + sut.protectedSend("1") {_ in} XCTAssertEqual(webSocket.sendCallCount, 1) } diff --git a/reown-swift.podspec b/reown-swift.podspec index f95d1ccf..3e22ab77 100644 --- a/reown-swift.podspec +++ b/reown-swift.podspec @@ -25,7 +25,7 @@ Pod::Spec.new do |spec| spec.default_subspecs = 'WalletKit' spec.subspec 'WalletKit' do |ss| - ss.source_files = 'Sources/WalletKit/**/*.{h,m,swift}' + ss.source_files = 'Sources/ReownWalletKit/**/*.{h,m,swift}' ss.dependency 'reown-swift/WalletConnectSign' ss.dependency 'reown-swift/WalletConnectPush' ss.dependency 'reown-swift/WalletConnectVerify'