2019-04-15 22:03:05 +02:00
|
|
|
//
|
|
|
|
// MasterTimelineCellData.swift
|
|
|
|
// NetNewsWire
|
|
|
|
//
|
|
|
|
// Created by Brent Simmons on 2/6/16.
|
|
|
|
// Copyright © 2016 Ranchero Software, LLC. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import UIKit
|
|
|
|
import Articles
|
|
|
|
|
|
|
|
struct MasterTimelineCellData {
|
|
|
|
|
|
|
|
let title: String
|
2019-04-29 21:40:14 +02:00
|
|
|
let summary: String
|
2019-04-15 22:03:05 +02:00
|
|
|
let dateString: String
|
|
|
|
let feedName: String
|
2020-04-18 14:53:56 +02:00
|
|
|
let byline: String
|
|
|
|
let showFeedName: ShowFeedName
|
2019-11-06 01:05:57 +01:00
|
|
|
let iconImage: IconImage? // feed icon, user avatar, or favicon
|
|
|
|
let showIcon: Bool // Make space even when icon is nil
|
2019-04-15 22:03:05 +02:00
|
|
|
let featuredImage: UIImage? // image from within the article
|
|
|
|
let read: Bool
|
|
|
|
let starred: Bool
|
2019-04-29 22:29:00 +02:00
|
|
|
let numberOfLines: Int
|
2019-11-17 02:44:01 +01:00
|
|
|
let iconSize: IconSize
|
2019-04-15 22:03:05 +02:00
|
|
|
|
2020-04-18 14:53:56 +02:00
|
|
|
init(article: Article, showFeedName: ShowFeedName, feedName: String?, byline: String?, iconImage: IconImage?, showIcon: Bool, featuredImage: UIImage?, numberOfLines: Int, iconSize: IconSize) {
|
2019-04-15 22:03:05 +02:00
|
|
|
|
2019-10-20 09:28:00 +02:00
|
|
|
self.title = ArticleStringFormatter.truncatedTitle(article)
|
|
|
|
self.summary = ArticleStringFormatter.truncatedSummary(article)
|
2019-04-15 22:03:05 +02:00
|
|
|
|
2019-10-20 09:28:00 +02:00
|
|
|
self.dateString = ArticleStringFormatter.dateString(article.logicalDatePublished)
|
2019-04-15 22:03:05 +02:00
|
|
|
|
|
|
|
if let feedName = feedName {
|
2019-10-20 09:28:00 +02:00
|
|
|
self.feedName = ArticleStringFormatter.truncatedFeedName(feedName)
|
2019-04-15 22:03:05 +02:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
self.feedName = ""
|
|
|
|
}
|
2020-04-18 14:53:56 +02:00
|
|
|
|
|
|
|
if let byline = byline {
|
|
|
|
self.byline = byline
|
|
|
|
} else {
|
|
|
|
self.byline = ""
|
|
|
|
}
|
2019-04-15 22:03:05 +02:00
|
|
|
|
|
|
|
self.showFeedName = showFeedName
|
|
|
|
|
2019-11-06 01:05:57 +01:00
|
|
|
self.showIcon = showIcon
|
|
|
|
self.iconImage = iconImage
|
2019-04-15 22:03:05 +02:00
|
|
|
self.featuredImage = featuredImage
|
|
|
|
|
|
|
|
self.read = article.status.read
|
|
|
|
self.starred = article.status.starred
|
2019-04-29 22:29:00 +02:00
|
|
|
self.numberOfLines = numberOfLines
|
2019-11-09 00:16:09 +01:00
|
|
|
self.iconSize = iconSize
|
2019-04-29 22:29:00 +02:00
|
|
|
|
2019-04-15 22:03:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
init() { //Empty
|
|
|
|
self.title = ""
|
2019-04-29 21:40:14 +02:00
|
|
|
self.summary = ""
|
2019-04-15 22:03:05 +02:00
|
|
|
self.dateString = ""
|
|
|
|
self.feedName = ""
|
2020-04-18 14:53:56 +02:00
|
|
|
self.byline = ""
|
|
|
|
self.showFeedName = .none
|
2019-11-06 01:05:57 +01:00
|
|
|
self.showIcon = false
|
|
|
|
self.iconImage = nil
|
2019-04-15 22:03:05 +02:00
|
|
|
self.featuredImage = nil
|
|
|
|
self.read = true
|
|
|
|
self.starred = false
|
2019-04-29 22:29:00 +02:00
|
|
|
self.numberOfLines = 0
|
2019-11-09 00:16:09 +01:00
|
|
|
self.iconSize = .medium
|
2019-04-15 22:03:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|