Skip to content

Commit

Permalink
Merge pull request #276 from adjust/v4111
Browse files Browse the repository at this point in the history
Version 4.11.1
  • Loading branch information
uerceg authored Mar 13, 2017
2 parents 00fecbe + 898fe5d commit d147292
Show file tree
Hide file tree
Showing 139 changed files with 3,170 additions and 4,770 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.11.0"
s.version = "4.11.1"
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" => "[email protected]" }
s.source = { :git => "https://github.com/adjust/ios_sdk.git", :tag => "v4.11.0" }
s.source = { :git => "https://github.com/adjust/ios_sdk.git", :tag => "v4.11.1" }
s.ios.deployment_target = '6.0'
s.tvos.deployment_target = '9.0'
s.framework = 'SystemConfiguration'
Expand Down
263 changes: 235 additions & 28 deletions Adjust.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

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 = "0730"
LastUpgradeVersion = "0820"
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 = "0810"
LastUpgradeVersion = "0820"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
4 changes: 4 additions & 0 deletions Adjust/ADJActivityHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
@property (nonatomic, assign) BOOL background;
@property (nonatomic, assign) BOOL delayStart;
@property (nonatomic, assign) BOOL updatePackages;
@property (nonatomic, assign) BOOL firstLaunch;
@property (nonatomic, assign) BOOL sessionResponseProcessed;

- (id)init;

Expand All @@ -28,6 +30,8 @@
- (BOOL)isDelayStart;
- (BOOL)isToStartNow;
- (BOOL)isToUpdatePackages;
- (BOOL)isFirstLaunch;
- (BOOL)hasSessionResponseNotProcessed;

@end

Expand Down
20 changes: 17 additions & 3 deletions Adjust/ADJActivityHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ - (BOOL)isForeground { return !self.background; }
- (BOOL)isDelayStart { return self.delayStart; }
- (BOOL)isToStartNow { return !self.delayStart; }
- (BOOL)isToUpdatePackages { return self.updatePackages; }
- (BOOL)isFirstLaunch { return self.firstLaunch; }
- (BOOL)hasSessionResponseNotProcessed { return !self.sessionResponseProcessed; }

@end

Expand Down Expand Up @@ -158,6 +160,13 @@ - (id)initWithConfig:(ADJConfig *)adjustConfig
} else {
self.internalState.updatePackages = self.activityState.updatePackages;
}
if (self.activityState == nil) {
self.internalState.firstLaunch = YES;
} else {
self.internalState.firstLaunch = NO;
}
// does not have the session response by default
self.internalState.sessionResponseProcessed = NO;
self.deviceTokenData = deviceToken;

self.internalQueue = dispatch_queue_create(kInternalQueueName, DISPATCH_QUEUE_SERIAL);
Expand Down Expand Up @@ -794,9 +803,12 @@ - (void)transferSessionPackageI:(ADJActivityHandler *)selfI
- (void)checkAttributionStateI:(ADJActivityHandler *)selfI {
if (![selfI checkActivityStateI:selfI]) return;

// if it' a new session
if (selfI.activityState.subsessionCount <= 1) {
return;
// if it's the first launch
if ([selfI.internalState isFirstLaunch]) {
// and it hasn't received the session response
if ([selfI.internalState hasSessionResponseNotProcessed]) {
return;
}
}

// if there is already an attribution saved and there was no attribution being asked
Expand Down Expand Up @@ -911,6 +923,8 @@ - (void)launchSessionResponseTasksI:(ADJActivityHandler *)selfI
selector:@selector(adjustAttributionChanged:)
withObject:sessionResponseData.attribution];
}

self.internalState.sessionResponseProcessed = YES;
}

- (void)launchAttributionResponseTasksI:(ADJActivityHandler *)selfI
Expand Down
5 changes: 3 additions & 2 deletions Adjust/ADJActivityKind.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@ typedef NS_ENUM(int, ADJActivityKind) {
ADJActivityKindUnknown = 0,
ADJActivityKindSession = 1,
ADJActivityKindEvent = 2,
// ADJActivityKindRevenue = 3,
// ADJActivityKindRevenue = 3,
ADJActivityKindClick = 4,
ADJActivityKindAttribution = 5,
ADJActivityKindInfo = 6,
};

@interface ADJActivityKindUtil : NSObject

+ (NSString *)activityKindToString:(ADJActivityKind)activityKind;

+ (ADJActivityKind)activityKindFromString:(NSString *)activityKindString;
+ (NSString*)activityKindToString:(ADJActivityKind)activityKind;

@end
23 changes: 17 additions & 6 deletions Adjust/ADJActivityKind.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

@implementation ADJActivityKindUtil

#pragma mark - Public methods

+ (ADJActivityKind)activityKindFromString:(NSString *)activityKindString {
if ([@"session" isEqualToString:activityKindString]) {
return ADJActivityKindSession;
Expand All @@ -19,18 +21,27 @@ + (ADJActivityKind)activityKindFromString:(NSString *)activityKindString {
return ADJActivityKindClick;
} else if ([@"attribution" isEqualToString:activityKindString]) {
return ADJActivityKindAttribution;
} else if ([@"info" isEqualToString:activityKindString]) {
return ADJActivityKindInfo;
} else {
return ADJActivityKindUnknown;
}
}

+ (NSString*)activityKindToString:(ADJActivityKind)activityKind {
+ (NSString *)activityKindToString:(ADJActivityKind)activityKind {
switch (activityKind) {
case ADJActivityKindSession: return @"session";
case ADJActivityKindEvent: return @"event";
case ADJActivityKindClick: return @"click";
case ADJActivityKindAttribution: return @"attribution";
default: return @"unknown";
case ADJActivityKindSession:
return @"session";
case ADJActivityKindEvent:
return @"event";
case ADJActivityKindClick:
return @"click";
case ADJActivityKindAttribution:
return @"attribution";
case ADJActivityKindInfo:
return @"info";
default:
return @"unknown";
}
}

Expand Down
19 changes: 14 additions & 5 deletions Adjust/ADJActivityPackage.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,34 @@

@interface ADJActivityPackage : NSObject <NSCoding>

// data
// Data

@property (nonatomic, copy) NSString *path;

@property (nonatomic, copy) NSString *clientSdk;
@property (nonatomic, strong) NSMutableDictionary *parameters;

@property (nonatomic, assign) NSInteger retries;

@property (nonatomic, strong) NSDictionary *callbackParameters;
@property (nonatomic, strong) NSMutableDictionary *parameters;

@property (nonatomic, strong) NSDictionary *partnerParameters;

// logs
@property (nonatomic, assign) ADJActivityKind activityKind;
@property (nonatomic, strong) NSDictionary *callbackParameters;

// Logs

@property (nonatomic, copy) NSString *suffix;

@property (nonatomic, assign) ADJActivityKind activityKind;

- (NSString *)extendedString;

- (NSString *)successMessage;

- (NSString *)failureMessage;

- (NSInteger)getRetries;

- (NSInteger)increaseRetries;

@end
62 changes: 33 additions & 29 deletions Adjust/ADJActivityPackage.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,84 +6,88 @@
// Copyright (c) 2013 adjust GmbH. All rights reserved.
//

#import "ADJActivityPackage.h"
#import "ADJActivityKind.h"
#import "ADJActivityPackage.h"

#pragma mark -
@implementation ADJActivityPackage

- (NSString *)description {
return [NSString stringWithFormat:@"%@%@",
[ADJActivityKindUtil activityKindToString:self.activityKind],
self.suffix];
}
#pragma mark - Public methods

- (NSString *)extendedString {
NSMutableString *builder = [NSMutableString string];

[builder appendFormat:@"Path: %@\n", self.path];
[builder appendFormat:@"ClientSdk: %@\n", self.clientSdk];

if (self.parameters != nil) {
NSArray * sortedKeys = [[self.parameters allKeys] sortedArrayUsingSelector:@selector(localizedStandardCompare:)];
NSArray *sortedKeys = [[self.parameters allKeys] sortedArrayUsingSelector:@selector(localizedStandardCompare:)];
NSUInteger keyCount = [sortedKeys count];

[builder appendFormat:@"Parameters:"];
for (int i = 0; i < keyCount; i++) {

for (NSUInteger i = 0; i < keyCount; i++) {
NSString *key = (NSString*)[sortedKeys objectAtIndex:i];
NSString *value = [self.parameters objectForKey:key];

[builder appendFormat:@"\n\t\t%-22s %@", [key UTF8String], value];
}
}

return builder;
}

- (NSString *)successMessage {
return [NSString stringWithFormat:@"Tracked %@%@",
[ADJActivityKindUtil activityKindToString:self.activityKind],
self.suffix];
}

- (NSString *)failureMessage {
return [NSString stringWithFormat:@"Failed to track %@%@",
[ADJActivityKindUtil activityKindToString:self.activityKind],
self.suffix];
}

- (NSInteger)getRetries {
return self.retries;
}

- (NSInteger)increaseRetries {
self.retries = self.retries + 1;

return self.retries;
}

#pragma mark NSCoding
- (NSString *)description {
return [NSString stringWithFormat:@"%@%@", [ADJActivityKindUtil activityKindToString:self.activityKind], self.suffix];
}

- (NSString *)successMessage {
return [NSString stringWithFormat:@"Tracked %@%@", [ADJActivityKindUtil activityKindToString:self.activityKind], self.suffix];
}

- (NSString *)failureMessage {
return [NSString stringWithFormat:@"Failed to track %@%@", [ADJActivityKindUtil activityKindToString:self.activityKind], self.suffix];
}

#pragma mark - NSCoding protocol methods

- (id)initWithCoder:(NSCoder *)decoder {
self = [super init];
if (self == nil) return self;

if (self == nil) {
return self;
}

self.path = [decoder decodeObjectForKey:@"path"];
self.suffix = [decoder decodeObjectForKey:@"suffix"];
self.clientSdk = [decoder decodeObjectForKey:@"clientSdk"];
self.parameters = [decoder decodeObjectForKey:@"parameters"];
NSString *kindString = [decoder decodeObjectForKey:@"kind"];
self.suffix = [decoder decodeObjectForKey:@"suffix"];
self.partnerParameters = [decoder decodeObjectForKey:@"partnerParameters"];
self.callbackParameters = [decoder decodeObjectForKey:@"callbackParameters"];

NSString *kindString = [decoder decodeObjectForKey:@"kind"];
self.activityKind = [ADJActivityKindUtil activityKindFromString:kindString];

self.callbackParameters = [decoder decodeObjectForKey:@"callbackParameters"];
self.partnerParameters = [decoder decodeObjectForKey:@"partnerParameters"];
return self;
}

- (void)encodeWithCoder:(NSCoder *)encoder {
NSString *kindString = [ADJActivityKindUtil activityKindToString:self.activityKind];

[encoder encodeObject:self.path forKey:@"path"];
[encoder encodeObject:self.clientSdk forKey:@"clientSdk"];
[encoder encodeObject:self.parameters forKey:@"parameters"];
[encoder encodeObject:kindString forKey:@"kind"];
[encoder encodeObject:self.suffix forKey:@"suffix"];
[encoder encodeObject:self.clientSdk forKey:@"clientSdk"];
[encoder encodeObject:self.parameters forKey:@"parameters"];
[encoder encodeObject:self.callbackParameters forKey:@"callbackParameters"];
[encoder encodeObject:self.partnerParameters forKey:@"partnerParameters"];
}
Expand Down
Loading

0 comments on commit d147292

Please sign in to comment.