Skip to content

Commit ddb56a5

Browse files
authored
Merge pull request #756 from adjust/v530
Version 5.3.0
2 parents 922fc2a + a1713c7 commit ddb56a5

22 files changed

+864
-428
lines changed

Adjust.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22
s.name = "Adjust"
33
s.module_name = "AdjustSdk"
4-
s.version = "5.2.0"
4+
s.version = "5.3.0"
55
s.summary = "This is the iOS SDK of Adjust. You can read more about it at https://adjust.com."
66
s.homepage = "https://github.com/adjust/ios_sdk"
77
s.license = { :type => 'MIT', :file => 'LICENSE' }

Adjust/ADJConfig.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,17 @@ typedef NS_ENUM(NSUInteger, ADJLogLevel);
187187
/**
188188
* @brief Indicator of whether SDK should start in COPPA compliant mode or not.
189189
*/
190-
@property (nonatomic, readonly) BOOL isCoppaComplianceEnabled;
190+
@property (nonatomic) BOOL isCoppaComplianceEnabled;
191191

192192
/**
193-
* @brief Indicator of whether SDK should use AppTrackingTransparency framework
193+
* @brief Indicator of whether SDK should use AppTrackingTransparency framework or not.
194194
*/
195195
@property (nonatomic, readonly) BOOL isAppTrackingTransparencyUsageEnabled;
196196

197+
/**
198+
* @brief Indicator of whether SDK is in first session delay mode or not.
199+
*/
200+
@property (nonatomic, readonly) BOOL isFirstSessionDelayEnabled;
197201

198202
#pragma mark - AdjustConfig assignable properties
199203

@@ -344,6 +348,10 @@ typedef NS_ENUM(NSUInteger, ADJLogLevel);
344348
*/
345349
- (void)enableCoppaCompliance;
346350

351+
/**
352+
* @brief A method to enable SDK delay during the first session.
353+
*/
354+
- (void)enableFirstSessionDelay;
347355
/**
348356
* @brief A method to configure SDK avoid any call to AppTrackingTransparency framework.
349357
*/

Adjust/ADJConfig.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ - (void)disableAppTrackingTransparencyUsage {
118118
_isAppTrackingTransparencyUsageEnabled = NO;
119119
}
120120

121+
- (void)enableFirstSessionDelay {
122+
_isFirstSessionDelayEnabled = YES;
123+
}
124+
121125
- (void)setUrlStrategy:(nullable NSArray *)urlStrategyDomains
122126
useSubdomains:(BOOL)useSubdomains
123127
isDataResidency:(BOOL)isDataResidency {
@@ -241,6 +245,7 @@ - (id)copyWithZone:(NSZone *)zone {
241245
copy->_isDeviceIdsReadingOnceEnabled = self.isDeviceIdsReadingOnceEnabled;
242246
copy.eventDeduplicationIdsMaxSize = self.eventDeduplicationIdsMaxSize;
243247
copy->_isAppTrackingTransparencyUsageEnabled = self.isAppTrackingTransparencyUsageEnabled;
248+
copy->_isFirstSessionDelayEnabled = self.isFirstSessionDelayEnabled;
244249
// AdjustDelegate not copied
245250
}
246251

Adjust/Adjust.h

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Adjust.h
33
// Adjust SDK
44
//
5-
// V5.2.0
5+
// V5.3.0
66
// Created by Christian Wellenbrock (@wellle) on 23rd July 2013.
77
// Copyright (c) 2012-Present Adjust GmbH. All rights reserved.
88
//
@@ -285,6 +285,23 @@ extern NSString * __nonnull const ADJEnvironmentProduction;
285285
*/
286286
+ (void)lastDeeplinkWithCompletionHandler:(nonnull ADJLastDeeplinkGetterBlock)completion;
287287

288+
/**
289+
* @brief Enable COPPA (Children's Online Privacy Protection Act) compliant for the application when is in first session delay
290+
*/
291+
+ (void)enableCoppaComplianceInDelay;
292+
293+
/**
294+
* @brief Disable COPPA (Children's Online Privacy Protection Act) compliant for the application when is in first session delay
295+
*/
296+
+ (void)disableCoppaComplianceInDelay;
297+
298+
/**
299+
* @brief Custom defined unique device ID (optional) when is in first session delay.
300+
*
301+
* @note Make sure to have a UNIQUE external ID for each user / device.
302+
*/
303+
+ (void)setExternalDeviceIdInDelay:(nullable NSString *)externalDeviceId;
304+
288305
/**
289306
* @brief Verify in-app-purchase.
290307
*
@@ -303,6 +320,11 @@ extern NSString * __nonnull const ADJEnvironmentProduction;
303320
+ (void)verifyAndTrackAppStorePurchase:(nonnull ADJEvent *)event
304321
withCompletionHandler:(nonnull ADJVerificationResultBlock)completion;
305322

323+
/**
324+
* @brief End the first session delay that can be configured on ADJConfig instance.
325+
*/
326+
+ (void)endFirstSessionDelay;
327+
306328
/**
307329
* Obtain singleton Adjust object.
308330
*/

Adjust/Adjust.m

Lines changed: 71 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,24 @@ + (void)verifyAppStorePurchase:(nonnull ADJAppStorePurchase *)purchase
288288
}
289289
}
290290

291+
+ (void)enableCoppaComplianceInDelay {
292+
@synchronized (self) {
293+
[[Adjust getInstance] enableCoppaComplianceInDelay];
294+
}
295+
}
296+
297+
+ (void)disableCoppaComplianceInDelay {
298+
@synchronized (self) {
299+
[[Adjust getInstance] disableCoppaComplianceInDelay];
300+
}
301+
}
302+
303+
+ (void)setExternalDeviceIdInDelay:(nullable NSString *)externalDeviceId {
304+
@synchronized (self) {
305+
[[Adjust getInstance] setExternalDeviceIdInDelay:externalDeviceId];
306+
}
307+
}
308+
291309
+ (void)verifyAndTrackAppStorePurchase:(nonnull ADJEvent *)event
292310
withCompletionHandler:(void (^_Nonnull)(ADJPurchaseVerificationResult * _Nonnull verificationResult))completion {
293311
@synchronized (self) {
@@ -296,6 +314,13 @@ + (void)verifyAndTrackAppStorePurchase:(nonnull ADJEvent *)event
296314
}
297315
}
298316

317+
+ (void)endFirstSessionDelay {
318+
@synchronized (self) {
319+
[[Adjust getInstance] endFirstSessionDelay];
320+
}
321+
}
322+
323+
299324
+ (void)setTestOptions:(NSDictionary *)testOptions {
300325
@synchronized (self) {
301326
if ([testOptions[@"teardown"] boolValue]) {
@@ -534,7 +559,6 @@ - (void)removeGlobalPartnerParameterForKey:(nonnull NSString *)key {
534559
}
535560

536561
- (void)removeGlobalCallbackParameters {
537-
538562
if ([self checkActivityHandler:@"removing all global callback parameters"]) {
539563
[self.activityHandler removeGlobalCallbackParameters];
540564
return;
@@ -570,19 +594,26 @@ - (void)gdprForgetMe {
570594

571595
- (void)trackThirdPartySharing:(nonnull ADJThirdPartySharing *)thirdPartySharing {
572596
if (![self checkActivityHandler:@"track third party sharing"]) {
573-
if (self.savedPreLaunch.preLaunchAdjustThirdPartySharingArray == nil) {
574-
self.savedPreLaunch.preLaunchAdjustThirdPartySharingArray =
575-
[[NSMutableArray alloc] init];
597+
if (self.savedPreLaunch.preLaunchActionsArray == nil) {
598+
self.savedPreLaunch.preLaunchActionsArray = [[NSMutableArray alloc] init];
576599
}
577-
[self.savedPreLaunch.preLaunchAdjustThirdPartySharingArray addObject:thirdPartySharing];
600+
[self.savedPreLaunch.preLaunchActionsArray addObject:^(ADJActivityHandler *activityHandler) {
601+
[activityHandler tryTrackThirdPartySharingI:thirdPartySharing];
602+
}];
578603
return;
579604
}
580605
[self.activityHandler trackThirdPartySharing:thirdPartySharing];
581606
}
582607

583608
- (void)trackMeasurementConsent:(BOOL)enabled {
584609
if (![self checkActivityHandler:@"track measurement consent"]) {
585-
self.savedPreLaunch.lastMeasurementConsentTracked = [NSNumber numberWithBool:enabled];
610+
if (self.savedPreLaunch.preLaunchActionsArray == nil) {
611+
self.savedPreLaunch.preLaunchActionsArray =
612+
[[NSMutableArray alloc] init];
613+
}
614+
[self.savedPreLaunch.preLaunchActionsArray addObject:^(ADJActivityHandler *activityHandler) {
615+
[activityHandler tryTrackMeasurementConsentI:enabled];
616+
}];
586617
return;
587618
}
588619
[self.activityHandler trackMeasurementConsent:enabled];
@@ -619,7 +650,8 @@ - (void)updateSkanConversionValue:(NSInteger)conversionValue
619650
coarseValue:coarseValue
620651
lockWindow:lockWindow
621652
source:ADJSkanSourceClient
622-
withCompletionHandler:^(NSDictionary * _Nonnull result) {
653+
withCompletionHandler:^(NSDictionary * _Nonnull result)
654+
{
623655
if ([self checkActivityHandler]) {
624656
[self.activityHandler invokeClientSkanUpdateCallbackWithResult:result];
625657
}
@@ -712,6 +744,30 @@ - (void)verifyAppStorePurchase:(nonnull ADJAppStorePurchase *)purchase
712744
withCompletionHandler:completion];
713745
}
714746

747+
- (void)enableCoppaComplianceInDelay {
748+
if (![self checkActivityHandler:@"enable coppa compliance in delay"]) {
749+
return;
750+
}
751+
752+
[self.activityHandler setCoppaComplianceInDelay:YES];
753+
}
754+
755+
- (void)disableCoppaComplianceInDelay {
756+
if (![self checkActivityHandler:@"disable coppa compliance in delay"]) {
757+
return;
758+
}
759+
760+
[self.activityHandler setCoppaComplianceInDelay:NO];
761+
}
762+
763+
- (void)setExternalDeviceIdInDelay:(nullable NSString *)externalDeviceId {
764+
if (![self checkActivityHandler:@"set external device id in delay"]) {
765+
return;
766+
}
767+
768+
[self.activityHandler setExternalDeviceIdInDelay:externalDeviceId];
769+
}
770+
715771
- (void)verifyAndTrackAppStorePurchase:(nonnull ADJEvent *)event
716772
withCompletionHandler:(void (^_Nonnull)(ADJPurchaseVerificationResult * _Nonnull verificationResult))completion {
717773
if (![self checkActivityHandler]) {
@@ -727,6 +783,14 @@ - (void)verifyAndTrackAppStorePurchase:(nonnull ADJEvent *)event
727783
[self.activityHandler verifyAndTrackAppStorePurchase:event withCompletionHandler:completion];
728784
}
729785

786+
- (void)endFirstSessionDelay {
787+
if (![self checkActivityHandler]) {
788+
return;
789+
}
790+
791+
[self.activityHandler endFirstSessionDelay];
792+
}
793+
730794
- (void)teardown {
731795
if (self.activityHandler == nil) {
732796
[self.logger error:@"Adjust already down or not initialized"];

Adjust/Internal/ADJActivityHandler.h

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,10 @@
4141
@property (nonatomic, strong) NSMutableArray * _Nullable preLaunchActionsArray;
4242
@property (nonatomic, strong) NSMutableArray * _Nullable cachedAttributionReadCallbacksArray;
4343
@property (nonatomic, strong) NSMutableArray * _Nullable cachedAdidReadCallbacksArray;
44+
4445
@property (nonatomic, copy) NSNumber *_Nullable enabled;
4546
@property (nonatomic, assign) BOOL offline;
4647
@property (nonatomic, copy) NSString *_Nullable extraPath;
47-
@property (nonatomic, strong) NSMutableArray *_Nullable preLaunchAdjustThirdPartySharingArray;
48-
@property (nonatomic, copy) NSNumber *_Nullable lastMeasurementConsentTracked;
4948

5049
- (nonnull id)init;
5150

@@ -109,10 +108,14 @@
109108
withCompletionHandler:(nonnull ADJVerificationResultBlock)completion;
110109
- (void)attributionWithCompletionHandler:(nonnull ADJAttributionGetterBlock)completion;
111110
- (void)adidWithCompletionHandler:(nonnull ADJAdidGetterBlock)completion;
111+
- (void)setCoppaComplianceInDelay:(BOOL)isCoppaComplianceEnabled;
112+
- (void)setExternalDeviceIdInDelay:(nullable NSString *)externalDeviceId;
112113
- (void)verifyAndTrackAppStorePurchase:(nonnull ADJEvent *)event
113114
withCompletionHandler:(nonnull ADJVerificationResultBlock)completion;
114115
- (void)invokeClientSkanUpdateCallbackWithResult:(NSDictionary * _Nonnull)result;
115116

117+
- (void)endFirstSessionDelay;
118+
116119
- (ADJPackageParams * _Nullable)packageParams;
117120
- (ADJActivityState * _Nullable)activityState;
118121
- (ADJConfig * _Nullable)adjustConfig;
@@ -140,6 +143,28 @@
140143
forKey:(NSString *_Nonnull)key;
141144
- (void)removeGlobalCallbackParametersI:(ADJActivityHandler *_Nonnull)selfI;
142145
- (void)removeGlobalPartnerParametersI:(ADJActivityHandler *_Nonnull)selfI;
146+
147+
- (void)tryTrackThirdPartySharingI:(nonnull ADJThirdPartySharing *)thirdPartySharing;
148+
- (void)tryTrackMeasurementConsentI:(BOOL)enabled;
149+
@end
150+
151+
152+
@interface ADJFirstSessionDelayManager : NSObject
153+
154+
- (nonnull instancetype)initWithActivityHandler:(ADJActivityHandler * _Nonnull)activityHandler;
155+
156+
- (void)delayOrInitWithBlock:(void (^_Nonnull)(ADJActivityHandler *_Nonnull selfI, BOOL isInactive))initBlock;
157+
- (void)endFirstSessionDelay;
158+
- (void)setCoppaComplianceInDelay:(BOOL)isCoppaComplianceEnabled;
159+
- (void)setExternalDeviceIdInDelay:(NSString * _Nullable)externalDeviceId;
160+
- (void)processApiAction:(NSString * _Nonnull)actionName
161+
isPreLaunch:(BOOL)isPreLaunch
162+
withBlock:(void (^_Nonnull)(_Nonnull id))selfInjectedBlock;
163+
164+
165+
166+
- (BOOL)wasSet;
167+
143168
@end
144169

145170
@interface ADJTrackingStatusManager : NSObject

0 commit comments

Comments
 (0)