From b275286b2dec77e9cad52c50cf0e46cc5e03a8ab Mon Sep 17 00:00:00 2001 From: Maarten Billemont Date: Thu, 9 Apr 2020 21:03:11 -0400 Subject: [PATCH] Consent and notification permissions on the main thread. --- platform-darwin/Source/Mac/MPMacAppDelegate.m | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/platform-darwin/Source/Mac/MPMacAppDelegate.m b/platform-darwin/Source/Mac/MPMacAppDelegate.m index 06f869f7..bbddc69a 100644 --- a/platform-darwin/Source/Mac/MPMacAppDelegate.m +++ b/platform-darwin/Source/Mac/MPMacAppDelegate.m @@ -728,8 +728,10 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven // Send info if ([[MPConfig get].sendInfo boolValue]) { - [Countly.sharedInstance giveConsentForAllFeatures]; - [Countly.sharedInstance askForNotificationPermission]; + PearlMainQueue( ^{ + [Countly.sharedInstance giveConsentForAllFeatures]; + [Countly.sharedInstance askForNotificationPermission]; + }); if ([PearlLogger get].printLevel > PearlLogLevelInfo) [PearlLogger get].printLevel = PearlLogLevelInfo; @@ -755,7 +757,9 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven } else { [SentrySDK.currentHub getClient].options.enabled = @NO; - [Countly.sharedInstance cancelConsentForAllFeatures]; + PearlMainQueue( ^{ + [Countly.sharedInstance cancelConsentForAllFeatures]; + }); } }