We are moving to Discord!

Join us on the Countly Community Discord Server! Engage in discussions, share your feature ideas, and learn from fellow Countly users to build exceptional apps and experiences.

Notifications on macOS

It appears notifications on macOS are currently broken when `requireConsent` is enabled, because:

1. `[CountlyPushNotifications.sharedInstance startPushNotifications];` is only called during `[Countly.sharedInstance startWithConfig:countlyConfig];`

2. There is no way to give consent for a feature BEFORE starting Countly, consequently `if (!CountlyConsentManager.sharedInstance.consentForPushNotifications)` inside `startPushNotifications` always fails and returns immediately.

3. When consent is given for push notifications after start-up, the SDK does NOT re-invoke `startPushNotifications` in order to register for a token.

This all works on iOS because for iOS, condition (3) does not hold.  The `CountlyConsentManager` invokes `startPushNotifications` after consent is given, and the registration takes place, yielding a token.  For some reason, the process of invoking `startPushNotifications` after consent is given has been hidden behind a `#if TARGET_OS_IOS`, causing it to not get called for macOS.  I have no idea why.  This is probably the real bug.

Removing that `#if TARGET_OS_IOS` (`CountlyConsentManager.m::292`) would probably solve this issue.

0

Comments

3 comments
  • It's also kind of silly that Countly currently only handles remote notifications by silently logging their action.  It should probably trigger a local notification or UI, as it does on iOS.

    0
    Comment actions Permalink
  • Thanks for letting us know - you are right, currently there is a problem regarding consents when it comes to push notifications on MacOS. It will be fixed in the new release due in a couple of weeks, but feel free to use this commit that fixes the issue:

    https://github.com/erkanyildiz/countly-sdk-ios/commit/f10d050f52cd58e8c4dd707d770aae3ceadfcc1c

    Cheers!

    1
    Comment actions Permalink
  • Thanks!

    Are there also plans for presenting notifications to the user on macOS?

    0
    Comment actions Permalink

Please sign in to leave a comment.