Skip to content

Discoveries Notifications

Jace edited this page Nov 25, 2026 · 4 revisions

Part of Discoveries.

Dia shows website notifications itself

Dia posts website notifications from the main app through UNUserNotificationCenter, not through its alert helper apps. At startup, the browser engine's notification bridge is pointed at ADKApplication (-display: / -close:), which hands requests to NotificationsController and UserNotificationsClient under bundle identifier company.thebrowser.dia. The two alert helper apps inside Dia's frameworks (Browser Helper (Alerts) and Browser Helper (Aperitif Alerts)) keep The Browser Company's signature, and macOS never registers them in the notification store for Dia.

In Dia's web engine, Notification.onerror only fires from PrepareShow() when the page isn't a secure context or its site permission isn't granted. A failure inside UNUserNotificationCenter only logs Unable to present notification, so a page that reports an error usually needs its site permission checked first.

What macOS 27 checks

On macOS 27.0.1 and 27.2.1, a locally signed Dia passes every check on the path from UNUserNotificationCenter to the screen.

  • usernotificationsd reads the caller's signing identifier with SecTaskCopySigningIdentifier and logs Entitlement check success: matching bundle identifiers. It then forwards the audit token to usernoted.
  • usernoted validates the client with SecCodeCheckValidity(code, kSecCSDefaultFlags, NULL). Both an untrusted self-signed certificate like DiaPatches Local Signing and an ad-hoc signature pass, even with Contents/Resources/Assets.car symlinked outside the bundle. It then matches or appends a per-signature source entry (several signing identities can share one bundle identifier), checks no entitlements for local notifications (aps-environment only matters on the separate push service), and forwards Presenting ... as alert to Notification Center over XPC as message_type = 1.
  • NotificationCenter.app and NotificationPreferences have no active SecCode* or certificate-trust checks on the presentation path, so the banner window is made with makeNotificationCenterWindow(visible: true).

Any failure in the usernoted check other than errSecCSUnsigned (-67062) logs Failed to validate application at <path> <status> and adds the bundle identifier to an in-memory failed-validation set, after which every UNUserNotificationCenter call fails with UNErrorCodeNotificationsNotAllowed. A locally signed Dia doesn't hit that.

Reading group.com.apple.usernoted.plist

macOS 27 keeps per-app notification settings in ~/Library/Group Containers/group.com.apple.usernoted/Library/Preferences/group.com.apple.usernoted.plist (not com.apple.ncprefs.plist).

  • auth is only the bitmask of requested UNAuthorizationOptions (7 = badge | sound | alert). It does not mean Allow Notifications is on.
  • The Allow Notifications switch is bit 25 (0x02000000) of flags; bit 23 (0x00800000) records that permission was asked. When bit 25 is 0 and bit 23 is 1, usernoted reports authorizationStatus: Denied (both for local requests and remote pushes) even while auth is 7 and banner/sound/badge bits stay enabled.
  • Nothing in usernoted clears bit 25 for a changed code signature; it is only cleared when the user declines the prompt or turns Allow Notifications off in System Settings.

An earlier version of this page misread auth = 7 with flags = 0x1080200e (bit 25 off) on macOS 27.0.1 as macOS denying an allowed patched Dia.

Why banners can vanish after swapping Dia.app

NotificationCenter.app keeps an AppInfo record for every app that posts notifications. It fills the record through NotificationPreferences.NotifierDetails, which looks the app up in Launch Services by bundle identifier and falls back to backupPath. If no Launch Services record resolves company.thebrowser.dia during a refresh, it sets AppInfo.found to 0 and logs Failed to find company.thebrowser.dia. Removing from NotificationCenter.

Nothing resets that flag. _messagePresentNotification checks guard app.found || app.refreshing without running refresh() again, so every message_type = 1 alert is dropped with dropping msg 1 app not found, even after Allow Notifications is switched off and on in System Settings. A sound the page plays itself keeps working, so the symptom is a missing banner with the page's own audio still playing.

In DiaTweaks 1.1.9 and earlier, a swap could leave exactly that gap:

  • build() unregistered staged/Dia.app with lsregister -u, and install and update unregistered the pristine copy.
  • apply() then RENAME_SWAPped the unregistered staged inode into /Applications/Dia.app and deleted the previously registered inode from .trash.
  • Launch Services was left with no valid record for the bundle identifier until something registered it again.

diapatch now runs lsregister -f on /Applications/Dia.app after apply and after uninstall puts the official Dia back. It also keeps Contents/Resources/Assets.car sealed inside the bundle unless App Icon is on, because a catalog symlinked outside the bundle fails codesign --verify --strict.

If Notification Center already latched AppInfo.found = 0, run diatweaks update and then killall NotificationCenter once; it relaunches by itself and reads Dia's record again.

To see which step fails after a missing test notification:

log show --last 5m --info --debug --predicate '(process == "NotificationCenter" OR process == "usernoted" OR process == "usernotificationsd") AND (subsystem == "com.apple.unc" OR eventMessage CONTAINS[c] "thebrowser")'

All tweaks

Clone this wiki locally