@@ -108,7 +108,7 @@ public struct MTMessage: Codable {
108108
109109public struct MTAttachment : Codable {
110110
111- public var id , filename , contentType , disposition : String
111+ public var localId , filename , contentType , disposition : String
112112 public let transferEncoding : String
113113 public let related : Bool
114114 public let size : Int
@@ -122,7 +122,7 @@ public struct MTAttachment: Codable {
122122 related: Bool ,
123123 size: Int ,
124124 downloadURL: String ) {
125- self . id = id
125+ self . localId = id
126126 self . filename = filename
127127 self . contentType = contentType
128128 self . disposition = disposition
@@ -133,8 +133,10 @@ public struct MTAttachment: Codable {
133133 }
134134
135135 enum CodingKeys : String , CodingKey {
136- case id, filename, contentType, disposition, transferEncoding, related, size
136+ // Server returned ID is not unique. Still we save the returned ID for other purposes.
137+ case localId = " id "
137138 case downloadURL = " downloadUrl "
139+ case filename, contentType, disposition, transferEncoding, related, size
138140 }
139141}
140142
@@ -178,6 +180,10 @@ extension MTMessage: Hashable, Identifiable {
178180}
179181
180182extension MTAttachment : Hashable , Identifiable {
183+
184+ public var id : Int {
185+ hashValue
186+ }
181187
182188 public static func == ( lhs: MTAttachment , rhs: MTAttachment ) -> Bool {
183189 lhs. id == rhs. id
0 commit comments