Add context menu for Fullscreen mode actions. Issue #1344

This commit is contained in:
Maurice Parker
2019-11-25 19:43:43 -06:00
parent b1471d4d20
commit 323b160b7f
8 changed files with 344 additions and 21 deletions

View File

@@ -92,6 +92,50 @@ extension Article {
return FaviconGenerator.favicon(webFeed)
}
func byline() -> String {
guard let authors = authors ?? webFeed?.authors, !authors.isEmpty else {
return ""
}
// If the author's name is the same as the feed, then we don't want to display it.
// This code assumes that multiple authors would never match the feed name so that
// if there feed owner has an article co-author all authors are given the byline.
if authors.count == 1, let author = authors.first {
if author.name == webFeed?.nameForDisplay {
return ""
}
}
var byline = ""
var isFirstAuthor = true
for author in authors {
if !isFirstAuthor {
byline += ", "
}
isFirstAuthor = false
if let emailAddress = author.emailAddress, emailAddress.contains(" ") {
byline += emailAddress // probably name plus email address
}
else if let name = author.name, let emailAddress = author.emailAddress {
byline += "\(name) <\(emailAddress)>"
}
else if let name = author.name {
byline += name
}
else if let emailAddress = author.emailAddress {
byline += "<\(emailAddress)>"
}
else if let url = author.url {
byline += url
}
}
return byline
}
}
// MARK: Path