From 804fa0eb888d95d4447654b01b649563f6453f3e Mon Sep 17 00:00:00 2001 From: Dariusz Rybicki <dariusz@elixxir.io> Date: Thu, 8 Sep 2022 22:45:43 +0200 Subject: [PATCH] Update BroadcastMessage model --- Sources/XXClient/Models/BroadcastMessage.swift | 4 ++++ Tests/XXClientTests/Models/BroadcastMessageTests.swift | 3 +++ 2 files changed, 7 insertions(+) diff --git a/Sources/XXClient/Models/BroadcastMessage.swift b/Sources/XXClient/Models/BroadcastMessage.swift index 19f31183..3d4520bf 100644 --- a/Sources/XXClient/Models/BroadcastMessage.swift +++ b/Sources/XXClient/Models/BroadcastMessage.swift @@ -4,15 +4,18 @@ public struct BroadcastMessage: Equatable { public init( roundId: Int, ephId: [Int], + roundURL: String, payload: Data ) { self.roundId = roundId self.ephId = ephId + self.roundURL = roundURL self.payload = payload } public var roundId: Int public var ephId: [Int] + public var roundURL: String public var payload: Data } @@ -20,6 +23,7 @@ extension BroadcastMessage: Codable { enum CodingKeys: String, CodingKey { case roundId = "RoundID" case ephId = "EphID" + case roundURL = "RoundURL" case payload = "Payload" } diff --git a/Tests/XXClientTests/Models/BroadcastMessageTests.swift b/Tests/XXClientTests/Models/BroadcastMessageTests.swift index 13c676ec..c0b0fa8a 100644 --- a/Tests/XXClientTests/Models/BroadcastMessageTests.swift +++ b/Tests/XXClientTests/Models/BroadcastMessageTests.swift @@ -6,11 +6,13 @@ final class BroadcastMessageTests: XCTestCase { func testCoding() throws { let roundId: Int = 42 let ephId: [Int] = [0, 0, 0, 0, 0, 0, 24, 61] + let roundURL = "https://dashboard.xx.network/rounds/25?xxmessenger=true" let payloadB64 = "SGVsbG8sIGJyb2FkY2FzdCBmcmllbmRzIQ==" let jsonString = """ { "RoundID": \(roundId), "EphID": [\(ephId.map { "\($0)" }.joined(separator: ", "))], + "RoundURL": "\(roundURL)", "Payload": "\(payloadB64)" } """ @@ -20,6 +22,7 @@ final class BroadcastMessageTests: XCTestCase { XCTAssertNoDifference(model, BroadcastMessage( roundId: roundId, ephId: ephId, + roundURL: roundURL, payload: Data(base64Encoded: payloadB64)! )) -- GitLab