diff --git a/CriteoPublisherSdk/Sources/Criteo.m b/CriteoPublisherSdk/Sources/Criteo.m index d0a77f30..50825431 100644 --- a/CriteoPublisherSdk/Sources/Criteo.m +++ b/CriteoPublisherSdk/Sources/Criteo.m @@ -55,7 +55,7 @@ - (void)setup { [self.class setVerboseLogsEnabled:YES]; } - CR_Gdpr *gdpr = self.dependencyProvider.consent.gdpr; + CR_Gdpr *gdpr = [self.dependencyProvider.consent gdpr]; CRLogInfo(@"Consent", @"Initialized with TCF: %@", gdpr); } diff --git a/CriteoPublisherSdk/Sources/DataConsent/CR_DataProtectionConsent.h b/CriteoPublisherSdk/Sources/DataConsent/CR_DataProtectionConsent.h index f9f63fac..4d6f8a91 100644 --- a/CriteoPublisherSdk/Sources/DataConsent/CR_DataProtectionConsent.h +++ b/CriteoPublisherSdk/Sources/DataConsent/CR_DataProtectionConsent.h @@ -33,11 +33,6 @@ FOUNDATION_EXTERN NSString *const CR_DataProtectionConsentGivenKey; */ @interface CR_DataProtectionConsent : NSObject -/** - Object that handle all the GDPR logic. - */ -@property(strong, nonatomic, readonly) CR_Gdpr *gdpr; - /** * Nullable ATTrackingManagerAuthorizationStatus * @@ -69,6 +64,8 @@ FOUNDATION_EXTERN NSString *const CR_DataProtectionConsentGivenKey; - (instancetype)init; - (instancetype)initWithUserDefaults:(NSUserDefaults *)userDefaults NS_DESIGNATED_INITIALIZER; +- (CR_Gdpr *)gdpr; + @end NS_ASSUME_NONNULL_END diff --git a/CriteoPublisherSdk/Sources/DataConsent/CR_DataProtectionConsent.m b/CriteoPublisherSdk/Sources/DataConsent/CR_DataProtectionConsent.m index 4fc69919..e5001da8 100644 --- a/CriteoPublisherSdk/Sources/DataConsent/CR_DataProtectionConsent.m +++ b/CriteoPublisherSdk/Sources/DataConsent/CR_DataProtectionConsent.m @@ -45,12 +45,15 @@ - (instancetype)initWithUserDefaults:(NSUserDefaults *)userDefaults { if (self = [super init]) { _userDefaults = userDefaults; _ccpa = [[CR_Ccpa alloc] initWithUserDefaults:userDefaults]; - _gdpr = [[CR_Gdpr alloc] initWithUserDefaults:userDefaults]; _consentGiven = self.userDefaultForConsentGiven; } return self; } +- (CR_Gdpr *)gdpr { + return [[CR_Gdpr alloc] initWithUserDefaults:_userDefaults]; +} + - (NSNumber *)trackingAuthorizationStatus { if (@available(iOS 14.0, *)) { return @(ATTrackingManager.trackingAuthorizationStatus); diff --git a/CriteoPublisherSdk/Sources/Network/CR_ApiHandler.m b/CriteoPublisherSdk/Sources/Network/CR_ApiHandler.m index a9ebccb8..7aef1297 100644 --- a/CriteoPublisherSdk/Sources/Network/CR_ApiHandler.m +++ b/CriteoPublisherSdk/Sources/Network/CR_ApiHandler.m @@ -263,7 +263,7 @@ - (NSString *)urlQueryParamsForAppEventWithEvent:(NSString *)event paramDict[CR_ApiQueryKeys.appId] = config.appId; paramDict[CR_ApiQueryKeys.trackingAuthorizationStatus] = consent.trackingAuthorizationStatus.stringValue; - paramDict[CR_ApiQueryKeys.gdprConsentForGum] = consent.gdpr.consentString; + paramDict[CR_ApiQueryKeys.gdprConsentForGum] = [consent gdpr].consentString; NSString *params = [NSString cr_urlQueryParamsWithDictionary:paramDict]; return params; } diff --git a/CriteoPublisherSdk/Sources/Network/Serializers/CR_BidRequestSerializer.m b/CriteoPublisherSdk/Sources/Network/Serializers/CR_BidRequestSerializer.m index c79d27df..1e09a12c 100644 --- a/CriteoPublisherSdk/Sources/Network/Serializers/CR_BidRequestSerializer.m +++ b/CriteoPublisherSdk/Sources/Network/Serializers/CR_BidRequestSerializer.m @@ -79,7 +79,7 @@ - (NSDictionary *)bodyWithCdbRequest:(CR_CdbRequest *)cdbRequest postBody[CR_ApiQueryKeys.profileId] = cdbRequest.profileId; postBody[CR_ApiQueryKeys.id] = cdbRequest.requestGroupId; postBody[CR_ApiQueryKeys.publisher] = [self publisherWithConfig:config context:contextData]; - postBody[CR_ApiQueryKeys.gdprConsent] = [self.gdprSerializer dictionaryForGdpr:consent.gdpr]; + postBody[CR_ApiQueryKeys.gdprConsent] = [self.gdprSerializer dictionaryForGdpr:[consent gdpr]]; postBody[CR_ApiQueryKeys.bidSlots] = [self slotsWithCdbRequest:cdbRequest config:config]; postBody[CR_ApiQueryKeys.user] = [self userWithConsent:consent config:config