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