Enable Notification Content extension on macOS 11+ (#1846)

Fixes #1592.

## Summary
Enables the Notification Content extension now that it works in Xcode 13.

## Any other notes
This is an entirely tooling enabling of this feature, as the extension works on macOS 11. There is a gotcha: the Notification Service Extension attachments are inaccessible. Additionally, macOS always displays the attached-by-us images/movies, which is a frustrating difference in behavior between macOS and iOS, but makes this particular deficiency less noticeable. Filed as FB9638431.
This commit is contained in:
Zac West
2021-09-19 12:06:24 -07:00
committed by GitHub
parent 4a3007f0c2
commit 5bdce9fa01
4 changed files with 36 additions and 7 deletions

View File

@@ -63,8 +63,17 @@ class NotificationViewController: UIViewController, UNNotificationContentExtensi
}
// Try to grab the attachments, in case they failed or were lazy
let shouldDownload: Bool
if allowDownloads {
if Current.isCatalyst {
// catalyst doesn't have access to the system container for the builtin attachments
// however, it _also_ shows the system preview image in all cases, so we don't need to for that too
shouldDownload = attachmentURL == nil
} else {
shouldDownload = true
}
if allowDownloads, shouldDownload {
return firstly {
Current.api
}.then { api in