Skip to content

Commit 4f5792d

Browse files
committed
Merge pull request #52 from adjust/development
Add push token
2 parents 761c19d + f8b500b commit 4f5792d

File tree

15 files changed

+72
-13
lines changed

15 files changed

+72
-13
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 = "3.3.4"
3+
s.version = "3.3.5"
44
s.summary = "This is the iOS SDK of adjust. You can read more about it at http://adjust.com."
55
s.homepage = "http://adjust.com"
66
s.license = { :type => 'MIT', :file => 'MIT-LICENSE' }
77
s.author = { "Christian Wellenbrock" => "[email protected]" }
8-
s.source = { :git => "https://github.com/adjust/ios_sdk.git", :tag => "v3.3.4" }
8+
s.source = { :git => "https://github.com/adjust/ios_sdk.git", :tag => "v3.3.5" }
99
s.platform = :ios, '4.3'
1010
s.framework = 'SystemConfiguration'
1111
s.weak_framework = 'AdSupport', 'iAd'

Adjust.xcodeproj/project.pbxproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,9 @@
336336
isa = PBXProject;
337337
attributes = {
338338
LastUpgradeCheck = 0510;
339-
ORGANIZATIONNAME = adjust;
339+
ORGANIZATIONNAME = "adjust GmbH";
340340
};
341-
buildConfigurationList = 9679920818BBAE2800394606 /* Build configuration list for PBXProject "Adjust" */;
341+
buildConfigurationList = 9679920818BBAE2800394606 /* Build configuration list for PBXProject "adjust" */;
342342
compatibilityVersion = "Xcode 3.2";
343343
developmentRegion = English;
344344
hasScannedForEncodings = 0;
@@ -577,7 +577,7 @@
577577
/* End XCBuildConfiguration section */
578578

579579
/* Begin XCConfigurationList section */
580-
9679920818BBAE2800394606 /* Build configuration list for PBXProject "Adjust" */ = {
580+
9679920818BBAE2800394606 /* Build configuration list for PBXProject "adjust" */ = {
581581
isa = XCConfigurationList;
582582
buildConfigurations = (
583583
9679922E18BBAE2800394606 /* Debug */,

Adjust/AIActivityHandler.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
- (void)setEnabled:(BOOL)enabled;
3434
- (BOOL)isEnabled;
3535
- (void)readOpenUrl:(NSURL*)url;
36+
- (void)savePushToken:(NSData *)pushToken;
3637

3738
@end
3839

Adjust/AIActivityHandler.m

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ @interface AIActivityHandler()
4949
@property (nonatomic, assign) BOOL internalEnabled;
5050
@property (nonatomic, assign) BOOL isIad;
5151
@property (nonatomic, copy) NSString *vendorId;
52+
@property (nonatomic, copy) NSString *pushToken;
5253

5354
@end
5455

@@ -153,6 +154,12 @@ - (void)readOpenUrl:(NSURL*)url {
153154
});
154155
}
155156

157+
- (void)savePushToken:(NSData *)pushToken {
158+
dispatch_async(self.internalQueue, ^{
159+
[self savePushTokenInternal:pushToken];
160+
});
161+
}
162+
156163
#pragma mark - internal
157164
- (void)initInternal:(NSString *)yourAppToken {
158165
if (![self checkAppTokenNotNil:yourAppToken]) return;
@@ -364,6 +371,17 @@ - (void) readOpenUrlInternal:(NSURL *)url {
364371
[self.logger debug:@"Reattribution %@", adjustDeepLinks];
365372
}
366373

374+
- (void) savePushTokenInternal:(NSData *)pushToken {
375+
if (pushToken == nil) {
376+
return;
377+
}
378+
379+
NSString *token = [pushToken.description stringByTrimmingCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:@"<>"]];
380+
token = [token stringByReplacingOccurrencesOfString:@" " withString:@""];
381+
382+
self.pushToken = token;
383+
}
384+
367385
#pragma mark - private
368386

369387
// returns whether or not the activity state should be written
@@ -446,6 +464,7 @@ - (void)injectGeneralAttributes:(AIPackageBuilder *)builder {
446464
builder.environment = self.environment;
447465
builder.isIad = self.isIad;
448466
builder.vendorId = self.vendorId;
467+
builder.pushToken = self.pushToken;
449468

450469
if (self.trackMacMd5) {
451470
builder.macShortMd5 = self.macShortMd5;

Adjust/AIPackageBuilder.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
@property (nonatomic, assign) BOOL trackingEnabled;
2525
@property (nonatomic, assign) BOOL isIad;
2626
@property (nonatomic, copy) NSString *vendorId;
27+
@property (nonatomic, copy) NSString *pushToken;
2728

2829
// sessions
2930
@property (nonatomic, assign) int sessionCount;

Adjust/AIPackageBuilder.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ - (NSMutableDictionary *)defaultParameters {
9090
[self parameters:parameters setInt:self.trackingEnabled forKey:@"tracking_enabled"];
9191
[self parameters:parameters setBool:self.isIad forKey:@"is_iad"];
9292
[self parameters:parameters setString:self.vendorId forKey:@"idfv"];
93+
[self parameters:parameters setString:self.pushToken forKey:@"push_token"];
9394

9495
// session related (used for events as well)
9596
[self parameters:parameters setInt:self.sessionCount forKey:@"session_count"];

Adjust/AIUtil.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include <sys/xattr.h>
1515

1616
static NSString * const kBaseUrl = @"https://app.adjust.io";
17-
static NSString * const kClientSdk = @"ios3.3.4";
17+
static NSString * const kClientSdk = @"ios3.3.5";
1818

1919
static NSString * const kDateFormat = @"yyyy-MM-dd'T'HH:mm:ss'Z'Z";
2020
static NSDateFormatter * dateFormat;

Adjust/Adjust.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,11 @@ static NSString * const AIEnvironmentProduction = @"production";
169169
* an adjust deep link
170170
*/
171171
+ (void)appWillOpenUrl:(NSURL *)url;
172+
173+
/**
174+
* Set the device token used by push notifications
175+
*/
176+
+ (void)setDeviceToken:(NSData *)deviceToken;
172177
@end
173178

174179

Adjust/Adjust.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,8 @@ + (void)appWillOpenUrl:(NSURL *)url {
136136
[activityHandler readOpenUrl:url];
137137
}
138138

139+
+ (void)setDeviceToken:(NSData *)deviceToken {
140+
[activityHandler savePushToken:deviceToken];
141+
}
142+
139143
@end

AdjustTests/AIActivityHandlerMock.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,8 @@ - (void)readOpenUrl:(NSURL *)url {
7676
[self.loggerMock test:[prefix stringByAppendingFormat:@"readOpenUrl"]];
7777
}
7878

79+
- (void)savePushToken:(NSData *)pushToken {
80+
[self.loggerMock test:[prefix stringByAppendingFormat:@"savePushToken"]];
81+
}
82+
7983
@end

0 commit comments

Comments
 (0)