use site name to display site on feed and grid cards
This commit is contained in:
@ -38,6 +38,7 @@
|
||||
<attribute name="readingProgressAnchor" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/>
|
||||
<attribute name="savedAt" attributeType="Date" usesScalarValueType="NO"/>
|
||||
<attribute name="serverSyncStatus" attributeType="Integer 64" defaultValueString="NO" usesScalarValueType="YES"/>
|
||||
<attribute name="siteName" optional="YES" attributeType="String"/>
|
||||
<attribute name="slug" attributeType="String"/>
|
||||
<attribute name="title" attributeType="String"/>
|
||||
<relationship name="highlights" toMany="YES" deletionRule="Cascade" destinationEntity="Highlight" inverseName="linkedItem" inverseEntity="Highlight"/>
|
||||
@ -85,7 +86,7 @@
|
||||
</entity>
|
||||
<elements>
|
||||
<element name="Highlight" positionX="27" positionY="225" width="128" height="224"/>
|
||||
<element name="LinkedItem" positionX="-18" positionY="63" width="128" height="344"/>
|
||||
<element name="LinkedItem" positionX="-18" positionY="63" width="128" height="359"/>
|
||||
<element name="LinkedItemLabel" positionX="-36" positionY="18" width="128" height="134"/>
|
||||
<element name="NewsletterEmail" positionX="0" positionY="180" width="128" height="74"/>
|
||||
<element name="Viewer" positionX="45" positionY="234" width="128" height="89"/>
|
||||
|
||||
@ -45,8 +45,8 @@ public extension LinkedItem {
|
||||
return (pageURLString ?? "").hasSuffix("pdf")
|
||||
}
|
||||
|
||||
var publisherHostname: String? {
|
||||
URL(string: publisherURLString ?? pageURLString ?? "")?.host
|
||||
var publisherDisplayName: String? {
|
||||
siteName ?? URL(string: publisherURLString ?? pageURLString ?? "")?.host
|
||||
}
|
||||
|
||||
var imageURL: URL? {
|
||||
|
||||
@ -105,6 +105,7 @@ extension DataService {
|
||||
pageURLString: try $0.url(),
|
||||
descriptionText: try $0.description(),
|
||||
publisherURLString: try $0.originalArticleUrl(),
|
||||
siteName: try $0.siteName(),
|
||||
author: try $0.author(),
|
||||
publishDate: try $0.publishedAt()?.value,
|
||||
slug: try $0.slug(),
|
||||
|
||||
@ -95,6 +95,7 @@ private let articleSelection = Selection.Article {
|
||||
pageURLString: try $0.url(),
|
||||
descriptionText: try $0.description(),
|
||||
publisherURLString: try $0.originalArticleUrl(),
|
||||
siteName: try $0.siteName(),
|
||||
author: try $0.author(),
|
||||
publishDate: try $0.publishedAt()?.value,
|
||||
slug: try $0.slug(),
|
||||
|
||||
@ -15,6 +15,7 @@ struct InternalLinkedItem {
|
||||
let pageURLString: String
|
||||
let descriptionText: String?
|
||||
let publisherURLString: String?
|
||||
let siteName: String?
|
||||
let author: String?
|
||||
let publishDate: Date?
|
||||
let slug: String
|
||||
@ -37,6 +38,7 @@ struct InternalLinkedItem {
|
||||
linkedItem.pageURLString = pageURLString
|
||||
linkedItem.descriptionText = descriptionText
|
||||
linkedItem.publisherURLString = publisherURLString
|
||||
linkedItem.siteName = siteName
|
||||
linkedItem.author = author
|
||||
linkedItem.publishDate = publishDate
|
||||
linkedItem.slug = slug
|
||||
@ -93,6 +95,7 @@ extension JSONArticle {
|
||||
pageURLString: url,
|
||||
descriptionText: title,
|
||||
publisherURLString: nil,
|
||||
siteName: nil,
|
||||
author: nil,
|
||||
publishDate: nil,
|
||||
slug: slug,
|
||||
|
||||
@ -100,7 +100,7 @@ public struct GridCard: View {
|
||||
.lineLimit(1)
|
||||
}
|
||||
|
||||
if let publisherURL = item.publisherHostname {
|
||||
if let publisherURL = item.publisherDisplayName {
|
||||
Text(publisherURL)
|
||||
.font(.appCaptionTwo)
|
||||
.foregroundColor(.appGrayText)
|
||||
|
||||
@ -26,7 +26,7 @@ public struct FeedCard: View {
|
||||
.lineLimit(1)
|
||||
}
|
||||
|
||||
if let publisherURL = item.publisherHostname {
|
||||
if let publisherURL = item.publisherDisplayName {
|
||||
Text(publisherURL)
|
||||
.font(.appCaption)
|
||||
.foregroundColor(.appGrayText)
|
||||
|
||||
Reference in New Issue
Block a user