Skip to content

Commit

Permalink
PR fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-lsvk committed Aug 10, 2023
1 parent 0c794f4 commit e7b5a7c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Sources/HTTPClient/HTTPNetworkClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Foundation

public actor HTTPNetworkClient: HTTPClient {

var host: String
private var host: String

private let session: URLSession

Expand Down
18 changes: 7 additions & 11 deletions Sources/WalletConnectEcho/Register/EchoRegisterService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,14 @@ actor EchoRegisterService {
let clientIdMutlibase = try DIDKey(did: clientId).multibase(variant: .ED25519)
logger.debug("APNS device token: \(token)")

do {
let response = try await httpClient.request(
EchoResponse.self,
at: EchoAPI.register(clientId: clientIdMutlibase, token: token, projectId: projectId, environment: environment, auth: echoAuthToken)
)
guard response.status == .success else {
throw Errors.registrationFailed
}
logger.debug("Successfully registered at Echo Server")
} catch {
throw error
let response = try await httpClient.request(
EchoResponse.self,
at: EchoAPI.register(clientId: clientIdMutlibase, token: token, projectId: projectId, environment: environment, auth: echoAuthToken)
)
guard response.status == .success else {
throw Errors.registrationFailed
}
logger.debug("Successfully registered at Echo Server")
}

func echoHostFallback() async {
Expand Down
5 changes: 4 additions & 1 deletion Tests/TestingUtils/Mocks/HTTPClientMock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import Foundation
@testable import HTTPClient

public final class HTTPClientMock<T: Decodable>: HTTPClient {

private let object: T

public init(object: T) {
Expand All @@ -16,4 +15,8 @@ public final class HTTPClientMock<T: Decodable>: HTTPClient {
public func request(service: HTTPService) async throws {

}

public func updateHost(host: String) async {

}
}

0 comments on commit e7b5a7c

Please sign in to comment.