in my app I use NSNotification/NSNotificationCenter without problems. But I would like to know if through declares (not plugins) it is possible to know if on the user’s Mac (System Preferences > Notifications) he/she has got Alert or Banner selected for “my” app.
Or if it possible for the app to force Notifications to use Alert or Banners according to the app’s needs: i.e. sometimes I’d like the Notif. window to look as Alert (without any button), and sometimes like Banner. From what I see, when Banners is selected I can certainly hide the action button, but I can’t get rid of the Close button.
The kind of notification cannot be overridden programmatically as far as I know, but with a custom NSUserNotificationCenterDelegate you can override the standard behaviour and enforce a notification to show.
I wasnt aware that NSUserNotification has been deprecated and is now replaced by UNUserNotification. This seems to have some more customizable options.
I don’t think so, you can specify a default option, but it can’t be changed on the fly and of course it’s overridden by the System Preferences.
There’s also one other thing to consider, that with Catalina, when the user first opens your app; they’re asked if they want to receive Notifications from this app or not. I’ve been dealing with people complaining they no longer notices when they’re updates (because I used this system), no-one remembers that they clicked on “Deny” for the App Notifications.
So long story short, NSUserNotifications is now dead.
Man I hate Apple at the moment, when I reported the issue with NSUserNotifications allow/deny dialog showing without any context, there was no mention in the docs that it was deprecated with a replacement.
I don’t understand why Apple makes life so hard sometimes, I would never for a moment consider that an app has to request permission to display Notifications without providing any context as to what. The most obvious solution is to ask the user the first time a notification is shown. But hey, you know that’s obviously too obvious.
I’ve already started my own replacement classes for Notifications, as I use them to display application updates.