Skip to content

Commit

Permalink
Merge pull request #624 from adjust/v4310
Browse files Browse the repository at this point in the history
Version 4.31.0
  • Loading branch information
uerceg authored Jul 18, 2022
2 parents ab5684f + e28481c commit 881842e
Show file tree
Hide file tree
Showing 47 changed files with 3,206 additions and 895 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ Pods
*.orig

# Adjust
Frameworks
frameworks
sdk_distribution

# Code style
uncrustify.cfg

#SPM
.swiftpm/
.swiftpm/
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.30.0"
s.version = "4.31.0"
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 GmbH" => "[email protected]" }
s.source = { :git => "https://github.com/adjust/ios_sdk.git", :tag => "v4.30.0" }
s.source = { :git => "https://github.com/adjust/ios_sdk.git", :tag => "v4.31.0" }
s.ios.deployment_target = '9.0'
s.tvos.deployment_target = '9.0'
s.framework = 'SystemConfiguration'
Expand Down
1,029 changes: 1,024 additions & 5 deletions Adjust.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

59 changes: 59 additions & 0 deletions Adjust/ADJActivityHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,7 @@ - (void)initI:(ADJActivityHandler *)selfI
userAgent:selfI.adjustConfig.userAgent
urlStrategy:sdkClickHandlerUrlStrategy];

[selfI checkLinkMeI:selfI];
[selfI.trackingStatusManager checkForNewAttStatus];

[selfI preLaunchActionsI:selfI
Expand Down Expand Up @@ -1770,6 +1771,7 @@ - (void)setEnabledI:(ADJActivityHandler *)selfI enabled:(BOOL)enabled {
selfI.savedPreLaunch.lastMeasurementConsentTracked = nil;
}

[selfI checkLinkMeI:selfI];
}

if (![ADJUserDefaults getInstallTracked]) {
Expand Down Expand Up @@ -2161,6 +2163,63 @@ - (void)setTrackingStateOptedOutI:(ADJActivityHandler *)selfI {
[selfI.packageHandler flush];
}

- (void)checkLinkMeI:(ADJActivityHandler *)selfI {
#if TARGET_OS_IOS
if (@available(iOS 15.0, *)) {
if (selfI.adjustConfig.linkMeEnabled == NO) {
[self.logger debug:@"LinkMe not allowed by client"];
return;
}
if ([ADJUserDefaults getLinkMeChecked] == YES) {
[self.logger debug:@"LinkMe already checked"];
return;
}
if (selfI.internalState.isFirstLaunch == NO) {
[self.logger debug:@"LinkMe only valid for install"];
return;
}
if ([ADJUserDefaults getGdprForgetMe]) {
[self.logger debug:@"LinkMe not happening for GDPR forgotten user"];
return;
}

UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
if ([pasteboard hasURLs] == NO) {
[self.logger debug:@"LinkMe general board not found"];
return;
}

NSURL *pasteboardUrl = [pasteboard URL];
if (pasteboardUrl == nil) {
[self.logger debug:@"LinkMe content not found"];
return;
}

NSString *pasteboardUrlString = [pasteboardUrl absoluteString];
if (pasteboardUrlString == nil) {
[self.logger debug:@"LinkMe content could not be converted to string"];
return;
}

// send sdk_click
double now = [NSDate.date timeIntervalSince1970];
ADJPackageBuilder *clickBuilder = [[ADJPackageBuilder alloc] initWithPackageParams:selfI.packageParams
activityState:selfI.activityState
config:selfI.adjustConfig
sessionParameters:selfI.sessionParameters
trackingStatusManager:self.trackingStatusManager
createdAt:now];
clickBuilder.clickTime = [NSDate dateWithTimeIntervalSince1970:now];
ADJActivityPackage *clickPackage = [clickBuilder buildClickPackage:@"linkme" linkMeUrl:pasteboardUrlString];
[selfI.sdkClickHandler sendSdkClick:clickPackage];

[ADJUserDefaults setLinkMeChecked];
} else {
[self.logger warn:@"LinkMe feature is supported on iOS 15.0 and above"];
}
#endif
}

#pragma mark - private

- (BOOL)isEnabledI:(ADJActivityHandler *)selfI {
Expand Down
5 changes: 5 additions & 0 deletions Adjust/ADJConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,11 @@
*/
@property (nonatomic, copy, readwrite, nullable) NSString *urlStrategy;

/**
* @brief Enables/disables linkMe
*/
@property (nonatomic, assign) BOOL linkMeEnabled;

/**
* @brief Get configuration object for the initialization of the Adjust SDK.
*
Expand Down
2 changes: 2 additions & 0 deletions Adjust/ADJConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ - (id)initWithAppToken:(NSString *)appToken
self.allowIdfaReading = YES;
self.allowiAdInfoReading = YES;
self.allowAdServicesInfoReading = YES;
self.linkMeEnabled = NO;
_isSKAdNetworkHandlingActive = YES;

return self;
Expand Down Expand Up @@ -213,6 +214,7 @@ - (id)copyWithZone:(NSZone *)zone {
copy->_appSecret = [self.appSecret copyWithZone:zone];
copy->_isSKAdNetworkHandlingActive = self.isSKAdNetworkHandlingActive;
copy->_urlStrategy = [self.urlStrategy copyWithZone:zone];
copy.linkMeEnabled = self.linkMeEnabled;
// adjust delegate not copied
}

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

@property (nonatomic, copy) NSString * _Nullable deeplink;

@property (nonatomic, copy) NSString * _Nullable reftag;

@property (nonatomic, copy) NSDate * _Nullable clickTime;

@property (nonatomic, copy) NSDate * _Nullable purchaseTime;
Expand Down Expand Up @@ -53,6 +55,9 @@
token:(NSString * _Nullable)token
errorCodeNumber:(NSNumber * _Nullable)errorCodeNumber;

- (ADJActivityPackage * _Nullable)buildClickPackage:(NSString * _Nullable)clickSource
linkMeUrl:(NSString * _Nullable)linkMeUrl;

- (ADJActivityPackage * _Nullable)buildAttributionPackage:(NSString * _Nullable)initiatedBy;

- (ADJActivityPackage * _Nullable)buildGdprPackage;
Expand Down
23 changes: 23 additions & 0 deletions Adjust/ADJPackageBuilder.m
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,20 @@ - (ADJActivityPackage *)buildClickPackage:(NSString *)clickSource
return [self buildClickPackage:clickSource extraParameters:parameters];
}

- (ADJActivityPackage *)buildClickPackage:(NSString *)clickSource
linkMeUrl:(NSString * _Nullable)linkMeUrl {

NSMutableDictionary *parameters = [NSMutableDictionary dictionary];

if (linkMeUrl != nil) {
[ADJPackageBuilder parameters:parameters
setString:linkMeUrl
forKey:@"content"];
}

return [self buildClickPackage:clickSource extraParameters:parameters];
}

- (ADJActivityPackage *)buildClickPackage:(NSString *)clickSource extraParameters:(NSDictionary *)extraParameters {
NSMutableDictionary *parameters = [self getClickParameters:clickSource];
if (extraParameters != nil) {
Expand Down Expand Up @@ -451,6 +465,10 @@ - (NSMutableDictionary *)getEventParameters:(BOOL)isInDelay forEventPackage:(ADJ
[ADJPackageBuilder parameters:parameters setDate:[ADJUserDefaults getSkadRegisterCallTimestamp] forKey:@"skadn_registered_at"];
[ADJPackageBuilder parameters:parameters setDate1970:(double)self.packageParams.startedAt forKey:@"started_at"];

if (event.transactionId) {
[ADJPackageBuilder parameters:parameters setString:event.transactionId forKey:@"deduplication_id"];
}

if ([self.trackingStatusManager canGetAttStatus]) {
[ADJPackageBuilder parameters:parameters setInt:self.trackingStatusManager.attStatus
forKey:@"att_status"];
Expand Down Expand Up @@ -520,6 +538,7 @@ - (NSMutableDictionary *)getInfoParameters:(NSString *)source {
[ADJPackageBuilder parameters:parameters setDate:self.clickTime forKey:@"click_time"];
[ADJPackageBuilder parameters:parameters setDate1970:self.createdAt forKey:@"created_at"];
[ADJPackageBuilder parameters:parameters setString:self.deeplink forKey:@"deeplink"];
[ADJPackageBuilder parameters:parameters setString:self.reftag forKey:@"reftag"];
[ADJPackageBuilder parameters:parameters setString:self.adjustConfig.defaultTracker forKey:@"default_tracker"];
[ADJPackageBuilder parameters:parameters setDictionary:self.attributionDetails forKey:@"details"];
[ADJPackageBuilder parameters:parameters setString:self.packageParams.deviceName forKey:@"device_name"];
Expand Down Expand Up @@ -737,6 +756,7 @@ - (NSMutableDictionary *)getClickParameters:(NSString *)source {
[ADJPackageBuilder parameters:parameters setDate:self.clickTime forKey:@"click_time"];
[ADJPackageBuilder parameters:parameters setDate1970:self.createdAt forKey:@"created_at"];
[ADJPackageBuilder parameters:parameters setString:self.deeplink forKey:@"deeplink"];
[ADJPackageBuilder parameters:parameters setString:self.reftag forKey:@"reftag"];
[ADJPackageBuilder parameters:parameters setString:self.adjustConfig.defaultTracker forKey:@"default_tracker"];
[ADJPackageBuilder parameters:parameters setDictionary:self.attributionDetails forKey:@"details"];
[ADJPackageBuilder parameters:parameters setString:self.packageParams.deviceName forKey:@"device_name"];
Expand Down Expand Up @@ -917,6 +937,7 @@ - (NSMutableDictionary *)getDisableThirdPartySharingParameters {
[ADJPackageBuilder parameters:parameters setDate:self.clickTime forKey:@"click_time"];
[ADJPackageBuilder parameters:parameters setDate1970:self.createdAt forKey:@"created_at"];
[ADJPackageBuilder parameters:parameters setString:self.deeplink forKey:@"deeplink"];
[ADJPackageBuilder parameters:parameters setString:self.reftag forKey:@"reftag"];
[ADJPackageBuilder parameters:parameters setString:self.adjustConfig.defaultTracker forKey:@"default_tracker"];
[ADJPackageBuilder parameters:parameters setDictionary:self.attributionDetails forKey:@"details"];
[ADJPackageBuilder parameters:parameters setString:self.packageParams.deviceName forKey:@"device_name"];
Expand Down Expand Up @@ -984,6 +1005,7 @@ - (NSMutableDictionary *)getThirdPartySharingParameters:(nonnull ADJThirdPartySh
[ADJPackageBuilder parameters:parameters setDate:self.clickTime forKey:@"click_time"];
[ADJPackageBuilder parameters:parameters setDate1970:self.createdAt forKey:@"created_at"];
[ADJPackageBuilder parameters:parameters setString:self.deeplink forKey:@"deeplink"];
[ADJPackageBuilder parameters:parameters setString:self.reftag forKey:@"reftag"];
[ADJPackageBuilder parameters:parameters setString:self.adjustConfig.defaultTracker forKey:@"default_tracker"];
[ADJPackageBuilder parameters:parameters setDictionary:self.attributionDetails forKey:@"details"];
[ADJPackageBuilder parameters:parameters setString:self.packageParams.deviceName forKey:@"device_name"];
Expand Down Expand Up @@ -1057,6 +1079,7 @@ - (NSMutableDictionary *)getMeasurementConsentParameters:(BOOL)enabled {
[ADJPackageBuilder parameters:parameters setDate:self.clickTime forKey:@"click_time"];
[ADJPackageBuilder parameters:parameters setDate1970:self.createdAt forKey:@"created_at"];
[ADJPackageBuilder parameters:parameters setString:self.deeplink forKey:@"deeplink"];
[ADJPackageBuilder parameters:parameters setString:self.reftag forKey:@"reftag"];
[ADJPackageBuilder parameters:parameters setString:self.adjustConfig.defaultTracker forKey:@"default_tracker"];
[ADJPackageBuilder parameters:parameters setDictionary:self.attributionDetails forKey:@"details"];
[ADJPackageBuilder parameters:parameters setString:self.packageParams.deviceName forKey:@"device_name"];
Expand Down
4 changes: 4 additions & 0 deletions Adjust/ADJUserDefaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,8 @@

+ (NSDate *)getSkadRegisterCallTimestamp;

+ (void)setLinkMeChecked;

+ (BOOL)getLinkMeChecked;

@end
10 changes: 10 additions & 0 deletions Adjust/ADJUserDefaults.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
static NSString * const PREFS_KEY_IAD_ERRORS = @"adj_iad_errors";
static NSString * const PREFS_KEY_ADSERVICES_TRACKED = @"adj_adservices_tracked";
static NSString * const PREFS_KEY_SKAD_REGISTER_CALL_TIME = @"adj_skad_register_call_time";
static NSString * const PREFS_KEY_LINK_ME_CHECKED = @"adj_link_me_checked";

@implementation ADJUserDefaults

Expand Down Expand Up @@ -138,6 +139,14 @@ + (NSDate *)getSkadRegisterCallTimestamp {
return [[NSUserDefaults standardUserDefaults] objectForKey:PREFS_KEY_SKAD_REGISTER_CALL_TIME];
}

+ (void)setLinkMeChecked {
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:PREFS_KEY_LINK_ME_CHECKED];
}

+ (BOOL)getLinkMeChecked {
return [[NSUserDefaults standardUserDefaults] boolForKey:PREFS_KEY_LINK_ME_CHECKED];
}

+ (void)clearAdjustStuff {
[[NSUserDefaults standardUserDefaults] removeObjectForKey:PREFS_KEY_PUSH_TOKEN_DATA];
[[NSUserDefaults standardUserDefaults] removeObjectForKey:PREFS_KEY_PUSH_TOKEN_STRING];
Expand All @@ -149,6 +158,7 @@ + (void)clearAdjustStuff {
[[NSUserDefaults standardUserDefaults] removeObjectForKey:PREFS_KEY_IAD_ERRORS];
[[NSUserDefaults standardUserDefaults] removeObjectForKey:PREFS_KEY_ADSERVICES_TRACKED];
[[NSUserDefaults standardUserDefaults] removeObjectForKey:PREFS_KEY_SKAD_REGISTER_CALL_TIME];
[[NSUserDefaults standardUserDefaults] removeObjectForKey:PREFS_KEY_LINK_ME_CHECKED];
}

@end
2 changes: 1 addition & 1 deletion Adjust/ADJUtil.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
static NSRegularExpression *shortUniversalLinkRegex = nil;
static NSRegularExpression *excludedDeeplinkRegex = nil;

static NSString * const kClientSdk = @"ios4.30.0";
static NSString * const kClientSdk = @"ios4.31.0";
static NSString * const kDeeplinkParam = @"deep_link=";
static NSString * const kSchemeDelimiter = @"://";
static NSString * const kDefaultScheme = @"AdjustUniversalScheme";
Expand Down
2 changes: 1 addition & 1 deletion Adjust/Adjust.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Adjust.h
// Adjust SDK
//
// V4.30.0
// V4.31.0
// Created by Christian Wellenbrock (@wellle) on 23rd July 2013.
// Copyright (c) 2012-2021 Adjust GmbH. All rights reserved.
//
Expand Down
4 changes: 4 additions & 0 deletions AdjustBridge/AdjustBridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ - (void)loadWKWebViewBridge:(WKWebView *)wkWebView
NSString *logLevel = [data objectForKey:@"logLevel"];
NSNumber *eventBufferingEnabled = [data objectForKey:@"eventBufferingEnabled"];
NSNumber *coppaCompliantEnabled = [data objectForKey:@"coppaCompliantEnabled"];
NSNumber *linkMeEnabled = [data objectForKey:@"linkMeEnabled"];
NSNumber *sendInBackground = [data objectForKey:@"sendInBackground"];
NSNumber *delayStart = [data objectForKey:@"delayStart"];
NSString *userAgent = [data objectForKey:@"userAgent"];
Expand Down Expand Up @@ -243,6 +244,9 @@ - (void)loadWKWebViewBridge:(WKWebView *)wkWebView
if ([self isFieldValid:coppaCompliantEnabled]) {
[adjustConfig setCoppaCompliantEnabled:[coppaCompliantEnabled boolValue]];
}
if ([self isFieldValid:linkMeEnabled]) {
[adjustConfig setLinkMeEnabled:[linkMeEnabled boolValue]];
}
if ([self isFieldValid:sendInBackground]) {
[adjustConfig setSendInBackground:[sendInBackground boolValue]];
}
Expand Down
6 changes: 5 additions & 1 deletion AdjustBridge/AdjustBridgeRegister.m
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ + (NSString *)adjust_js {
if (this.sdkPrefix) {
return this.sdkPrefix;
} else {
return 'web-bridge4.30.0';
return 'web-bridge4.31.0';
}
},
setTestOptions: function(testOptions) {
Expand Down Expand Up @@ -324,6 +324,7 @@ + (NSString *)adjust_js {
this.logLevel = null;
this.eventBufferingEnabled = null;
this.coppaCompliantEnabled = null;
this.linkMeEnabled = null;
this.sendInBackground = null;
this.delayStart = null;
this.userAgent = null;
Expand Down Expand Up @@ -405,6 +406,9 @@ + (NSString *)adjust_js {
AdjustConfig.prototype.setCoppaCompliantEnabled = function(isEnabled) {
this.coppaCompliantEnabled = isEnabled;
};
AdjustConfig.prototype.setLinkMeEnabled = function(isEnabled) {
this.linkMeEnabled = isEnabled;
};
AdjustConfig.prototype.setSendInBackground = function(isEnabled) {
this.sendInBackground = isEnabled;
};
Expand Down
23 changes: 23 additions & 0 deletions AdjustSdkImStatic/AdjustSdkIm.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// AdjustSdkImStatic.h
// AdjustSdkImStatic
//
// Created by Genady Buchatsky on 14.03.22.
// Copyright © 2022 Adjust GmbH. All rights reserved.
//

#import <UIKit/UIKit.h>

#import <AdjustSdkIm/Adjust.h>
#import <AdjustSdkIm/ADJEvent.h>
#import <AdjustSdkIm/ADJThirdPartySharing.h>
#import <AdjustSdkIm/ADJConfig.h>
#import <AdjustSdkIm/ADJLogger.h>
#import <AdjustSdkIm/ADJAttribution.h>
#import <AdjustSdkIm/ADJSubscription.h>
#import <AdjustSdkIm/ADJEventSuccess.h>
#import <AdjustSdkIm/ADJEventFailure.h>
#import <AdjustSdkIm/ADJSessionSuccess.h>
#import <AdjustSdkIm/ADJSessionFailure.h>
#import <AdjustSdkIm/ADJAdRevenue.h>
#import <AdjustSdkIm/ADJLinkResolution.h>
6 changes: 6 additions & 0 deletions AdjustSdkImStatic/module.modulemap
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
framework module AdjustSdkIm {
umbrella header "AdjustSdkIm.h"

export *
module * { export * }
}
23 changes: 23 additions & 0 deletions AdjustSdkStatic/AdjustSdk.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// AdjustSdkStatic.h
// AdjustSdkStatic
//
// Created by Genady Buchatsky on 12.03.22.
// Copyright © 2022 Adjust GmbH. All rights reserved.
//

#import <UIKit/UIKit.h>

#import <AdjustSdk/Adjust.h>
#import <AdjustSdk/ADJEvent.h>
#import <AdjustSdk/ADJThirdPartySharing.h>
#import <AdjustSdk/ADJConfig.h>
#import <AdjustSdk/ADJLogger.h>
#import <AdjustSdk/ADJAttribution.h>
#import <AdjustSdk/ADJSubscription.h>
#import <AdjustSdk/ADJEventSuccess.h>
#import <AdjustSdk/ADJEventFailure.h>
#import <AdjustSdk/ADJSessionSuccess.h>
#import <AdjustSdk/ADJSessionFailure.h>
#import <AdjustSdk/ADJAdRevenue.h>
#import <AdjustSdk/ADJLinkResolution.h>
6 changes: 6 additions & 0 deletions AdjustSdkStatic/module.modulemap
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
framework module AdjustSdk {
umbrella header "AdjustSdk.h"

export *
module * { export * }
}
Loading

0 comments on commit 881842e

Please sign in to comment.