2017-05-27 19:43:27 +02:00
|
|
|
//
|
|
|
|
// TimelineCellData.swift
|
2018-08-29 07:18:24 +02:00
|
|
|
// NetNewsWire
|
2017-05-27 19:43:27 +02:00
|
|
|
//
|
|
|
|
// Created by Brent Simmons on 2/6/16.
|
|
|
|
// Copyright © 2016 Ranchero Software, LLC. All rights reserved.
|
|
|
|
//
|
|
|
|
|
2018-02-03 07:51:32 +01:00
|
|
|
import AppKit
|
2018-07-24 03:29:08 +02:00
|
|
|
import Articles
|
2017-05-27 19:43:27 +02:00
|
|
|
|
|
|
|
struct TimelineCellData {
|
|
|
|
|
|
|
|
let title: String
|
|
|
|
let text: String
|
|
|
|
let dateString: String
|
|
|
|
let feedName: String
|
|
|
|
let showFeedName: Bool
|
2018-01-05 06:20:09 +01:00
|
|
|
let avatar: NSImage? // feed icon, user avatar, or favicon
|
|
|
|
let showAvatar: Bool // Make space even when avatar is nil
|
2017-11-26 06:27:35 +01:00
|
|
|
let featuredImage: NSImage? // image from within the article
|
2017-05-27 19:43:27 +02:00
|
|
|
let read: Bool
|
2018-02-18 07:23:36 +01:00
|
|
|
let starred: Bool
|
2017-05-27 19:43:27 +02:00
|
|
|
|
2019-03-03 20:46:23 +01:00
|
|
|
init(article: Article, showFeedName: Bool, feedName: String?, avatar: NSImage?, showAvatar: Bool, featuredImage: NSImage?) {
|
2018-02-19 01:13:58 +01:00
|
|
|
|
2019-10-20 09:28:00 +02:00
|
|
|
self.title = ArticleStringFormatter.truncatedTitle(article)
|
|
|
|
self.text = ArticleStringFormatter.truncatedSummary(article)
|
2017-05-27 19:43:27 +02:00
|
|
|
|
2019-10-20 09:28:00 +02:00
|
|
|
self.dateString = ArticleStringFormatter.dateString(article.logicalDatePublished)
|
2017-05-27 19:43:27 +02:00
|
|
|
|
2017-12-30 21:45:10 +01:00
|
|
|
if let feedName = feedName {
|
2019-10-20 09:28:00 +02:00
|
|
|
self.feedName = ArticleStringFormatter.truncatedFeedName(feedName)
|
2017-05-27 19:43:27 +02:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
self.feedName = ""
|
|
|
|
}
|
|
|
|
|
|
|
|
self.showFeedName = showFeedName
|
|
|
|
|
2018-01-05 06:20:09 +01:00
|
|
|
self.showAvatar = showAvatar
|
2017-11-26 06:27:35 +01:00
|
|
|
self.avatar = avatar
|
|
|
|
self.featuredImage = featuredImage
|
|
|
|
|
2017-09-24 21:24:44 +02:00
|
|
|
self.read = article.status.read
|
2018-02-18 07:23:36 +01:00
|
|
|
self.starred = article.status.starred
|
2017-05-27 19:43:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
init() { //Empty
|
|
|
|
self.title = ""
|
|
|
|
self.text = ""
|
|
|
|
self.dateString = ""
|
|
|
|
self.feedName = ""
|
|
|
|
self.showFeedName = false
|
2018-01-05 06:20:09 +01:00
|
|
|
self.showAvatar = false
|
2017-11-26 06:27:35 +01:00
|
|
|
self.avatar = nil
|
|
|
|
self.featuredImage = nil
|
2017-05-27 19:43:27 +02:00
|
|
|
self.read = true
|
2018-02-18 07:23:36 +01:00
|
|
|
self.starred = false
|
2017-05-27 19:43:27 +02:00
|
|
|
}
|
|
|
|
}
|