on ~eliasnaur/gio
I agree with ~dnwe's assessment. Notify does not need the critical priority for the simple use cases that it targets. I'll remove it.
Comment by ~dnwe on ~eliasnaur/gio
Thanks for taking a look. There's a lot of different links there, but I think you may have gone a bit off-piste :)
Yes the app is signed and yes the .plist is correct.
The key bit is that gio-x cannot ask for the UNAuthorizationOptionCriticalAlert entitlement via requestAuthorizationWithOptions unless the user's application has the explicit entitlement:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>com.apple.developer.usernotifications.critical-alerts</key> <true/> </dict> </plist>
This isn't included in the entitlements generated by gio-cmd: https://github.com/gioui/gio-cmd/blob/4128f253e857270fdc59a4e9a9d4b10f454c2935/gogio/macosbuild.go#L158-L167
However, I personally think gio-x should just omit UNAuthorizationOptionCriticalAlert from its request so no special entitlements are needed. It shouldn't need/want to ignore the user's Do Not Disturb preference
Ticket created by ~dnwe on ~eliasnaur/gio
Attempting to use gioui.org/x/notify on macOS fails both with my own app and in the example
gioui/gio-example/notify/example.app
appLooking into this it appears that the notify code requests the ability to raise critical alerts (UNAuthorizationOptionCriticalAlert):
https://git.sr.ht/~whereswaldon/gio-x/tree/main/item/notify/macos/notify_macos.go#L89
However, this is documented by Apple as requiring a special entitlement to have been issued and signed by Apple for the bundle (https://developer.apple.com/documentation/usernotifications/unauthorizationoptions/unauthorizationoptioncriticalalert)
I don't know if this is a new requirement on macOS Ventura, but it fails with the following output:
% Contents/MacOS/example 2023-07-10 18:08:34.886 example[79016:26540158] Getting application bundle 2023-07-10 18:08:34.886 example[79016:26540158] Bundle ID: org.gioui 2023-07-10 18:08:34.886 example[79016:26540158] Getting notification center 2023-07-10 18:08:40.315 example[79016:26540162] Creating notification 2023-07-10 18:08:40.316 example[79016:26540162] Creating request 2023-07-10 18:08:40.316 example[79016:26540162] Requesting authorization 2023-07-10 18:08:40.316 example[79016:26540165] Granted = false 2023-07-10 18:08:40.316 example[79016:26540165] Error = Error Domain=UNErrorDomain Code=1 "Notifications are not allowed for this application" UserInfo={NSLocalizedFailureReason=UNAuthorizationOptionCriticalAlert requires an entitlement to use, NSLocalizedDescription=Notifications are not allowed for this application}