also looking at this
feat(notifications): make the banner answerable — clicks, buttons, and a crash
#74
8 files
+942
-17
Review threads live on the whole diff, not on one commit, so none are shown here - a thread's line means something in the branch's final form, and painting it into an intermediate step would put it on code it is not about.
| @@ -950,13 +950,22 @@ fn ensureCategory(actions: []const notification_actions.Action, id_buf: []u8) ?[ | ||
| 950 | 950 | *const fn (objc.id, objc.SEL, objc.id, objc.id, objc.id, c_ulong) callconv(.c) objc.id, |
| 951 | 951 | @ptrCast(&objc.objc_msgSend), |
| 952 | 952 | ); |
| 953 | // UNNotificationCategoryOptionCustomDismissAction. | |
| 954 | // | |
| 955 | // Without it macOS handles a swipe-away itself and never delivers | |
| 956 | // `UNNotificationDismissActionIdentifier` to the delegate, which makes the | |
| 957 | // `.dismissed` arm of `handleNotificationResponse` unreachable — the | |
| 958 | // notification would simply vanish and the page would hear nothing. An app | |
| 959 | // waiting on Approve/Deny has to be told the banner was dismissed, or it | |
| 960 | // waits for an answer that is never coming. | |
| 961 | const options: c_ulong = 1 << 0; | |
| 953 | 962 | const category = makeCategory( |
| 954 | 963 | UNNotificationCategory, |
| 955 | 964 | macos_mod.sel("categoryWithIdentifier:actions:intentIdentifiers:options:"), |
| 956 | 965 | ns_category_id, |
| 957 | 966 | action_array, |
| 958 | 967 | empty, |
| 959 | 0, | |
| 968 | options, | |
| 960 | 969 | ); |
| 961 | 970 | if (@intFromPtr(category) == 0) return null; |
| 962 | 971 | |