|
|
@ -8,6 +8,9 @@ public final class VisibleMessage : Message {
|
|
|
|
public var contact: Contact?
|
|
|
|
public var contact: Contact?
|
|
|
|
public var profile: Profile?
|
|
|
|
public var profile: Profile?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// MARK: Initialization
|
|
|
|
|
|
|
|
public override init() { super.init() }
|
|
|
|
|
|
|
|
|
|
|
|
// MARK: Coding
|
|
|
|
// MARK: Coding
|
|
|
|
public required init?(coder: NSCoder) {
|
|
|
|
public required init?(coder: NSCoder) {
|
|
|
|
super.init(coder: coder)
|
|
|
|
super.init(coder: coder)
|
|
|
@ -23,7 +26,15 @@ public final class VisibleMessage : Message {
|
|
|
|
|
|
|
|
|
|
|
|
// MARK: Proto Conversion
|
|
|
|
// MARK: Proto Conversion
|
|
|
|
public override class func fromProto(_ proto: SNProtoContent) -> VisibleMessage? {
|
|
|
|
public override class func fromProto(_ proto: SNProtoContent) -> VisibleMessage? {
|
|
|
|
return nil
|
|
|
|
guard let dataMessage = proto.dataMessage else { return nil }
|
|
|
|
|
|
|
|
let result = VisibleMessage()
|
|
|
|
|
|
|
|
result.text = dataMessage.body
|
|
|
|
|
|
|
|
result.attachmentIDs = [] // TODO
|
|
|
|
|
|
|
|
if let quoteProto = dataMessage.quote, let quote = Quote.fromProto(quoteProto) { result.quote = quote }
|
|
|
|
|
|
|
|
if let linkPreviewProto = dataMessage.preview.first, let linkPreview = LinkPreview.fromProto(linkPreviewProto) { result.linkPreview = linkPreview }
|
|
|
|
|
|
|
|
// TODO: Contact
|
|
|
|
|
|
|
|
if let profile = Profile.fromProto(dataMessage) { result.profile = profile }
|
|
|
|
|
|
|
|
return result
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override func toProto() -> SNProtoContent? {
|
|
|
|
public override func toProto() -> SNProtoContent? {
|
|
|
|