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 { ...@@ -10,7 +10,8 @@ public struct Message: Equatable {
ephemeralId: Int, ephemeralId: Int,
timestamp: Int, timestamp: Int,
encrypted: Bool, encrypted: Bool,
roundId: Int roundId: Int,
roundURL: String
) { ) {
self.messageType = messageType self.messageType = messageType
self.id = id self.id = id
...@@ -21,6 +22,7 @@ public struct Message: Equatable { ...@@ -21,6 +22,7 @@ public struct Message: Equatable {
self.timestamp = timestamp self.timestamp = timestamp
self.encrypted = encrypted self.encrypted = encrypted
self.roundId = roundId self.roundId = roundId
self.roundURL = roundURL
} }
public var messageType: Int public var messageType: Int
...@@ -32,6 +34,7 @@ public struct Message: Equatable { ...@@ -32,6 +34,7 @@ public struct Message: Equatable {
public var timestamp: Int public var timestamp: Int
public var encrypted: Bool public var encrypted: Bool
public var roundId: Int public var roundId: Int
public var roundURL: String
} }
extension Message: Codable { extension Message: Codable {
...@@ -45,6 +48,7 @@ extension Message: Codable { ...@@ -45,6 +48,7 @@ extension Message: Codable {
case timestamp = "Timestamp" case timestamp = "Timestamp"
case encrypted = "Encrypted" case encrypted = "Encrypted"
case roundId = "RoundId" case roundId = "RoundId"
case roundURL = "RoundURL"
} }
public static func decode(_ data: Data) throws -> Self { public static func decode(_ data: Data) throws -> Self {
......
...@@ -13,6 +13,7 @@ final class MessageTests: XCTestCase { ...@@ -13,6 +13,7 @@ final class MessageTests: XCTestCase {
let timestamp: Int = 1_653_580_439_357_351_000 let timestamp: Int = 1_653_580_439_357_351_000
let encrypted = false let encrypted = false
let roundId: Int = 19 let roundId: Int = 19
let roundURL = "https://dashboard.xx.network/rounds/25?xxmessenger=true"
let jsonString = """ let jsonString = """
{ {
"MessageType": \(type), "MessageType": \(type),
...@@ -23,7 +24,8 @@ final class MessageTests: XCTestCase { ...@@ -23,7 +24,8 @@ final class MessageTests: XCTestCase {
"EphemeralID": \(ephemeralId), "EphemeralID": \(ephemeralId),
"Timestamp": \(timestamp), "Timestamp": \(timestamp),
"Encrypted": \(encrypted), "Encrypted": \(encrypted),
"RoundId": \(roundId) "RoundId": \(roundId),
"RoundURL": "\(roundURL)"
} }
""" """
let jsonData = jsonString.data(using: .utf8)! let jsonData = jsonString.data(using: .utf8)!
...@@ -38,7 +40,8 @@ final class MessageTests: XCTestCase { ...@@ -38,7 +40,8 @@ final class MessageTests: XCTestCase {
ephemeralId: ephemeralId, ephemeralId: ephemeralId,
timestamp: timestamp, timestamp: timestamp,
encrypted: encrypted, encrypted: encrypted,
roundId: roundId roundId: roundId,
roundURL: roundURL
)) ))
let encodedModel = try model.encode() 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