Swiftgram/TelegramCore/SavedStickerItem.swift
2017-08-15 14:45:34 +03:00

31 lines
992 B
Swift

import Foundation
#if os(macOS)
import PostboxMac
#else
import Postbox
#endif
public final class SavedStickerItem: OrderedItemListEntryContents, Equatable {
public let file: TelegramMediaFile
public let stringRepresentations: [String]
init(file: TelegramMediaFile, stringRepresentations: [String]) {
self.file = file
self.stringRepresentations = stringRepresentations
}
public init(decoder: Decoder) {
self.file = decoder.decodeObjectForKey("f") as! TelegramMediaFile
self.stringRepresentations = decoder.decodeStringArrayForKey("sr")
}
public func encode(_ encoder: Encoder) {
encoder.encodeObject(self.file, forKey: "f")
encoder.encodeStringArray(self.stringRepresentations, forKey: "sr")
}
public static func ==(lhs: SavedStickerItem, rhs: SavedStickerItem) -> Bool {
return lhs.file.isEqual(rhs.file) && lhs.stringRepresentations == rhs.stringRepresentations
}
}