forked from shadowfacts/Tusker
Fix status/mention push notifications not showing CW and fix sensitive attachments being included in push notifications
Closes #512
This commit is contained in:
parent
fccd4e427c
commit
b470ee6401
|
@ -122,7 +122,12 @@ class NotificationService: UNNotificationServiceExtension {
|
||||||
|
|
||||||
let notificationContent: String?
|
let notificationContent: String?
|
||||||
if let status = notification.status {
|
if let status = notification.status {
|
||||||
notificationContent = NotificationService.textConverter.convert(html: status.content)
|
if notification.kind == .mention || notification.kind == .status,
|
||||||
|
!status.spoilerText.isEmpty {
|
||||||
|
notificationContent = "⚠️ \(status.spoilerText)"
|
||||||
|
} else {
|
||||||
|
notificationContent = NotificationService.textConverter.convert(html: status.content)
|
||||||
|
}
|
||||||
} else if notification.kind == .follow || notification.kind == .followRequest {
|
} else if notification.kind == .follow || notification.kind == .followRequest {
|
||||||
notificationContent = nil
|
notificationContent = nil
|
||||||
} else {
|
} else {
|
||||||
|
@ -135,7 +140,9 @@ class NotificationService: UNNotificationServiceExtension {
|
||||||
// We deliberately don't include attachments for other types of notifications that have statuses (favs, etc.)
|
// We deliberately don't include attachments for other types of notifications that have statuses (favs, etc.)
|
||||||
// because we risk just fetching the same thing a bunch of times for many senders.
|
// because we risk just fetching the same thing a bunch of times for many senders.
|
||||||
if notification.kind == .mention || notification.kind == .status || notification.kind == .update,
|
if notification.kind == .mention || notification.kind == .status || notification.kind == .update,
|
||||||
let attachment = notification.status?.attachments.first {
|
let status = notification.status,
|
||||||
|
!status.sensitive,
|
||||||
|
let attachment = status.attachments.first {
|
||||||
let url = attachment.previewURL ?? attachment.url
|
let url = attachment.previewURL ?? attachment.url
|
||||||
attachmentDataTask = Task {
|
attachmentDataTask = Task {
|
||||||
do {
|
do {
|
||||||
|
|
Loading…
Reference in New Issue