Skip to content

Commit f7a0ad4

Browse files
authored
Merge pull request #691 from adjust/v4370
Version 4.37.0
2 parents 5409665 + f5753ac commit f7a0ad4

File tree

31 files changed

+331
-188
lines changed

31 files changed

+331
-188
lines changed

Adjust.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Pod::Spec.new do |s|
22
s.name = "Adjust"
3-
s.version = "4.36.0"
3+
s.version = "4.37.0"
44
s.summary = "This is the iOS SDK of adjust. You can read more about it at http://adjust.com."
55
s.homepage = "https://github.com/adjust/ios_sdk"
66
s.license = { :type => 'MIT', :file => 'MIT-LICENSE' }
77
s.author = { "Adjust" => "[email protected]" }
8-
s.source = { :git => "https://github.com/adjust/ios_sdk.git", :tag => "v4.36.0" }
8+
s.source = { :git => "https://github.com/adjust/ios_sdk.git", :tag => "v4.37.0" }
99
s.ios.deployment_target = '9.0'
1010
s.tvos.deployment_target = '9.0'
1111
s.framework = 'SystemConfiguration'

Adjust.xcodeproj/project.pbxproj

Lines changed: 149 additions & 149 deletions
Large diffs are not rendered by default.

Adjust/ADJActivityHandler.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@
6565
- (NSString *_Nullable)adid;
6666

6767
- (id _Nullable)initWithConfig:(ADJConfig *_Nullable)adjustConfig
68-
savedPreLaunch:(ADJSavedPreLaunch * _Nullable)savedPreLaunch;
68+
savedPreLaunch:(ADJSavedPreLaunch * _Nullable)savedPreLaunch
69+
deeplinkResolutionCallback:(AdjustResolvedDeeplinkBlock _Nullable)deepLinkResolutionCallback;
6970

7071
- (void)applicationDidBecomeActive;
7172
- (void)applicationWillResignActive;
@@ -83,6 +84,9 @@
8384

8485
- (void)appWillOpenUrl:(NSURL * _Nullable)url
8586
withClickTime:(NSDate * _Nullable)clickTime;
87+
- (void)processDeeplink:(NSURL * _Nullable)deeplink
88+
clickTime:(NSDate * _Nullable)clickTime
89+
completionHandler:(AdjustResolvedDeeplinkBlock _Nullable)completionHandler;
8690
- (void)setDeviceToken:(NSData * _Nullable)deviceToken;
8791
- (void)setPushToken:(NSString * _Nullable)deviceToken;
8892
- (void)setGdprForgetMe;
@@ -128,8 +132,9 @@
128132

129133
@interface ADJActivityHandler : NSObject <ADJActivityHandler>
130134

131-
- (id _Nullable)initWithConfig:(ADJConfig * _Nullable)adjustConfig
132-
savedPreLaunch:(ADJSavedPreLaunch * _Nullable)savedPreLaunch;
135+
- (id _Nullable)initWithConfig:(ADJConfig *_Nullable)adjustConfig
136+
savedPreLaunch:(ADJSavedPreLaunch * _Nullable)savedPreLaunch
137+
deeplinkResolutionCallback:(AdjustResolvedDeeplinkBlock _Nullable)deepLinkResolutionCallback;
133138

134139
- (void)addSessionCallbackParameterI:(ADJActivityHandler * _Nullable)selfI
135140
key:(NSString * _Nullable)key

Adjust/ADJActivityHandler.m

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ @interface ADJActivityHandler()
106106
@property (nonatomic, copy) NSString* gdprPath;
107107
@property (nonatomic, copy) NSString* subscriptionPath;
108108
@property (nonatomic, copy) NSString* purchaseVerificationPath;
109+
@property (nonatomic, copy) AdjustResolvedDeeplinkBlock cachedDeeplinkResolutionCallback;
109110

110111
- (void)prepareDeeplinkI:(ADJActivityHandler *_Nullable)selfI
111112
responseData:(ADJAttributionResponseData *_Nullable)attributionResponseData NS_EXTENSION_UNAVAILABLE_IOS("");
@@ -118,9 +119,9 @@ @implementation ADJActivityHandler
118119
@synthesize attribution = _attribution;
119120
@synthesize trackingStatusManager = _trackingStatusManager;
120121

121-
- (id)initWithConfig:(ADJConfig *)adjustConfig
122-
savedPreLaunch:(ADJSavedPreLaunch *)savedPreLaunch
123-
{
122+
- (id)initWithConfig:(ADJConfig *_Nullable)adjustConfig
123+
savedPreLaunch:(ADJSavedPreLaunch * _Nullable)savedPreLaunch
124+
deeplinkResolutionCallback:(AdjustResolvedDeeplinkBlock _Nullable)deepLinkResolutionCallback {
124125
self = [super init];
125126
if (self == nil) return nil;
126127

@@ -151,6 +152,7 @@ - (id)initWithConfig:(ADJConfig *)adjustConfig
151152
self.adjustConfig = adjustConfig;
152153
self.savedPreLaunch = savedPreLaunch;
153154
self.adjustDelegate = adjustConfig.delegate;
155+
self.cachedDeeplinkResolutionCallback = deepLinkResolutionCallback;
154156

155157
// init logger to be available everywhere
156158
self.logger = ADJAdjustFactory.logger;
@@ -382,6 +384,17 @@ - (void)appWillOpenUrl:(NSURL *)url withClickTime:(NSDate *)clickTime {
382384
}];
383385
}
384386

387+
- (void)processDeeplink:(NSURL * _Nullable)deeplink
388+
clickTime:(NSDate * _Nullable)clickTime
389+
completionHandler:(AdjustResolvedDeeplinkBlock _Nullable)completionHandler {
390+
[ADJUtil launchInQueue:self.internalQueue
391+
selfInject:self
392+
block:^(ADJActivityHandler * selfI) {
393+
selfI.cachedDeeplinkResolutionCallback = completionHandler;
394+
[selfI appWillOpenUrlI:selfI url:deeplink clickTime:clickTime];
395+
}];
396+
}
397+
385398
- (void)setDeviceToken:(NSData *)deviceToken {
386399
[ADJUtil launchInQueue:self.internalQueue
387400
selfInject:self
@@ -1556,6 +1569,16 @@ - (void)launchSdkClickResponseTasksI:(ADJActivityHandler *)selfI
15561569
selector:@selector(adjustAttributionChanged:)
15571570
withObject:sdkClickResponseData.attribution];
15581571
}
1572+
1573+
// check if we got resolved deep link in the response
1574+
if (sdkClickResponseData.resolvedDeeplink != nil) {
1575+
if (selfI.cachedDeeplinkResolutionCallback != nil) {
1576+
[ADJUtil launchInMainThread:^{
1577+
selfI.cachedDeeplinkResolutionCallback(sdkClickResponseData.resolvedDeeplink);
1578+
selfI.cachedDeeplinkResolutionCallback = nil;
1579+
}];
1580+
}
1581+
}
15591582
}
15601583

15611584
- (void)launchAttributionResponseTasksI:(ADJActivityHandler *)selfI
@@ -2862,6 +2885,7 @@ - (void)updateAttStatusFromUserCallback:(int)newAttStatusFromUser {
28622885
[self.trackingStatusManager updateAttStatusFromUserCallback:newAttStatusFromUser];
28632886
}
28642887

2888+
28652889
- (void)processCoppaComplianceI:(ADJActivityHandler *)selfI {
28662890
if (!selfI.adjustConfig.coppaCompliantEnabled) {
28672891
[self resetThirdPartySharingCoppaActivityStateI:selfI];

Adjust/ADJConfig.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,4 +291,9 @@
291291
*/
292292
@property (nonatomic, assign) BOOL coppaCompliantEnabled;
293293

294+
/**
295+
* @brief Enables caching of device ids to read it only once
296+
*/
297+
@property (nonatomic, assign) BOOL readDeviceInfoOnceEnabled;
298+
294299
@end

Adjust/ADJConfig.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ - (id)copyWithZone:(NSZone *)zone {
214214
copy->_isSKAdNetworkHandlingActive = self.isSKAdNetworkHandlingActive;
215215
copy->_urlStrategy = [self.urlStrategy copyWithZone:zone];
216216
copy.linkMeEnabled = self.linkMeEnabled;
217+
copy.readDeviceInfoOnceEnabled = self.readDeviceInfoOnceEnabled;
217218
// adjust delegate not copied
218219
}
219220

Adjust/ADJPackageBuilder.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@
9696

9797
+ (void)addIdfaToParameters:(NSMutableDictionary * _Nullable)parameters
9898
withConfig:(ADJConfig * _Nullable)adjConfig
99-
logger:(id<ADJLogger> _Nullable)logger;
99+
logger:(id<ADJLogger> _Nullable)logger
100+
packageParams:(ADJPackageParams * _Nullable)packageParams;
100101
@end
101102
// TODO change to ADJ...
102103
extern NSString * _Nullable const ADJAttributionTokenParameter;

Adjust/ADJPackageBuilder.m

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ - (id)initWithPackageParams:(ADJPackageParams * _Nullable)packageParams
4343
config:(ADJConfig * _Nullable)adjustConfig
4444
sessionParameters:(ADJSessionParameters * _Nullable)sessionParameters
4545
trackingStatusManager:(ADJTrackingStatusManager * _Nullable)trackingStatusManager
46-
createdAt:(double)createdAt
47-
{
46+
createdAt:(double)createdAt {
4847
self = [super init];
4948
if (self == nil) {
5049
return nil;
@@ -1237,8 +1236,9 @@ - (NSMutableDictionary *)getPurchaseVerificationParameters {
12371236

12381237
- (void)addIdfaIfPossibleToParameters:(NSMutableDictionary *)parameters {
12391238
[ADJPackageBuilder addIdfaToParameters:parameters
1240-
withConfig:self.adjustConfig
1241-
logger:[ADJAdjustFactory logger]];
1239+
withConfig:self.adjustConfig
1240+
logger:[ADJAdjustFactory logger]
1241+
packageParams:self.packageParams];
12421242
}
12431243

12441244
- (void)addIdfvIfPossibleToParameters:(NSMutableDictionary *)parameters {
@@ -1374,25 +1374,33 @@ + (BOOL)isAdServicesPackage:(ADJActivityPackage *)activityPackage {
13741374

13751375
+ (void)addIdfaToParameters:(NSMutableDictionary * _Nullable)parameters
13761376
withConfig:(ADJConfig * _Nullable)adjConfig
1377-
logger:(id<ADJLogger> _Nullable)logger {
1378-
1379-
if (! adjConfig.allowIdfaReading) {
1377+
logger:(id<ADJLogger> _Nullable)logger
1378+
packageParams:(ADJPackageParams *)packageParams {
1379+
if (!adjConfig.allowIdfaReading) {
1380+
[logger info:@"Cannot read IDFA because it's forbidden by ADJConfig setting"];
13801381
return;
13811382
}
1382-
13831383
if (adjConfig.coppaCompliantEnabled) {
13841384
[logger info:@"Cannot read IDFA with COPPA enabled"];
13851385
return;
13861386
}
13871387

1388-
NSString *idfa = [ADJUtil idfa];
1389-
if (idfa == nil
1390-
|| idfa.length == 0
1391-
|| [idfa isEqualToString:@"00000000-0000-0000-0000-000000000000"])
1392-
{
1388+
// read once && IDFA not cached
1389+
if (adjConfig.readDeviceInfoOnceEnabled && packageParams.idfaCached != nil) {
1390+
[ADJPackageBuilder parameters:parameters setString:packageParams.idfaCached forKey:@"idfa"];
13931391
return;
13941392
}
13951393

1394+
// read IDFA
1395+
NSString *idfa = [ADJUtil idfa];
1396+
if (idfa == nil ||
1397+
idfa.length == 0 ||
1398+
[idfa isEqualToString:@"00000000-0000-0000-0000-000000000000"]) {
1399+
return;
1400+
}
1401+
// cache IDFA
1402+
packageParams.idfaCached = idfa;
1403+
// add IDFA to payload
13961404
[ADJPackageBuilder parameters:parameters setString:idfa forKey:@"idfa"];
13971405
}
13981406

Adjust/ADJPackageHandler.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,8 @@ - (void)updatePackagesWithIdfaAndAttStatusI:(ADJPackageHandler *)selfI {
309309
[ADJPackageBuilder parameters:activityPackage.parameters setInt:attStatus forKey:@"att_status"];
310310
[ADJPackageBuilder addIdfaToParameters:activityPackage.parameters
311311
withConfig:self.activityHandler.adjustConfig
312-
logger:[ADJAdjustFactory logger]];
312+
logger:[ADJAdjustFactory logger]
313+
packageParams:self.activityHandler.packageParams];
313314
// add to copy queue
314315
[packageQueueCopy addObject:activityPackage];
315316
}

Adjust/ADJPackageParams.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
@property (nonatomic, copy) NSString *osVersion;
2323
@property (nonatomic, copy) NSString *installedAt;
2424
@property (nonatomic, assign) NSUInteger startedAt;
25+
@property (nonatomic, copy) NSString *idfaCached;
2526

2627
- (id)initWithSdkPrefix:(NSString *)sdkPrefix;
2728

0 commit comments

Comments
 (0)