Skip to content

Commit

Permalink
refac: reintroduce coppa setting via config
Browse files Browse the repository at this point in the history
  • Loading branch information
uerceg committed Aug 2, 2024
1 parent 58c3660 commit c18d7a9
Show file tree
Hide file tree
Showing 10 changed files with 116 additions and 207 deletions.
16 changes: 10 additions & 6 deletions Adjust/ADJConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ typedef NS_ENUM(NSUInteger, ADJLogLevel);
*/
@property (nonatomic, readonly) BOOL isDataResidency;

/**
* @brief Indicator of whether SDK should start in COPPA compliant mode or not.
*/
@property (nonatomic, readonly) BOOL isCoppaComplianceEnabled;

#pragma mark - AdjustConfig assignable properties

/**
Expand Down Expand Up @@ -328,6 +333,11 @@ typedef NS_ENUM(NSUInteger, ADJLogLevel);
*/
- (void)enableCostDataInAttribution;

/**
* @brief A method to configure SDK to start in COPPA compliant mode.
*/
- (void)enableCoppaCompliance;

/**
* @brief A method to set custom URL strategy.
*
Expand All @@ -343,10 +353,4 @@ typedef NS_ENUM(NSUInteger, ADJLogLevel);
useSubdomains:(BOOL)useSubdomains
isDataResidency:(BOOL)isDataResidency;


@property (nonatomic, copy, readonly, nullable) NSString *coppaStatus;
- (void)setCoppaStatusAsEnabled;
- (void)setCoppaStatusAsDisabled;
- (void)setCoppaStatusAsUnknown;

@end
18 changes: 6 additions & 12 deletions Adjust/ADJConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ - (nullable ADJConfig *)initWithAppToken:(nonnull NSString *)appToken
_eventDeduplicationIdsMaxSize = -1;
_isDeviceIdsReadingOnceEnabled = NO;
_isCostDataInAttributionEnabled = NO;
_isCoppaComplianceEnabled = NO;

return self;
}
Expand Down Expand Up @@ -108,6 +109,10 @@ - (void)enableCostDataInAttribution {
_isCostDataInAttributionEnabled = YES;
}

- (void)enableCoppaCompliance {
_isCoppaComplianceEnabled = YES;
}

- (void)setUrlStrategy:(nullable NSArray *)urlStrategyDomains
useSubdomains:(BOOL)useSubdomains
isDataResidency:(BOOL)isDataResidency {
Expand All @@ -126,17 +131,6 @@ - (void)setUrlStrategy:(nullable NSArray *)urlStrategyDomains
_isDataResidency = isDataResidency;
}

- (void)setCoppaStatusAsEnabled {
_coppaStatus = @"enabled";
}
- (void)setCoppaStatusAsDisabled {
_coppaStatus = @"disabled";
}
- (void)setCoppaStatusAsUnknown {
_coppaStatus = @"unknown";
}


- (void)setDelegate:(NSObject<AdjustDelegate> *)delegate {
BOOL hasResponseDelegate = NO;
BOOL implementsDeeplinkCallback = NO;
Expand Down Expand Up @@ -231,6 +225,7 @@ - (id)copyWithZone:(NSZone *)zone {
copy.attConsentWaitingInterval = self.attConsentWaitingInterval;
copy.externalDeviceId = [self.externalDeviceId copyWithZone:zone];
copy->_isCostDataInAttributionEnabled = self.isCostDataInAttributionEnabled;
copy->_isCoppaComplianceEnabled = self.isCoppaComplianceEnabled;
copy->_isSkanAttributionEnabled = self.isSkanAttributionEnabled;
copy->_urlStrategyDomains = [self.urlStrategyDomains copyWithZone:zone];
copy->_useSubdomains = self.useSubdomains;
Expand All @@ -240,7 +235,6 @@ - (id)copyWithZone:(NSZone *)zone {
copy->_isIdfvReadingEnabled = self.isIdfvReadingEnabled;
copy->_isDeviceIdsReadingOnceEnabled = self.isDeviceIdsReadingOnceEnabled;
copy.eventDeduplicationIdsMaxSize = self.eventDeduplicationIdsMaxSize;
copy->_coppaStatus = [self.coppaStatus copyWithZone:zone];
// AdjustDelegate not copied
}

Expand Down
12 changes: 1 addition & 11 deletions Adjust/Adjust.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//
// V5.0.0
// Created by Christian Wellenbrock (@wellle) on 23rd July 2013.
// Copyright (c) 2012-2021 Adjust GmbH. All rights reserved.
// Copyright (c) 2012-Present Adjust GmbH. All rights reserved.
//

#import <Foundation/Foundation.h>
Expand Down Expand Up @@ -294,16 +294,6 @@ extern NSString * __nonnull const ADJEnvironmentProduction;
+ (void)verifyAppStorePurchase:(nonnull ADJAppStorePurchase *)purchase
withCompletionHandler:(nonnull ADJVerificationResultBlock)completion;

/**
* @brief Enable COPPA (Children's Online Privacy Protection Act) compliant for the application.
*/
//+ (void)enableCoppaCompliance;

/**
* @brief Disable COPPA (Children's Online Privacy Protection Act) compliant for the application.
*/
//+ (void)disableCoppaCompliance;

/**
* @brief Verify in-app-purchase and track event upon successfully completed verification.
*
Expand Down
26 changes: 0 additions & 26 deletions Adjust/Adjust.m
Original file line number Diff line number Diff line change
Expand Up @@ -721,33 +721,7 @@ - (void)verifyAppStorePurchase:(nonnull ADJAppStorePurchase *)purchase
[self.activityHandler verifyAppStorePurchase:purchase
withCompletionHandler:completion];
}
/*
- (void)enableCoppaCompliance {
[ADJUserDefaults saveCoppaComplianceWithValue:YES];
if ([self checkActivityHandler:@"enable coppa compliance"]) {
[self.activityHandler setCoppaCompliance:YES];
} else {
if (self.savedPreLaunch.preLaunchAdjustThirdPartySharingArray == nil) {
self.savedPreLaunch.preLaunchAdjustThirdPartySharingArray =
[[NSMutableArray alloc] init];
}
[self.savedPreLaunch.preLaunchAdjustThirdPartySharingArray addObject:@(YES)];
}
}

- (void)disableCoppaCompliance {
[ADJUserDefaults saveCoppaComplianceWithValue:NO];
if ([self checkActivityHandler:@"disable coppa compliance"]) {
[self.activityHandler setCoppaCompliance:NO];
} else {
if (self.savedPreLaunch.preLaunchAdjustThirdPartySharingArray == nil) {
self.savedPreLaunch.preLaunchAdjustThirdPartySharingArray =
[[NSMutableArray alloc] init];
}
[self.savedPreLaunch.preLaunchAdjustThirdPartySharingArray addObject:@(NO)];
}
}
*/
- (void)verifyAndTrackAppStorePurchase:(nonnull ADJEvent *)event
withCompletionHandler:(void (^_Nonnull)(ADJPurchaseVerificationResult * _Nonnull verificationResult))completion {
if (![self checkActivityHandler]) {
Expand Down
1 change: 0 additions & 1 deletion Adjust/Internal/ADJActivityHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@
withCompletionHandler:(nonnull ADJVerificationResultBlock)completion;
- (void)attributionWithCompletionHandler:(nonnull ADJAttributionGetterBlock)completion;
- (void)adidWithCompletionHandler:(nonnull ADJAdidGetterBlock)completion;
//- (void)setCoppaCompliance:(BOOL)isCoppaComplianceEnabled;
- (void)verifyAndTrackAppStorePurchase:(nonnull ADJEvent *)event
withCompletionHandler:(nonnull ADJVerificationResultBlock)completion;

Expand Down
Loading

0 comments on commit c18d7a9

Please sign in to comment.