RFC: Migration from NSUserNotificationCenter to UNUserNotificationCenter on macOS #112

issue hebasto openend this issue on October 24, 2020
  1. hebasto commented at 1:10 pm on October 24, 2020: member

    Apple suggests to use UNUserNotificationCenter instead of deprecated NSUserNotificationCenter.

    I’ve played (on macOS 10.15) a bit with UNUserNotificationCenter and always getting the authorization error “Notifications are not allowed for this application”.

    Not sure, but it seems the root of this error is unsigned/unnotarized application.

  2. hebasto renamed this:
    RFC: Migration from NSUserNotificationCenter to UNUserNotificationCenter
    RFC: Migration from NSUserNotificationCenter to UNUserNotificationCenter on macOS
    on Oct 24, 2020
  3. hebasto cross-referenced this on Oct 24, 2020 from issue macOS: Post user notifications using QSystemTrayIcon by hebasto
  4. hebasto cross-referenced this on Nov 19, 2020 from issue refactor: Fix deprecation warnings when building against Qt 5.15 by hebasto
  5. jarolrod cross-referenced this on Jan 19, 2021 from issue macOS: NSUserNotification and NSUserNotificationCenter are Deprecated by jarolrod
  6. jarolrod cross-referenced this on Jan 20, 2021 from issue macOS: 'NSUserNotification' is deprecated by rex4539
  7. hebasto added the label Brainstorming on Mar 5, 2021
  8. hebasto added the label macOS on Mar 5, 2021
  9. hebasto cross-referenced this on Nov 16, 2021 from issue macOS: NSUserNotification is deprecated by fanquake
  10. hebasto cross-referenced this on Feb 12, 2024 from issue build: Add missed definition for `AM_OBJCXXFLAGS` by hebasto
  11. hebasto commented at 4:14 pm on February 13, 2024: member

    After a discussion in https://github.com/bitcoin/bitcoin/pull/29362, this issue has come to our attention again.

    In response to concerns raised in #114, it appears that migrating to the new UNUserNotificationCenter remains the only viable option. Therefore, I conducted further research and discovered the following:

    The UNUserNotificationCenter requires two conditions to be met in order to be granted permissions from the OS:

    1. The software must be bundled. **
    2. The software must be signed.

    This means that running ./src/qt/bitcoin-qt will not generate any notifications. Users must bundle it using make deploy, self-sign it with codesign -s - ./Bitcoin-Qt.app, and then run it using open ./Bitcoin-Qt.app.

    If these limitations are acceptable for macOS users and developers, I am ready to continue working in this direction.

    ** Notes:

    1. Our current hack with the substitution of the bundleIdentifier method does not help.
    2. https://developer.apple.com/forums/thread/679326
    3. https://forums.developer.apple.com/forums/thread/724249

    cc @Sjors @fanquake @theuni @achow101 @luke-jr @johnsBeharry

  12. Sjors commented at 11:29 am on February 15, 2024: member

    I think (2) is fine. We already sign the release build, and anyone who can compile from source can run the extra codesign command (maybe as part of make deploy?).

    If (1) just means that they have to use make deploy in order to get notifications working, that seems fine.

  13. alfonsoromanz commented at 10:32 am on February 22, 2024: none
    I was not familiar with the process of bundling and signing the application, however I ran the commands mentioned (make deploy, codesign -s - ./Bitcoin-Qt.app, and open ./Bitcoin-Qt.app) and the app ran with no issues. Having said that, I don’t see an issue in having to run those commands in order to make notifications work when compiling the code

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/gui. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-10-23 00:20 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me