diff --git a/platform-darwin/Source/MPAppDelegate_InApp.m b/platform-darwin/Source/MPAppDelegate_InApp.m index 023692e0..400d9954 100644 --- a/platform-darwin/Source/MPAppDelegate_InApp.m +++ b/platform-darwin/Source/MPAppDelegate_InApp.m @@ -197,18 +197,16 @@ PearlAssociatedObjectProperty( NSMutableArray*, ProductObservers, productObserve forKey:transaction.payment.productIdentifier]; [queue finishTransaction:transaction]; - if ([[MPConfig get].sendInfo boolValue]) { - SKProduct *product = self.products[transaction.payment.productIdentifier]; - [attributes addEntriesFromDictionary:@{ - @"id": product.productIdentifier, - @"name": product.localizedTitle, - @"price": product.price.description, - @"currency": [product.priceLocale objectForKey:NSLocaleCurrencyCode], - @"state" : @"success", - @"quantity": @(transaction.payment.quantity).description, - }]; - [Countly.sharedInstance recordEvent:@"purchase" segmentation:attributes]; - } + SKProduct *product = self.products[transaction.payment.productIdentifier]; + [attributes addEntriesFromDictionary:@{ + @"id": product.productIdentifier, + @"name": product.localizedTitle, + @"price": product.price.description, + @"currency": [product.priceLocale objectForKey:NSLocaleCurrencyCode], + @"state" : @"success", + @"quantity": @(transaction.payment.quantity).description, + }]; + [Countly.sharedInstance recordEvent:@"purchase" segmentation:attributes]; break; } case SKPaymentTransactionStateRestored: { @@ -224,18 +222,16 @@ PearlAssociatedObjectProperty( NSMutableArray*, ProductObservers, productObserve MPError( transaction.error, @"Transaction failed: %@.", transaction.payment.productIdentifier ); [queue finishTransaction:transaction]; - if ([[MPConfig get].sendInfo boolValue]) { - SKProduct *product = self.products[transaction.payment.productIdentifier]; - [Countly.sharedInstance recordEvent:@"purchase" segmentation:@{ - @"id": product.productIdentifier, - @"name": product.localizedTitle, - @"price": product.price.description, - @"currency": [product.priceLocale objectForKey:NSLocaleCurrencyCode], - @"state" : @"failed", - @"quantity": @(transaction.payment.quantity).description, - @"reason" : [transaction.error localizedFailureReason]?: [transaction.error localizedDescription], - }]; - } + SKProduct *product = self.products[transaction.payment.productIdentifier]; + [Countly.sharedInstance recordEvent:@"purchase" segmentation:@{ + @"id": product.productIdentifier, + @"name": product.localizedTitle, + @"price": product.price.description, + @"currency": [product.priceLocale objectForKey:NSLocaleCurrencyCode], + @"state" : @"failed", + @"quantity": @(transaction.payment.quantity).description, + @"reason" : [transaction.error localizedFailureReason]?: [transaction.error localizedDescription], + }]; break; } } diff --git a/platform-darwin/Source/MPAppDelegate_Key.m b/platform-darwin/Source/MPAppDelegate_Key.m index 4b65fb74..9a9a277e 100644 --- a/platform-darwin/Source/MPAppDelegate_Key.m +++ b/platform-darwin/Source/MPAppDelegate_Key.m @@ -173,13 +173,11 @@ else dbg( @"Automatic login failed for user: %@", user.userID ); - if ([[MPConfig get].sendInfo boolValue]) { - [Countly.sharedInstance recordEvent:@"login" segmentation:@{ - @"method" : password? @"Password": @"Automatic", - @"state" : @"failed", - @"algorithm": @(user.algorithm.version).description, - }]; - } + [Countly.sharedInstance recordEvent:@"login" segmentation:@{ + @"method" : password? @"Password": @"Automatic", + @"state" : @"failed", + @"algorithm": @(user.algorithm.version).description, + }]; return NO; } @@ -203,15 +201,13 @@ } @try { - if ([[MPConfig get].sendInfo boolValue]) { - [Countly.sharedInstance userLoggedIn:user.userID]; + [Countly.sharedInstance userLoggedIn:user.userID]; - [Countly.sharedInstance recordEvent:@"login" segmentation:@{ - @"method" : password? @"Password": @"Automatic", - @"state" : @"success", - @"algorithm": @(user.algorithm.version).description, - }]; - } + [Countly.sharedInstance recordEvent:@"login" segmentation:@{ + @"method" : password? @"Password": @"Automatic", + @"state" : @"success", + @"algorithm": @(user.algorithm.version).description, + }]; } @catch (id exception) { err( @"While setting username: %@", exception ); diff --git a/platform-darwin/Source/MPAppDelegate_Shared.m b/platform-darwin/Source/MPAppDelegate_Shared.m index 827dcba5..dc7a6c91 100644 --- a/platform-darwin/Source/MPAppDelegate_Shared.m +++ b/platform-darwin/Source/MPAppDelegate_Shared.m @@ -119,8 +119,7 @@ static MPAppDelegate_Shared *instance; if (self.key) self.key = nil; - if ([[MPConfig get].sendInfo boolValue]) - [Countly.sharedInstance userLoggedOut]; + [Countly.sharedInstance userLoggedOut]; self.activeUserOID = activeUserOID; diff --git a/platform-darwin/Source/Mac/MPMacAppDelegate.m b/platform-darwin/Source/Mac/MPMacAppDelegate.m index 664bffd3..bb635fa6 100644 --- a/platform-darwin/Source/Mac/MPMacAppDelegate.m +++ b/platform-darwin/Source/Mac/MPMacAppDelegate.m @@ -408,14 +408,8 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven - (IBAction)togglePreference:(id)sender { - if (sender == self.diagnosticsItem) { - BOOL sendInfo = self.diagnosticsItem.state != NSOnState; - [[Countly sharedInstance] recordEvent:@"sendInfoDecided" segmentation:@{ - @"from": @"preferences", - @"sendInfo": [@(sendInfo) description], - }]; - [MPMacConfig get].sendInfo = @(sendInfo); - } + if (sender == self.diagnosticsItem) + [MPMacConfig get].sendInfo = @(self.diagnosticsItem.state != NSOnState); if (sender == self.hidePasswordsItem) [MPMacConfig get].hidePasswords = @(self.hidePasswordsItem.state != NSOnState); if (sender == self.rememberPasswordItem) @@ -778,7 +772,6 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven CLYConsentSessions, CLYConsentEvents, CLYConsentUserDetails, CLYConsentCrashReporting, CLYConsentViewTracking, CLYConsentStarRating ]; if ([[MPMacConfig get].sendInfo boolValue]) { - [Countly.sharedInstance giveConsentForFeatures:countlyFeatures]; if ([PearlLogger get].printLevel > PearlLogLevelInfo) [PearlLogger get].printLevel = PearlLogLevelInfo; @@ -796,10 +789,12 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven [scope setExtraValue:@([PearlDeviceUtils isAppEncrypted]) forKey:@"encrypted"]; [scope setExtraValue:[PearlDeviceUtils platform] forKey:@"platform"]; }]; + + [Countly.sharedInstance giveConsentForFeatures:countlyFeatures]; } else { - [SentrySDK.currentHub getClient].options.enabled = @NO; [Countly.sharedInstance cancelConsentForFeatures:countlyFeatures]; + [SentrySDK.currentHub getClient].options.enabled = @NO; } } diff --git a/platform-darwin/Source/Mac/MPSitesWindowController.m b/platform-darwin/Source/Mac/MPSitesWindowController.m index abfa591d..0f6eeb5d 100644 --- a/platform-darwin/Source/Mac/MPSitesWindowController.m +++ b/platform-darwin/Source/Mac/MPSitesWindowController.m @@ -63,7 +63,6 @@ [alert beginSheetModalForWindow:self.window completionHandler:^(NSModalResponse returnCode) { BOOL sendInfo = returnCode != NSAlertSecondButtonReturn; [[Countly sharedInstance] recordEvent:@"sendInfoDecided" segmentation:@{ - @"from": @"initial", @"sendInfo": [@(sendInfo) description], }]; [MPMacConfig get].sendInfo = @(sendInfo); diff --git a/platform-darwin/Source/iOS/MPUsersViewController.m b/platform-darwin/Source/iOS/MPUsersViewController.m index 99bb1262..dcbb928a 100644 --- a/platform-darwin/Source/iOS/MPUsersViewController.m +++ b/platform-darwin/Source/iOS/MPUsersViewController.m @@ -231,12 +231,10 @@ typedef NS_ENUM( NSUInteger, MPActiveUserState ) { user.avatar = newUserAvatar; user.name = newUserName; - if ([[MPConfig get].sendInfo boolValue]) { - [Countly.sharedInstance recordEvent:@"new-user" segmentation:@{ - @"algorithm": @(user.algorithm.version).description, - @"avatar" : @(user.avatar).description, - }]; - } + [Countly.sharedInstance recordEvent:@"new-user" segmentation:@{ + @"algorithm": @(user.algorithm.version).description, + @"avatar" : @(user.avatar).description, + }]; } BOOL signedIn = [[MPiOSAppDelegate get] signInAsUser:user saveInContext:context diff --git a/platform-darwin/Source/iOS/MPiOSAppDelegate.m b/platform-darwin/Source/iOS/MPiOSAppDelegate.m index abaef72c..6a8f712a 100644 --- a/platform-darwin/Source/iOS/MPiOSAppDelegate.m +++ b/platform-darwin/Source/iOS/MPiOSAppDelegate.m @@ -646,7 +646,6 @@ CLYConsentSessions, CLYConsentEvents, CLYConsentUserDetails, CLYConsentCrashReporting, CLYConsentViewTracking, CLYConsentStarRating ]; if ([[MPConfig get].sendInfo boolValue]) { - [Countly.sharedInstance giveConsentForFeatures:countlyFeatures]; if ([PearlLogger get].printLevel > PearlLogLevelInfo) [PearlLogger get].printLevel = PearlLogLevelInfo; @@ -670,11 +669,13 @@ #else [scope setExtraValue:@(NO) forKey:@"reviewedVersion"]; #endif + + [Countly.sharedInstance giveConsentForFeatures:countlyFeatures]; }]; } else { - [SentrySDK.currentHub getClient].options.enabled = @NO; [Countly.sharedInstance cancelConsentForFeatures:countlyFeatures]; + [SentrySDK.currentHub getClient].options.enabled = @NO; } }