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
|
|
|
|
let showFeedName: Bool
|
|
|
|
let avatar: UIImage? // feed icon, user avatar, or favicon
|
|
|
|
let showAvatar: Bool // Make space even when avatar is nil
|
|
|
|
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-04-15 22:03:05 +02:00
|
|
|
|
2019-04-29 22:29:00 +02:00
|
|
|
init(article: Article, showFeedName: Bool, feedName: String?, avatar: UIImage?, showAvatar: Bool, featuredImage: UIImage?, numberOfLines: Int) {
|
2019-04-15 22:03:05 +02:00
|
|
|
|
|
|
|
self.title = TimelineStringFormatter.truncatedTitle(article)
|
2019-04-29 21:40:14 +02:00
|
|
|
self.summary = TimelineStringFormatter.truncatedSummary(article)
|
2019-04-15 22:03:05 +02:00
|
|
|
|
|
|
|
self.dateString = TimelineStringFormatter.dateString(article.logicalDatePublished)
|
|
|
|
|
|
|
|
if let feedName = feedName {
|
|
|
|
self.feedName = TimelineStringFormatter.truncatedFeedName(feedName)
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
self.feedName = ""
|
|
|
|
}
|
|
|
|
|
|
|
|
self.showFeedName = showFeedName
|
|
|
|
|
|
|
|
self.showAvatar = showAvatar
|
|
|
|
self.avatar = avatar
|
|
|
|
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-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 = ""
|
|
|
|
self.showFeedName = false
|
|
|
|
self.showAvatar = false
|
|
|
|
self.avatar = nil
|
|
|
|
self.featuredImage = nil
|
|
|
|
self.read = true
|
|
|
|
self.starred = false
|
2019-04-29 22:29:00 +02:00
|
|
|
self.numberOfLines = 0
|
2019-04-15 22:03:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|