Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 4.18.0 #379

Merged
merged 27 commits into from
Jun 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5d01260
Adding ad_revenue activity kind
uerceg May 13, 2019
9d64d1a
Resolving some of the Xcode 10 warnings
uerceg May 14, 2019
1e42cfe
Adding trackAdRevenue method to front facing API (no implementation)
uerceg May 14, 2019
48e9b79
Add building of ad revenue package to ADJPackageBuilder
uerceg May 14, 2019
1512396
Take source and payload into consideration for signature
uerceg May 14, 2019
50c1fcc
Implement processing of ad revenue package
uerceg May 14, 2019
f6ec7e8
Add mopub ad revenue constant string
uerceg May 14, 2019
3ad791c
Reorganisation
uerceg May 14, 2019
a5a7d17
Add ad revenue package handling to command executor
uerceg May 14, 2019
e95d854
New version 4.18.0
uerceg May 14, 2019
327d08d
Added reading of FB anonymous ID
uerceg May 15, 2019
b861199
Adding FB anonymous ID to ADJDeviceInfo
uerceg May 15, 2019
b9d9b4b
Pack fb_anon_id next to fb_id if available
uerceg May 15, 2019
3974c73
Add ad revenue constants
uerceg May 15, 2019
d4f1678
Update README.md
uerceg May 15, 2019
de9f1c0
Update adobe.md
May 15, 2019
84a616b
Allow event name to be sent
uerceg May 16, 2019
d8be587
Check for fb_anon_id in device info
uerceg May 17, 2019
c7bd4f1
Update README.md
uerceg May 17, 2019
c75cfc1
Update CHANGELOG.md
uerceg May 20, 2019
71598ee
trackAdrevenue -> trackAdRevenue
uerceg May 20, 2019
edfc99a
Add mopub.md
uerceg Jun 25, 2019
a7518e4
Update mopub.md
uerceg Jun 25, 2019
fc45135
Update README.md
uerceg Jun 25, 2019
e7b66d6
Update CHANGELOG.md
uerceg Jun 25, 2019
52f887e
Update README.md
uerceg Jun 25, 2019
cace968
Disallow empty event token
uerceg Jun 26, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.17.3"
s.version = "4.18.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 = { "Christian Wellenbrock" => "welle@adjust.com" }
s.source = { :git => "https://github.com/adjust/ios_sdk.git", :tag => "v4.17.3" }
s.source = { :git => "https://github.com/adjust/ios_sdk.git", :tag => "v4.18.0" }
s.ios.deployment_target = '6.0'
s.tvos.deployment_target = '9.0'
s.framework = 'SystemConfiguration'
Expand Down
4 changes: 2 additions & 2 deletions Adjust.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2209,7 +2209,7 @@
9679920518BBAE2800394606 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1010;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = "adjust GmbH";
TargetAttributes = {
9615158E1CD2CB2C0022D336 = {
Expand Down Expand Up @@ -2244,7 +2244,7 @@
};
buildConfigurationList = 9679920818BBAE2800394606 /* Build configuration list for PBXProject "Adjust" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Expand Down
2 changes: 1 addition & 1 deletion Adjust.xcodeproj/xcshareddata/xcschemes/AdjustSdk.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
1 change: 1 addition & 0 deletions Adjust/ADJActivityHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
- (void)removeSessionPartnerParameter:(NSString *)key;
- (void)resetSessionCallbackParameters;
- (void)resetSessionPartnerParameters;
- (void)trackAdRevenue:(NSString *)soruce payload:(NSData *)payload;
- (NSString *)getBasePath;
- (NSString *)getGdprPath;

Expand Down
34 changes: 34 additions & 0 deletions Adjust/ADJActivityHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,14 @@ - (void)resetSessionPartnerParameters {
}];
}

- (void)trackAdRevenue:(NSString *)source payload:(NSData *)payload {
[ADJUtil launchInQueue:self.internalQueue
selfInject:self
block:^(ADJActivityHandler * selfI) {
[selfI adRevenueI:selfI source:source payload:payload];
}];
}

- (NSString *)getBasePath {
return _basePath;
}
Expand Down Expand Up @@ -939,6 +947,32 @@ - (void)eventI:(ADJActivityHandler *)selfI
[selfI writeActivityStateI:selfI];
}

- (void)adRevenueI:(ADJActivityHandler *)selfI
source:(NSString *)source
payload:(NSData *)payload {
if (!selfI.activityState) {
return;
}
if (![selfI isEnabledI:selfI]) {
return;
}
if (selfI.activityState.isGdprForgotten) {
return;
}

double now = [NSDate.date timeIntervalSince1970];

// Create and submit ad revenue package.
ADJPackageBuilder *adRevenueBuilder = [[ADJPackageBuilder alloc] initWithDeviceInfo:selfI.deviceInfo
activityState:selfI.activityState
config:selfI.adjustConfig
sessionParameters:selfI.sessionParameters
createdAt:now];
ADJActivityPackage *adRevenuePackage = [adRevenueBuilder buildAdRevenuePackage:source payload:payload];
[selfI.packageHandler addPackage:adRevenuePackage];
[selfI.packageHandler sendFirstPackage];
}

- (void)launchEventResponseTasksI:(ADJActivityHandler *)selfI
eventResponseData:(ADJEventResponseData *)eventResponseData {
[selfI updateAdidI:selfI adid:eventResponseData.adid];
Expand Down
17 changes: 9 additions & 8 deletions Adjust/ADJActivityKind.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
#endif

typedef NS_ENUM(int, ADJActivityKind) {
ADJActivityKindUnknown = 0,
ADJActivityKindSession = 1,
ADJActivityKindEvent = 2,
// ADJActivityKindRevenue = 3,
ADJActivityKindClick = 4,
ADJActivityKindAttribution = 5,
ADJActivityKindInfo = 6,
ADJActivityKindGdpr = 7
ADJActivityKindUnknown = 0,
ADJActivityKindSession = 1,
ADJActivityKindEvent = 2,
// ADJActivityKindRevenue = 3,
ADJActivityKindClick = 4,
ADJActivityKindAttribution = 5,
ADJActivityKindInfo = 6,
ADJActivityKindGdpr = 7,
ADJActivityKindAdRevenue = 8
};

@interface ADJActivityKindUtil : NSObject
Expand Down
4 changes: 4 additions & 0 deletions Adjust/ADJActivityKind.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ + (ADJActivityKind)activityKindFromString:(NSString *)activityKindString {
return ADJActivityKindInfo;
} else if ([@"gdpr" isEqualToString:activityKindString]) {
return ADJActivityKindGdpr;
} else if ([@"ad_revenue" isEqualToString:activityKindString]) {
return ADJActivityKindAdRevenue;
} else {
return ADJActivityKindUnknown;
}
Expand All @@ -44,6 +46,8 @@ + (NSString *)activityKindToString:(ADJActivityKind)activityKind {
return @"info";
case ADJActivityKindGdpr:
return @"gdpr";
case ADJActivityKindAdRevenue:
return @"ad_revenue";
default:
return @"unknown";
}
Expand Down
1 change: 1 addition & 0 deletions Adjust/ADJAdditions/UIDevice+ADJAdditions.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

- (BOOL)adjTrackingEnabled;
- (NSString *)adjIdForAdvertisers;
- (NSString *)adjFbAnonymousId;
- (NSString *)adjFbAttributionId;
- (NSString *)adjDeviceType;
- (NSString *)adjDeviceName;
Expand Down
21 changes: 21 additions & 0 deletions Adjust/ADJAdditions/UIDevice+ADJAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,27 @@ - (NSString *)adjFbAttributionId {
#endif
}

- (NSString *)adjFbAnonymousId {
#if TARGET_OS_TV
return @"";
#else
// return [FBSDKAppEventsUtility retrievePersistedAnonymousID];
Class class = NSClassFromString(@"FBSDKAppEventsUtility");
if (class == nil) {
return @"";
}
SEL selGetId = NSSelectorFromString(@"retrievePersistedAnonymousID");
if (![class respondsToSelector:selGetId]) {
return @"";
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
NSString *fbAnonymousId = (NSString *)[class performSelector:selGetId];
#pragma clang diagnostic pop
return fbAnonymousId;
#endif
}

- (NSString *)adjDeviceType {
NSString *type = [self.model stringByReplacingOccurrencesOfString:@" " withString:@""];
return type;
Expand Down
1 change: 1 addition & 0 deletions Adjust/ADJDeviceInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
@interface ADJDeviceInfo : NSObject

@property (nonatomic, copy) NSString *idForAdvertisers;
@property (nonatomic, copy) NSString *fbAnonymousId;
@property (nonatomic, copy) NSString *fbAttributionId;
@property (nonatomic, assign) BOOL trackingEnabled;
@property (nonatomic, copy) NSString *vendorId;
Expand Down
1 change: 1 addition & 0 deletions Adjust/ADJDeviceInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ - (id)initWithSdkPrefix:(NSString *)sdkPrefix {

self.trackingEnabled = UIDevice.currentDevice.adjTrackingEnabled;
self.idForAdvertisers = UIDevice.currentDevice.adjIdForAdvertisers;
self.fbAnonymousId = UIDevice.currentDevice.adjFbAnonymousId;
self.fbAttributionId = UIDevice.currentDevice.adjFbAttributionId;
self.vendorId = UIDevice.currentDevice.adjVendorId;
self.bundeIdentifier = [infoDictionary objectForKey:(NSString *)kCFBundleIdentifierKey];
Expand Down
8 changes: 3 additions & 5 deletions Adjust/ADJEvent.m
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,15 @@ - (NSDictionary *) partnerParameters {
return (NSDictionary *) self.partnerMutableParameters;
}

- (BOOL) checkEventToken:(NSString *)eventToken {
- (BOOL)checkEventToken:(NSString *)eventToken {
if ([ADJUtil isNull:eventToken]) {
[self.logger error:@"Missing Event Token"];
return NO;
}

if (eventToken.length != 6) {
[self.logger error:@"Malformed Event Token '%@'", eventToken];
if ([eventToken length] <= 0) {
[self.logger error:@"Event Token can't be empty"];
return NO;
}

return YES;
}

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

- (ADJActivityPackage *)buildInfoPackage:(NSString *)infoSource;

- (ADJActivityPackage *)buildAdRevenuePackage:(NSString *)source payload:(NSData *)payload;

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

- (ADJActivityPackage *)buildAttributionPackage:(NSString *)initiatedBy;
Expand Down
55 changes: 55 additions & 0 deletions Adjust/ADJPackageBuilder.m
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@ - (ADJActivityPackage *)buildInfoPackage:(NSString *)infoSource {
return infoPackage;
}

- (ADJActivityPackage *)buildAdRevenuePackage:(NSString *)source payload:(NSData *)payload {
NSMutableDictionary *parameters = [self getAdRevenueParameters:source payload:payload];
ADJActivityPackage *adRevenuePackage = [self defaultActivityPackage];
adRevenuePackage.path = @"/ad_revenue";
adRevenuePackage.activityKind = ADJActivityKindAdRevenue;
adRevenuePackage.suffix = @"";
adRevenuePackage.parameters = parameters;
return adRevenuePackage;
}

- (ADJActivityPackage *)buildClickPackage:(NSString *)clickSource {
NSMutableDictionary *parameters = [self getClickParameters:clickSource];
ADJActivityPackage *clickPackage = [self defaultActivityPackage];
Expand Down Expand Up @@ -164,6 +174,7 @@ - (NSMutableDictionary *)getSessionParameters:(BOOL)isInDelay {
[ADJPackageBuilder parameters:parameters setString:self.adjustConfig.environment forKey:@"environment"];
[ADJPackageBuilder parameters:parameters setBool:self.adjustConfig.eventBufferingEnabled forKey:@"event_buffering_enabled"];
[ADJPackageBuilder parameters:parameters setString:self.deviceInfo.fbAttributionId forKey:@"fb_id"];
[ADJPackageBuilder parameters:parameters setString:self.deviceInfo.fbAnonymousId forKey:@"fb_anon_id"];
[ADJPackageBuilder parameters:parameters setString:self.deviceInfo.machineModel forKey:@"hardware_name"];
[ADJPackageBuilder parameters:parameters setString:UIDevice.currentDevice.adjIdForAdvertisers forKey:@"idfa"];
[ADJPackageBuilder parameters:parameters setString:self.deviceInfo.vendorId forKey:@"idfv"];
Expand Down Expand Up @@ -230,6 +241,7 @@ - (NSMutableDictionary *)getEventParameters:(BOOL)isInDelay forEventPackage:(ADJ
[ADJPackageBuilder parameters:parameters setString:event.callbackId forKey:@"event_callback_id"];
[ADJPackageBuilder parameters:parameters setString:event.eventToken forKey:@"event_token"];
[ADJPackageBuilder parameters:parameters setString:self.deviceInfo.fbAttributionId forKey:@"fb_id"];
[ADJPackageBuilder parameters:parameters setString:self.deviceInfo.fbAnonymousId forKey:@"fb_anon_id"];
[ADJPackageBuilder parameters:parameters setString:self.deviceInfo.machineModel forKey:@"hardware_name"];
[ADJPackageBuilder parameters:parameters setString:UIDevice.currentDevice.adjIdForAdvertisers forKey:@"idfa"];
[ADJPackageBuilder parameters:parameters setString:self.deviceInfo.vendorId forKey:@"idfv"];
Expand Down Expand Up @@ -323,6 +335,39 @@ - (NSMutableDictionary *)getInfoParameters:(NSString *)source {
return parameters;
}

- (NSMutableDictionary *)getAdRevenueParameters:(NSString *)source payload:(NSData *)payload {
NSMutableDictionary *parameters = [NSMutableDictionary dictionary];

[ADJPackageBuilder parameters:parameters setString:self.adjustConfig.appToken forKey:@"app_token"];
[ADJPackageBuilder parameters:parameters setString:self.adjustConfig.appSecret forKey:@"app_secret"];
[ADJPackageBuilder parameters:parameters setBool:YES forKey:@"attribution_deeplink"];
[ADJPackageBuilder parameters:parameters setDate1970:self.createdAt forKey:@"created_at"];
[ADJPackageBuilder parameters:parameters setString:self.adjustConfig.environment forKey:@"environment"];
[ADJPackageBuilder parameters:parameters setBool:self.adjustConfig.eventBufferingEnabled forKey:@"event_buffering_enabled"];
[ADJPackageBuilder parameters:parameters setString:UIDevice.currentDevice.adjIdForAdvertisers forKey:@"idfa"];
[ADJPackageBuilder parameters:parameters setString:self.deviceInfo.vendorId forKey:@"idfv"];
[ADJPackageBuilder parameters:parameters setBool:YES forKey:@"needs_response_details"];
[ADJPackageBuilder parameters:parameters setString:self.adjustConfig.secretId forKey:@"secret_id"];
[ADJPackageBuilder parameters:parameters setString:source forKey:@"source"];
[ADJPackageBuilder parameters:parameters setData:payload forKey:@"payload"];

if (self.adjustConfig.isDeviceKnown) {
[ADJPackageBuilder parameters:parameters setBool:self.adjustConfig.isDeviceKnown forKey:@"device_known"];
}

if (self.activityState != nil) {
[ADJPackageBuilder parameters:parameters setString:self.activityState.deviceToken forKey:@"push_token"];
if (self.activityState.isPersisted) {
[ADJPackageBuilder parameters:parameters setString:self.activityState.uuid forKey:@"persistent_ios_uuid"];
} else {
[ADJPackageBuilder parameters:parameters setString:self.activityState.uuid forKey:@"ios_uuid"];
}
}

return parameters;
}


- (NSMutableDictionary *)getClickParameters:(NSString *)source {
NSMutableDictionary *parameters = [NSMutableDictionary dictionary];

Expand All @@ -347,6 +392,7 @@ - (NSMutableDictionary *)getClickParameters:(NSString *)source {
[ADJPackageBuilder parameters:parameters setString:self.adjustConfig.environment forKey:@"environment"];
[ADJPackageBuilder parameters:parameters setBool:self.adjustConfig.eventBufferingEnabled forKey:@"event_buffering_enabled"];
[ADJPackageBuilder parameters:parameters setString:self.deviceInfo.fbAttributionId forKey:@"fb_id"];
[ADJPackageBuilder parameters:parameters setString:self.deviceInfo.fbAnonymousId forKey:@"fb_anon_id"];
[ADJPackageBuilder parameters:parameters setString:self.deviceInfo.machineModel forKey:@"hardware_name"];
[ADJPackageBuilder parameters:parameters setString:UIDevice.currentDevice.adjIdForAdvertisers forKey:@"idfa"];
[ADJPackageBuilder parameters:parameters setString:self.deviceInfo.vendorId forKey:@"idfv"];
Expand Down Expand Up @@ -555,4 +601,13 @@ + (void)parameters:(NSMutableDictionary *)parameters setNumberInt:(NSNumber *)va
[ADJPackageBuilder parameters:parameters setInt:[value intValue] forKey:key];
}

+ (void)parameters:(NSMutableDictionary *)parameters setData:(NSData *)value forKey:(NSString *)key {
if (value == nil) {
return;
}
[ADJPackageBuilder parameters:parameters
setString:[[NSString alloc] initWithData:value encoding:NSUTF8StringEncoding]
forKey:key];
}

@end
12 changes: 9 additions & 3 deletions Adjust/ADJUtil.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
static CTTelephonyNetworkInfo *networkInfo = nil;
#endif

static NSString * const kClientSdk = @"ios4.17.3";
static NSString * const kClientSdk = @"ios4.18.0";
static NSString * const kDeeplinkParam = @"deep_link=";
static NSString * const kSchemeDelimiter = @"://";
static NSString * const kDefaultScheme = @"AdjustUniversalScheme";
Expand Down Expand Up @@ -677,18 +677,24 @@ + (NSString *)buildAuthorizationHeader:(NSString *)appSecret
+ (NSDictionary *)buildSignatureParameters:(NSMutableDictionary *)parameters
appSecret:(NSString *)appSecret
activityKindS:(NSString *)activityKindS {
NSString *appSecretName = @"app_secret";
NSString *sourceName = @"source";
NSString *payloadName = @"payload";
NSString *activityKindName = @"activity_kind";
NSString *activityKindValue = activityKindS;
NSString *createdAtName = @"created_at";
NSString *createdAtValue = [parameters objectForKey:createdAtName];
NSString *deviceIdentifierName = [ADJUtil getValidIdentifier:parameters];
NSString *deviceIdentifierValue = [parameters objectForKey:deviceIdentifierName];
NSMutableDictionary *signatureParameters = [[NSMutableDictionary alloc] initWithCapacity:4];
NSMutableDictionary *signatureParameters = [[NSMutableDictionary alloc] initWithCapacity:6];

[ADJUtil checkAndAddEntry:signatureParameters key:@"app_secret" value:appSecret];
[ADJUtil checkAndAddEntry:signatureParameters key:appSecretName value:appSecret];
[ADJUtil checkAndAddEntry:signatureParameters key:createdAtName value:createdAtValue];
[ADJUtil checkAndAddEntry:signatureParameters key:activityKindName value:activityKindValue];
[ADJUtil checkAndAddEntry:signatureParameters key:deviceIdentifierName value:deviceIdentifierValue];
[ADJUtil checkAndAddEntry:signatureParameters key:sourceName value:parameters[sourceName]];
[ADJUtil checkAndAddEntry:signatureParameters key:payloadName value:parameters[payloadName]];

return signatureParameters;
}

Expand Down
Loading