Merge pull request #2077 from stuartbreckenridge/notifications

Notifications
This commit is contained in:
Maurice Parker 2020-05-15 07:41:01 -05:00 committed by GitHub
commit fd6736a897
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -47,14 +47,20 @@ private extension UserNotificationManager {
let content = UNMutableNotificationContent() let content = UNMutableNotificationContent()
content.title = webFeed.nameForDisplay content.title = webFeed.nameForDisplay
content.body = ArticleStringFormatter.truncatedTitle(article)
if content.body.isEmpty { if !ArticleStringFormatter.truncatedTitle(article).isEmpty {
content.body = ArticleStringFormatter.truncatedSummary(article) content.subtitle = ArticleStringFormatter.truncatedTitle(article)
} }
content.body = ArticleStringFormatter.truncatedSummary(article)
content.threadIdentifier = webFeed.webFeedID
content.summaryArgument = "\(webFeed.nameForDisplay)"
content.summaryArgumentCount = 1
content.sound = UNNotificationSound.default content.sound = UNNotificationSound.default
content.userInfo = [UserInfoKey.articlePath: article.pathUserInfo] content.userInfo = [UserInfoKey.articlePath: article.pathUserInfo]
let request = UNNotificationRequest.init(identifier: "articleID:\(article.articleID)", content: content, trigger: nil) let request = UNNotificationRequest.init(identifier: "articleID:\(article.articleID)", content: content, trigger: nil)
UNUserNotificationCenter.current().add(request) UNUserNotificationCenter.current().add(request)
} }