@@ -29,7 +29,7 @@ @interface PACAdProvider ()
2929- (nullable instancetype )initWithDictionary : (nullable NSDictionary <NSString *, id> *)dictionary ;
3030@end
3131
32- NSString *const PACVersionString = @" 1.0.3 " ;
32+ NSString *const PACVersionString = @" 1.0.4 " ;
3333NSString *const PACUserDefaultsRootKey = @" personalized_ad_status" ;
3434
3535static NSString *const PACInfoUpdateURLFormat =
@@ -80,8 +80,8 @@ static PACConsentStatus PACConsentStatusForStatusString(NSString *_Nullable stat
8080}
8181
8282// / Returns an array of ad provider dictionary representations for the provided ad providers.
83- static NSArray <NSDictionary *> *_Nonnull
84- PACSerializeAdProviders ( NSOrderedSet <PACAdProvider *> *_Nullable providers) {
83+ static NSArray <NSDictionary *> *_Nonnull PACSerializeAdProviders (
84+ NSOrderedSet <PACAdProvider *> *_Nullable providers) {
8585 NSMutableArray <NSDictionary *> *serializedProviders = [[NSMutableArray alloc ] init ];
8686 for (PACAdProvider *provider in providers) {
8787 [serializedProviders addObject: provider.dictionaryRepresentation];
@@ -91,8 +91,8 @@ static PACConsentStatus PACConsentStatusForStatusString(NSString *_Nullable stat
9191
9292// / Returns an ordered set of ad providers for the provided array of ad provider dictionary
9393// / representations.
94- static NSOrderedSet <PACAdProvider *> *_Nonnull
95- PACDeserializeAdProviders ( NSArray <NSDictionary *> *_Nullable serializedProviders) {
94+ static NSOrderedSet <PACAdProvider *> *_Nonnull PACDeserializeAdProviders (
95+ NSArray <NSDictionary *> *_Nullable serializedProviders) {
9696 NSMutableOrderedSet *adProviders = [[NSMutableOrderedSet alloc ] init ];
9797 for (NSDictionary <NSString *, id > *providerInfo in serializedProviders) {
9898 PACAdProvider *provider = [[PACAdProvider alloc ] initWithDictionary: providerInfo];
@@ -122,15 +122,15 @@ - (nullable instancetype)initWithDictionary:(nullable NSDictionary<NSString *, i
122122}
123123
124124- (NSUInteger )hash {
125- return _dictionaryRepresentation .hash ;
125+ return _identifier .hash ;
126126}
127127
128128- (BOOL )isEqual : (nullable id )object {
129129 if (![object isKindOfClass: [PACAdProvider class ]]) {
130130 return NO ;
131131 }
132132 PACAdProvider *other = object;
133- return [_dictionaryRepresentation isEqual: other.dictionaryRepresentation ];
133+ return [self .identifier isEqual: other.identifier ];
134134}
135135
136136@end
@@ -244,7 +244,7 @@ - (void)writeStatusToUserDefaults {
244244 PACStoreKeyTaggedForUnderAgeOfConsent : _tagForUnderAgeOfConsent ? @1 : @0 ,
245245 PACStoreKeyIsRequestInEEAOrUnknown : _isRequestInEEAOrUnknown ? @1 : @0 ,
246246 PACStoreKeyHasAnyNonPersonalizedPublisherIdentifier :
247- _hasAnyNonPersonalizedPublisherIdentifier ? @1 : @0 ,
247+ _hasAnyNonPersonalizedPublisherIdentifier ? @1 : @0 ,
248248 PACStoreKeyConsentStatus : PACConsentStatusStringForStatus (_status),
249249 PACStoreKeyPublisherIdentifiers : _publisherIdentifiers.allObjects ?: @[],
250250 PACStoreKeyProviders : PACSerializeAdProviders (_adProviders),
@@ -330,8 +330,9 @@ - (void)requestConsentInfoUpdateForPublisherIdentifiers:
330330 return ;
331331 }
332332
333- NSDictionary <NSString *, id > *info =
334- [NSJSONSerialization JSONObjectWithData: data options: 0 error: &error];
333+ NSDictionary <NSString *, id > *info = [NSJSONSerialization JSONObjectWithData: data
334+ options: 0
335+ error: &error];
335336 if (error || ![info isKindOfClass: [NSDictionary class ]]) {
336337 if (!error) {
337338 error = PACErrorWithDescription (@" Invalid response." );
@@ -340,8 +341,8 @@ - (void)requestConsentInfoUpdateForPublisherIdentifiers:
340341 return ;
341342 }
342343
343- NSString *responseString =
344- [[ NSString alloc ] initWithData: data encoding: NSUTF8StringEncoding];
344+ NSString *responseString = [[ NSString alloc ] initWithData: data
345+ encoding: NSUTF8StringEncoding];
345346
346347 dispatch_async (dispatch_get_main_queue (), ^{
347348 [self handleInfoUpdateResponse: publisherIdentifiers
@@ -464,9 +465,10 @@ - (void)handleInfoUpdateResponse:(nonnull NSArray<NSString *> *)publisherIdentif
464465
465466 BOOL nonPersonalizedOnlyValueChanged =
466467 _hasAnyNonPersonalizedPublisherIdentifier != previousHasAnyNonPersonalizedPublisherIdentifier;
467- BOOL providersMatchesConsentedProviders = [_consentedProviders.set isEqual: _adProviders.set];
468+ BOOL consentedProvidersContainsProviders =
469+ [_adProviders.set isSubsetOfSet: _consentedProviders.set];
468470 if (_isRequestInEEAOrUnknown &&
469- (!providersMatchesConsentedProviders || nonPersonalizedOnlyValueChanged)) {
471+ (!consentedProvidersContainsProviders || nonPersonalizedOnlyValueChanged)) {
470472 _consentedProviders = nil ;
471473 _status = PACConsentStatusUnknown;
472474 }
0 commit comments