Skip to content

Commit

Permalink
Merge pull request #711 from adjust/v4382
Browse files Browse the repository at this point in the history
Version 4.38.2
  • Loading branch information
uerceg authored Apr 30, 2024
2 parents 3179722 + 8fb39fe commit 2fd82b1
Show file tree
Hide file tree
Showing 16 changed files with 160 additions and 45 deletions.
4 changes: 2 additions & 2 deletions Adjust.podspec
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Pod::Spec.new do |s|
s.name = "Adjust"
s.version = "4.38.1"
s.version = "4.38.2"
s.summary = "This is the iOS SDK of adjust. You can read more about it at http://adjust.com."
s.homepage = "https://github.com/adjust/ios_sdk"
s.license = { :type => 'MIT', :file => 'MIT-LICENSE' }
s.author = { "Adjust" => "[email protected]" }
s.source = { :git => "https://github.com/adjust/ios_sdk.git", :tag => "v4.38.1" }
s.source = { :git => "https://github.com/adjust/ios_sdk.git", :tag => "v4.38.2" }
s.ios.deployment_target = '9.0'
s.tvos.deployment_target = '9.0'
s.framework = 'SystemConfiguration'
Expand Down
29 changes: 17 additions & 12 deletions Adjust/ADJActivityHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ - (void)sendAdServicesClickPackage:(ADJActivityHandler *)selfI
sessionParameters:self.sessionParameters
trackingStatusManager:self.trackingStatusManager
createdAt:now];
clickBuilder.internalState = selfI.internalState;

ADJActivityPackage *clickPackage =
[clickBuilder buildClickPackage:ADJAdServicesPackageKey
Expand Down Expand Up @@ -684,6 +685,7 @@ - (void)trackAttStatusUpdateI:(ADJActivityHandler *)selfI {
sessionParameters:selfI.sessionParameters
trackingStatusManager:self.trackingStatusManager
createdAt:now];
infoBuilder.internalState = selfI.internalState;

ADJActivityPackage *infoPackage = [infoBuilder buildInfoPackage:@"att"];
[selfI.packageHandler addPackage:infoPackage];
Expand Down Expand Up @@ -1119,6 +1121,7 @@ - (void)transferSessionPackageI:(ADJActivityHandler *)selfI
sessionParameters:selfI.sessionParameters
trackingStatusManager:self.trackingStatusManager
createdAt:now];
sessionBuilder.internalState = selfI.internalState;
ADJActivityPackage *sessionPackage = [sessionBuilder buildSessionPackage:[selfI.internalState isInDelayedStart]];
[selfI.packageHandler addPackage:sessionPackage];
[selfI.packageHandler sendFirstPackage];
Expand Down Expand Up @@ -1194,6 +1197,7 @@ - (void)eventI:(ADJActivityHandler *)selfI
sessionParameters:selfI.sessionParameters
trackingStatusManager:self.trackingStatusManager
createdAt:now];
eventBuilder.internalState = selfI.internalState;
ADJActivityPackage *eventPackage = [eventBuilder buildEventPackage:event
isInDelay:[selfI.internalState isInDelayedStart]];
[selfI.packageHandler addPackage:eventPackage];
Expand Down Expand Up @@ -1235,7 +1239,7 @@ - (void)adRevenueI:(ADJActivityHandler *)selfI
sessionParameters:selfI.sessionParameters
trackingStatusManager:self.trackingStatusManager
createdAt:now];

adRevenueBuilder.internalState = selfI.internalState;
ADJActivityPackage *adRevenuePackage = [adRevenueBuilder buildAdRevenuePackage:source payload:payload];
[selfI.packageHandler addPackage:adRevenuePackage];
if (selfI.adjustConfig.eventBufferingEnabled) {
Expand Down Expand Up @@ -1267,7 +1271,7 @@ - (void)trackSubscriptionI:(ADJActivityHandler *)selfI
sessionParameters:selfI.sessionParameters
trackingStatusManager:self.trackingStatusManager
createdAt:now];

subscriptionBuilder.internalState = selfI.internalState;
ADJActivityPackage *subscriptionPackage = [subscriptionBuilder buildSubscriptionPackage:subscription
isInDelay:[selfI.internalState isInDelayedStart]];
[selfI.packageHandler addPackage:subscriptionPackage];
Expand Down Expand Up @@ -1316,7 +1320,7 @@ - (void)disableThirdPartySharingI:(ADJActivityHandler *)selfI {
sessionParameters:selfI.sessionParameters
trackingStatusManager:self.trackingStatusManager
createdAt:now];

dtpsBuilder.internalState = selfI.internalState;
ADJActivityPackage *dtpsPackage = [dtpsBuilder buildDisableThirdPartySharingPackage];

[selfI.packageHandler addPackage:dtpsPackage];
Expand Down Expand Up @@ -1357,7 +1361,7 @@ - (BOOL)trackThirdPartySharingI:(ADJActivityHandler *)selfI
sessionParameters:selfI.sessionParameters
trackingStatusManager:self.trackingStatusManager
createdAt:now];

tpsBuilder.internalState = selfI.internalState;
ADJActivityPackage *dtpsPackage = [tpsBuilder buildThirdPartySharingPackage:thirdPartySharing];

[selfI.packageHandler addPackage:dtpsPackage];
Expand Down Expand Up @@ -1394,7 +1398,7 @@ - (BOOL)trackMeasurementConsentI:(ADJActivityHandler *)selfI
sessionParameters:selfI.sessionParameters
trackingStatusManager:self.trackingStatusManager
createdAt:now];

tpsBuilder.internalState = selfI.internalState;
ADJActivityPackage *mcPackage = [tpsBuilder buildMeasurementConsentPackage:enabled];

[selfI.packageHandler addPackage:mcPackage];
Expand Down Expand Up @@ -1433,7 +1437,7 @@ - (void)trackAdRevenueI:(ADJActivityHandler *)selfI
sessionParameters:selfI.sessionParameters
trackingStatusManager:self.trackingStatusManager
createdAt:now];

adRevenueBuilder.internalState = selfI.internalState;
ADJActivityPackage *adRevenuePackage = [adRevenueBuilder buildAdRevenuePackage:adRevenue
isInDelay:[selfI.internalState isInDelayedStart]];
[selfI.packageHandler addPackage:adRevenuePackage];
Expand Down Expand Up @@ -1500,7 +1504,7 @@ - (void)verifyPurchaseI:(ADJActivityHandler *)selfI
sessionParameters:selfI.sessionParameters
trackingStatusManager:self.trackingStatusManager
createdAt:now];

purchaseVerificationBuilder.internalState = selfI.internalState;
ADJActivityPackage *purchaseVerificationPackage = [purchaseVerificationBuilder buildPurchaseVerificationPackage:purchase];
purchaseVerificationPackage.purchaseVerificationCallback = completionHandler;
[selfI.purchaseVerificationHandler sendPurchaseVerificationPackage:purchaseVerificationPackage];
Expand Down Expand Up @@ -1917,7 +1921,7 @@ - (void)appWillOpenUrlI:(ADJActivityHandler *)selfI
sessionParameters:selfI.sessionParameters
trackingStatusManager:self.trackingStatusManager
createdAt:now];

clickBuilder.internalState = selfI.internalState;
clickBuilder.deeplinkParameters = [adjustDeepLinks copy];
clickBuilder.attribution = deeplinkAttribution;
clickBuilder.clickTime = clickTime;
Expand Down Expand Up @@ -2021,7 +2025,7 @@ - (void)setDeviceTokenI:(ADJActivityHandler *)selfI
sessionParameters:selfI.sessionParameters
trackingStatusManager:self.trackingStatusManager
createdAt:now];

infoBuilder.internalState = selfI.internalState;
ADJActivityPackage *infoPackage = [infoBuilder buildInfoPackage:@"push"];

[selfI.packageHandler addPackage:infoPackage];
Expand Down Expand Up @@ -2070,7 +2074,7 @@ - (void)setPushTokenI:(ADJActivityHandler *)selfI
sessionParameters:selfI.sessionParameters
trackingStatusManager:self.trackingStatusManager
createdAt:now];

infoBuilder.internalState = selfI.internalState;
ADJActivityPackage *infoPackage = [infoBuilder buildInfoPackage:@"push"];
[selfI.packageHandler addPackage:infoPackage];

Expand Down Expand Up @@ -2111,7 +2115,7 @@ - (void)setGdprForgetMeI:(ADJActivityHandler *)selfI {
sessionParameters:selfI.sessionParameters
trackingStatusManager:self.trackingStatusManager
createdAt:now];

gdprBuilder.internalState = selfI.internalState;
ADJActivityPackage *gdprPackage = [gdprBuilder buildGdprPackage];
[selfI.packageHandler addPackage:gdprPackage];

Expand Down Expand Up @@ -2183,6 +2187,7 @@ - (void)checkLinkMeI:(ADJActivityHandler *)selfI {
sessionParameters:selfI.sessionParameters
trackingStatusManager:self.trackingStatusManager
createdAt:now];
clickBuilder.internalState = selfI.internalState;
clickBuilder.clickTime = [NSDate dateWithTimeIntervalSince1970:now];
ADJActivityPackage *clickPackage = [clickBuilder buildClickPackage:@"linkme" linkMeUrl:pasteboardUrlString];
[selfI.sdkClickHandler sendSdkClick:clickPackage];
Expand Down Expand Up @@ -2940,7 +2945,7 @@ - (void)disableThirdPartySharingForCoppaEnabledI:(ADJActivityHandler *)selfI {
sessionParameters:selfI.sessionParameters
trackingStatusManager:self.trackingStatusManager
createdAt:now];

tpsBuilder.internalState = selfI.internalState;
ADJActivityPackage *dtpsPackage = [tpsBuilder buildThirdPartySharingPackage:thirdPartySharing];

[selfI.packageHandler addPackage:dtpsPackage];
Expand Down
10 changes: 10 additions & 0 deletions Adjust/ADJActivityPackage.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@

@property (nonatomic, copy) void (^purchaseVerificationCallback)(id);

@property (nonatomic, assign) NSUInteger errorCount;

@property (nonatomic, copy) NSNumber *firstErrorCode;

@property (nonatomic, copy) NSNumber *lastErrorCode;

@property (nonatomic, assign) double waitBeforeSend;

- (void)addError:(NSNumber *)errorCode;

// Logs

@property (nonatomic, copy) NSString *suffix;
Expand Down
25 changes: 25 additions & 0 deletions Adjust/ADJActivityPackage.m
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ - (NSString *)failureMessage {
return [NSString stringWithFormat:@"Failed to track %@%@", [ADJActivityKindUtil activityKindToString:self.activityKind], self.suffix];
}

- (void)addError:(NSNumber *)errorCode {
self.errorCount = self.errorCount + 1;

if (self.firstErrorCode == nil) {
self.firstErrorCode = errorCode;
} else {
self.lastErrorCode = errorCode;
}
}

#pragma mark - NSCoding protocol methods

- (id)initWithCoder:(NSCoder *)decoder {
Expand All @@ -79,6 +89,17 @@ - (id)initWithCoder:(NSCoder *)decoder {
NSString *kindString = [decoder decodeObjectForKey:@"kind"];
self.activityKind = [ADJActivityKindUtil activityKindFromString:kindString];

id errorCountObject = [decoder decodeObjectForKey:@"errorCount"];
if (errorCountObject != nil && [errorCountObject isKindOfClass:[NSNumber class]]) {
self.errorCount = ((NSNumber *)errorCountObject).unsignedIntegerValue;
}
self.firstErrorCode = [decoder decodeObjectForKey:@"firstErrorCode"];
self.lastErrorCode = [decoder decodeObjectForKey:@"lastErrorCode"];
id waitBeforeSendObject = [decoder decodeObjectForKey:@"waitBeforeSend"];
if (waitBeforeSendObject != nil && [waitBeforeSendObject isKindOfClass:[NSNumber class]]) {
self.waitBeforeSend = ((NSNumber *)waitBeforeSendObject).doubleValue;
}

return self;
}

Expand All @@ -92,6 +113,10 @@ - (void)encodeWithCoder:(NSCoder *)encoder {
[encoder encodeObject:self.parameters forKey:@"parameters"];
[encoder encodeObject:self.callbackParameters forKey:@"callbackParameters"];
[encoder encodeObject:self.partnerParameters forKey:@"partnerParameters"];
[encoder encodeObject:@(self.errorCount) forKey:@"errorCount"];
[encoder encodeObject:self.firstErrorCode forKey:@"firstErrorCode"];
[encoder encodeObject:self.lastErrorCode forKey:@"lastErrorCode"];
[encoder encodeObject:@(self.waitBeforeSend) forKey:@"waitBeforeSend"];
}

@end
10 changes: 10 additions & 0 deletions Adjust/ADJPackageBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

@property (nonatomic, copy) ADJAttribution * _Nullable attribution;

@property (nonatomic, weak) ADJInternalState * _Nullable internalState;

- (id _Nullable)initWithPackageParams:(ADJPackageParams * _Nullable)packageParams
activityState:(ADJActivityState * _Nullable)activityState
config:(ADJConfig * _Nullable)adjustConfig
Expand Down Expand Up @@ -88,10 +90,18 @@
setInt:(int)value
forKey:(NSString * _Nullable)key;

+ (void)parameters:(NSMutableDictionary * _Nullable)parameters
setDouble:(double)value
forKey:(NSString * _Nullable)key;

+ (void)parameters:(NSMutableDictionary * _Nullable)parameters
setDate1970:(double)value
forKey:(NSString * _Nullable)key;

+ (void)parameters:(NSMutableDictionary * _Nullable)parameters
setNumberWithoutRounding:(NSNumber * _Nullable)value
forKey:(NSString * _Nullable)key;

+ (BOOL)isAdServicesPackage:(ADJActivityPackage * _Nullable)activityPackage;

+ (void)addConsentDataToParameters:(NSMutableDictionary * _Nullable)parameters
Expand Down
28 changes: 27 additions & 1 deletion Adjust/ADJPackageBuilder.m
Original file line number Diff line number Diff line change
Expand Up @@ -1215,8 +1215,26 @@ - (void)addIdfvIfPossibleToParameters:(NSMutableDictionary *)parameters {
}

- (void)injectFeatureFlagsWithParameters:(NSMutableDictionary *)parameters {
[ADJPackageBuilder parameters:parameters setBool:self.adjustConfig.eventBufferingEnabled
[ADJPackageBuilder parameters:parameters
setBool:self.adjustConfig.eventBufferingEnabled
forKey:@"event_buffering_enabled"];
[ADJPackageBuilder parameters:parameters
setBool:self.adjustConfig.sendInBackground
forKey:@"send_in_background_enabled"];
if (self.internalState != nil) {
[ADJPackageBuilder parameters:parameters
setBool:self.internalState.isOffline
forKey:@"offline_mode_enabled"];
if (self.internalState.isInForeground == YES) {
[ADJPackageBuilder parameters:parameters
setBool:YES
forKey:@"foreground"];
} else {
[ADJPackageBuilder parameters:parameters
setBool:YES
forKey:@"background"];
}
}
if (self.adjustConfig.coppaCompliantEnabled == YES) {
[ADJPackageBuilder parameters:parameters setBool:YES forKey:@"ff_coppa"];
}
Expand Down Expand Up @@ -1253,6 +1271,14 @@ + (void)parameters:(NSMutableDictionary *)parameters setInt:(int)value forKey:(N
[ADJPackageBuilder parameters:parameters setString:valueString forKey:key];
}

+ (void)parameters:(NSMutableDictionary *)parameters setDouble:(double)value forKey:(NSString *)key {
if (value <= 0.0) {
return;
}
NSString *valueString = [NSString stringWithFormat:@"%.2f", value];
[ADJPackageBuilder parameters:parameters setString:valueString forKey:key];
}

+ (void)parameters:(NSMutableDictionary *)parameters setDate1970:(double)value forKey:(NSString *)key {
if (value < 0) {
return;
Expand Down
Loading

0 comments on commit 2fd82b1

Please sign in to comment.