https://kotlinlang.org logo
#compose-desktop
Title
# compose-desktop
j

Jonathan

10/10/2023, 1:45 PM
Using the Tray composable to displaying notifications as described in this tutorial does not work for me on a Macbook running macOS Sonoma. I’ve checked in Notification setting of System Settings and verified that notifications were enabled for Intellij IDEA. The app doesn’t crash nor are any errors printed in the console. Does anyone have the slightest idea of what could be causing this issue?
s

Sebastian Kürten

10/10/2023, 2:06 PM
We needed notifications for Briar, too. I'm not sure about the specific problems we encountered, but after checking lots of other solutions we implemented custom solutions for Linux, Windows and macOS, here's the macOS solution in particular: https://github.com/briar/briar-desktop/blob/main/briar-desktop/src/main/kotlin/org[…]t/briar/desktop/notification/macos/MacOsNotificationProvider.kt
j

Jonathan

10/10/2023, 2:12 PM
Interesting… How exactly does this work? How are you selecting the MacOsNotificationProvider at runtime?
Also, I’m unfamiliar with Foundation.getObjcClass. Is this a custom reflection lib?
k

Kirill Grouchnikov

10/10/2023, 2:18 PM
s

Sebastian Kürten

10/10/2023, 2:48 PM
We have a simple method that checks the OS and returns the appropriate notifcation provider: https://github.com/briar/briar-desktop/blob/main/briar-desktop/src/main/kotlin/org/briarproject/briar/desktop/DesktopCoreModule.kt#L185
j

Jonathan

10/10/2023, 2:49 PM
I took a peek around and came across your Desktop module already…
j

Jonathan

10/10/2023, 2:50 PM
I’ve copied some code to through into a demo app.. I don’t get any errors but I’m not seeing notifications appear.
Is there a special registeration that needs to take place before you cal
MacOsNotificationProvider.sendNotification(…)?
s

Sebastian Kürten

10/10/2023, 2:53 PM
No. Hmm, maybe something changed and things no longer work on Sonoma. Haven't checked our app on that version yet.
j

Jonathan

10/10/2023, 2:53 PM
If you have an app on the AppStore I can give it a shot
s

Sebastian Kürten

10/10/2023, 2:54 PM
it's not on the app store, but you can download it here: https://briarproject.org/download-briar-desktop/
30 Views