Skip to content
Snippets Groups Projects
Commit 96f84a46 authored by Dariusz Rybicki's avatar Dariusz Rybicki
Browse files

Merge branch 'dev/cleanup' into integration

parents 1da48fa3 8a1d2d97
No related branches found
No related tags found
1 merge request!13Update Bindings
{
"pins" : [
{
"identity" : "combine-schedulers",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/combine-schedulers",
"state" : {
"revision" : "4cf088c29a20f52be0f2ca54992b492c54e0076b",
"version" : "0.5.3"
}
},
{
"identity" : "keychainaccess",
"kind" : "remoteSourceControl",
"location" : "https://github.com/kishikawakatsumi/KeychainAccess.git",
"state" : {
"revision" : "84e546727d66f1adc5439debad16270d0fdd04e7",
"version" : "4.2.2"
}
},
{
"identity" : "swift-case-paths",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-case-paths",
"state" : {
"revision" : "ce9c0d897db8a840c39de64caaa9b60119cf4be8",
"version" : "0.8.1"
}
},
{
"identity" : "swift-collections",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections",
"state" : {
"revision" : "48254824bb4248676bf7ce56014ff57b142b77eb",
"version" : "1.0.2"
}
},
{
"identity" : "swift-composable-architecture",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-composable-architecture.git",
"state" : {
"revision" : "c307541328a636b9e8e25ac868d89be54a8f8dbf",
"version" : "0.35.0"
}
},
{
"identity" : "swift-composable-presentation",
"kind" : "remoteSourceControl",
"location" : "https://github.com/darrarski/swift-composable-presentation.git",
"state" : {
"revision" : "1f4d17fae1f7ed41cbed17929083190fd9a78ee6",
"version" : "0.5.2"
}
},
{
"identity" : "swift-custom-dump",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-custom-dump",
"state" : {
"revision" : "c4f78db9b90ca57b7b6abc2223e235242739ea3c",
"version" : "0.4.0"
}
},
{
"identity" : "swift-identified-collections",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-identified-collections",
"state" : {
"revision" : "2d6b7ffcc67afd9077fac5e5a29bcd6d39b71076",
"version" : "0.4.0"
}
},
{
"identity" : "swiftui-app-icon-creator",
"kind" : "remoteSourceControl",
"location" : "https://github.com/darrarski/swiftui-app-icon-creator.git",
"state" : {
"revision" : "f0c7ba4e66d3dc8135ccf9146afc05f9dff3c4ff",
"version" : "1.2.0"
}
},
{
"identity" : "xctest-dynamic-overlay",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/xctest-dynamic-overlay",
"state" : {
"revision" : "50a70a9d3583fe228ce672e8923010c8df2deddd",
"version" : "0.2.1"
}
}
],
"version" : 2
}
......@@ -15,17 +15,17 @@ public struct ConnectionMaker {
extension ConnectionMaker {
public static func live(bindingsClient: BindingsClient) -> ConnectionMaker {
ConnectionMaker { withAuthentication, recipientContact, myIdentity in
if !withAuthentication {
if withAuthentication {
return Connection.live(
bindingsConnection: try bindingsClient.connect(
recipientContact,
bindingsAuthenticatedConnection: try bindingsClient.connect(
withAuthentication: recipientContact,
myIdentity: myIdentity
)
)
} else {
return Connection.live(
bindingsAuthenticatedConnection: try bindingsClient.connect(
withAuthentication: recipientContact,
bindingsConnection: try bindingsClient.connect(
recipientContact,
myIdentity: myIdentity
)
)
......
......@@ -2,9 +2,9 @@ import Foundation
public struct MessageSendReport: Equatable {
public init(
roundList: [Int],
messageId: Data,
timestamp: Int
roundList: [Int]?,
messageId: Data?,
timestamp: Int?
) {
self.roundList = roundList
self.messageId = messageId
......@@ -22,18 +22,4 @@ extension MessageSendReport: Codable {
case messageId = "MessageID"
case timestamp = "Timestamp"
}
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
messageId = try container.decodeIfPresent(Data.self, forKey: .messageId)
timestamp = try container.decodeIfPresent(Int.self, forKey: .timestamp)
roundList = try container.decodeIfPresent([Int].self, forKey: .roundList)
}
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(messageId, forKey: .messageId)
try container.encode(timestamp, forKey: .timestamp)
try container.encode(roundList, forKey: .roundList)
}
}
......@@ -34,14 +34,4 @@ extension RestlikeMessage: Codable {
case uri = "URI"
case error = "Error"
}
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
version = try container.decodeIfPresent(Int.self, forKey: .version)
headers = try container.decodeIfPresent(Data.self, forKey: .headers)
content = try container.decodeIfPresent(Data.self, forKey: .content)
method = try container.decodeIfPresent(Int.self, forKey: .method)
uri = try container.decodeIfPresent(String.self, forKey: .uri)
error = try container.decodeIfPresent(String.self, forKey: .error)
}
}
......@@ -6,9 +6,7 @@ final class MessageSendReportTests: XCTestCase {
func testCoding() throws {
let jsonString = """
{
"RoundList": {
"Rounds": [1,5,9]
},
"Rounds": [1,5,9],
"MessageID": "51Yy47uZbP0o2Y9B/kkreDLTB6opUol3M3mYiY2dcdQ=",
"Timestamp": 1653582683183384000
}
......@@ -31,4 +29,18 @@ final class MessageSendReportTests: XCTestCase {
XCTAssertNoDifference(decodedReport, report)
}
func testDecodeEmpty() throws {
let jsonString = "{}"
let jsonData = jsonString.data(using: .utf8)!
let decoder = JSONDecoder()
decoder.dataDecodingStrategy = .base64
let report = try decoder.decode(MessageSendReport.self, from: jsonData)
XCTAssertNoDifference(report, MessageSendReport(
roundList: nil,
messageId: nil,
timestamp: nil
))
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment