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

Update Message model

parent f24b573c
No related branches found
No related tags found
2 merge requests!102Release 1.0.0,!79Update Bindings
......@@ -10,7 +10,8 @@ public struct Message: Equatable {
ephemeralId: Int,
timestamp: Int,
encrypted: Bool,
roundId: Int
roundId: Int,
roundURL: String
) {
self.messageType = messageType
self.id = id
......@@ -21,6 +22,7 @@ public struct Message: Equatable {
self.timestamp = timestamp
self.encrypted = encrypted
self.roundId = roundId
self.roundURL = roundURL
}
public var messageType: Int
......@@ -32,6 +34,7 @@ public struct Message: Equatable {
public var timestamp: Int
public var encrypted: Bool
public var roundId: Int
public var roundURL: String
}
extension Message: Codable {
......@@ -45,6 +48,7 @@ extension Message: Codable {
case timestamp = "Timestamp"
case encrypted = "Encrypted"
case roundId = "RoundId"
case roundURL = "RoundURL"
}
public static func decode(_ data: Data) throws -> Self {
......
......@@ -13,6 +13,7 @@ final class MessageTests: XCTestCase {
let timestamp: Int = 1_653_580_439_357_351_000
let encrypted = false
let roundId: Int = 19
let roundURL = "https://dashboard.xx.network/rounds/25?xxmessenger=true"
let jsonString = """
{
"MessageType": \(type),
......@@ -23,7 +24,8 @@ final class MessageTests: XCTestCase {
"EphemeralID": \(ephemeralId),
"Timestamp": \(timestamp),
"Encrypted": \(encrypted),
"RoundId": \(roundId)
"RoundId": \(roundId),
"RoundURL": "\(roundURL)"
}
"""
let jsonData = jsonString.data(using: .utf8)!
......@@ -38,7 +40,8 @@ final class MessageTests: XCTestCase {
ephemeralId: ephemeralId,
timestamp: timestamp,
encrypted: encrypted,
roundId: roundId
roundId: roundId,
roundURL: roundURL
))
let encodedModel = try model.encode()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment