From a91e65f72fd05c15fb4443bc80c2c5b516754b54 Mon Sep 17 00:00:00 2001 From: Maarten Billemont Date: Mon, 6 Apr 2020 23:11:36 -0400 Subject: [PATCH] Push notification support on macOS. --- platform-darwin/Source/Mac/MPMacAppDelegate.m | 5 ++++- platform-darwin/Source/Mac/MasterPassword.entitlements | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/platform-darwin/Source/Mac/MPMacAppDelegate.m b/platform-darwin/Source/Mac/MPMacAppDelegate.m index 0dcc7f0a..3dd0bfc6 100644 --- a/platform-darwin/Source/Mac/MPMacAppDelegate.m +++ b/platform-darwin/Source/Mac/MPMacAppDelegate.m @@ -125,7 +125,7 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven countlyConfig.host = @"https://countly.lyndir.com"; countlyConfig.appKey = decrypt( countlyKey ); countlyConfig.features = @[ CLYPushNotifications ]; - countlyConfig.requiresConsent = YES; + //countlyConfig.requiresConsent = YES; // FIXME: https://support.count.ly/hc/en-us/community/posts/900000930423-Notifications-on-macOS countlyConfig.alwaysUsePOST = YES; countlyConfig.deviceID = [PearlKeyChain deviceIdentifier]; countlyConfig.secretSalt = decrypt( countlySalt ); @@ -137,6 +137,9 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven countlyConfig.enableDebug = NO; #endif [Countly.sharedInstance startWithConfig:countlyConfig]; + + [Countly.sharedInstance giveConsentForFeature:CLYConsentPushNotifications]; + [Countly.sharedInstance askForNotificationPermission]; } @catch (id exception) { err( @"During Analytics Setup: %@", exception ); diff --git a/platform-darwin/Source/Mac/MasterPassword.entitlements b/platform-darwin/Source/Mac/MasterPassword.entitlements index 32c0b065..4a228477 100644 --- a/platform-darwin/Source/Mac/MasterPassword.entitlements +++ b/platform-darwin/Source/Mac/MasterPassword.entitlements @@ -2,6 +2,8 @@ + com.apple.developer.aps-environment + development com.apple.security.app-sandbox com.apple.security.application-groups