2017-05-27 19:43:27 +02:00
|
|
|
//
|
|
|
|
// TimelineCellData.swift
|
|
|
|
// Evergreen
|
|
|
|
//
|
|
|
|
// 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
|
2017-09-17 21:22:15 +02:00
|
|
|
import Data
|
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
|
|
|
|
2018-01-05 06:20:09 +01:00
|
|
|
init(article: Article, appearance: TimelineCellAppearance, showFeedName: Bool, feedName: String?, avatar: NSImage?, showAvatar: Bool, featuredImage: NSImage?) {
|
2018-02-19 01:13:58 +01:00
|
|
|
|
2017-05-27 19:43:27 +02:00
|
|
|
self.title = timelineTruncatedTitle(article)
|
|
|
|
self.text = timelineTruncatedSummary(article)
|
|
|
|
|
|
|
|
self.dateString = timelineDateString(article.logicalDatePublished)
|
|
|
|
|
2017-12-30 21:45:10 +01:00
|
|
|
if let feedName = feedName {
|
|
|
|
self.feedName = timelineTruncatedFeedName(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
|
|
|
}
|
|
|
|
}
|