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.
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.
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!
Thanks!
Are there also plans for presenting notifications to the user on macOS?
Please sign in to leave a comment.