Skip to content

Commit

Permalink
Merge pull request #226 from adjust/v483
Browse files Browse the repository at this point in the history
V483
  • Loading branch information
nonelse authored Aug 11, 2016
2 parents 2e72882 + a51b9eb commit 5074e35
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 12 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.8.2"
s.version = "4.8.3"
s.summary = "This is the iOS SDK of adjust. You can read more about it at http://adjust.com."
s.homepage = "http://adjust.com"
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.8.2" }
s.source = { :git => "https://github.com/adjust/ios_sdk.git", :tag => "v4.8.3" }
s.ios.deployment_target = '6.0'
s.tvos.deployment_target = '9.0'
s.framework = 'SystemConfiguration'
Expand Down
35 changes: 32 additions & 3 deletions Adjust/ADJUtil.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@

static NSDateFormatter *dateFormat;
static NSRegularExpression * universalLinkRegex = nil;
static NSRegularExpression * shortUniversalLinkRegex = nil;
static NSNumberFormatter * secondsNumberFormatter = nil;

static NSString * const kClientSdk = @"ios4.8.2";
static NSString * const kClientSdk = @"ios4.8.3";
static NSString * const kDefaultScheme = @"AdjustUniversalScheme";
static NSString * const kUniversalLinkPattern = @"https://[^.]*\\.ulink\\.adjust\\.com/ulink/?(.*)";
static NSString * const kShortUniversalLinkPattern = @"http[s]?://[a-z0-9]{4}\\.adj\\.st/?(.*)";


static NSString * const kBaseUrl = @"https://app.adjust.com";
static NSString * const kDateFormat = @"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'Z";
Expand All @@ -40,6 +43,7 @@ + (void) initialize {
[self initializeDateFormat];
[self initializeUniversalLinkRegex];
[self initializeSecondsNumberFormatter];
[self initializeShortUniversalLinkRegex];
}

+ (void)initializeDateFormat {
Expand Down Expand Up @@ -69,6 +73,7 @@ + (void)initializeDateFormat {
[dateFormat setDateFormat:kDateFormat];

}

+ (void)initializeUniversalLinkRegex {
NSError *error = NULL;

Expand All @@ -85,6 +90,22 @@ + (void)initializeUniversalLinkRegex {
universalLinkRegex = regex;
}

+ (void)initializeShortUniversalLinkRegex {
NSError *error = NULL;

NSRegularExpression *regex = [NSRegularExpression
regularExpressionWithPattern:kShortUniversalLinkPattern
options:NSRegularExpressionCaseInsensitive
error:&error];

if ([ADJUtil isNotNull:error]) {
[ADJAdjustFactory.logger error:@"Short Universal link regex rule error (%@)", [error description]];
return;
}

shortUniversalLinkRegex = regex;
}

+ (void)initializeSecondsNumberFormatter {
secondsNumberFormatter = [[NSNumberFormatter alloc] init];
[secondsNumberFormatter setPositiveFormat:@"0.0"];
Expand Down Expand Up @@ -521,11 +542,19 @@ + (NSURL *)convertUniversalLink:(NSURL *)url scheme:(NSString *)scheme {
return nil;
}

if (shortUniversalLinkRegex == nil) {
[logger error:@"Short Universal link regex not correctly configured"];
return nil;
}

NSArray<NSTextCheckingResult *> *matches = [universalLinkRegex matchesInString:urlString options:0 range:NSMakeRange(0, [urlString length])];

if ([matches count] == 0) {
[logger error:@"Url doesn't match as universal link with format https://[hash].ulink.adjust.com/ulink/..."];
return nil;
matches = [shortUniversalLinkRegex matchesInString:urlString options:0 range:NSMakeRange(0, [urlString length])];
if ([matches count] == 0) {
[logger error:@"Url doesn't match as universal link or short version"];
return nil;
}
}

if ([matches count] > 1) {
Expand Down
2 changes: 1 addition & 1 deletion AdjustTests/ADJPackageFields.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ - (id) init {

// default values
self.appToken = @"qwerty123456";
self.clientSdk = @"ios4.8.2";
self.clientSdk = @"ios4.8.3";
self.suffix = @"";
self.environment = @"sandbox";

Expand Down
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
### Version 4.8.3 (10th August 2016)
#### Added
- Added support to convert shorten universal links.

---

### Version 4.8.2 (5th August 2016)
#### Fixed
- Initialize static vars to prevent dealloc
- Added initialisation of static vars to prevent dealloc.

---

Expand All @@ -9,7 +15,7 @@
- Added Safari Framework in the example app.

### Fixed
- Replace sleeping background thread with delay execution
- Replaced sleeping background thread with delayed execution.

---

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ If you're using [CocoaPods][cocoapods], you can add the following line to your `
[this step](#sdk-integrate):

```ruby
pod 'Adjust', '~> 4.8.2'
pod 'Adjust', '~> 4.8.3'
```

or:

```ruby
pod 'Adjust', :git => 'https://github.com/adjust/ios_sdk.git', :tag => 'v4.8.2'
pod 'Adjust', :git => 'https://github.com/adjust/ios_sdk.git', :tag => 'v4.8.3'
```

If you're using [Carthage][carthage], you can add following line to your `Cartfile` and continue with
Expand Down Expand Up @@ -835,7 +835,7 @@ send `sdk_click` package anyway to the adjust backend. If you have your log leve
```
[Adjust]d: Added package 1 (click)
[Adjust]v: Path: /sdk_click
[Adjust]v: ClientSdk: ios4.8.2
[Adjust]v: ClientSdk: ios4.8.3
[Adjust]v: Parameters:
[Adjust]v: app_token {YourAppToken}
[Adjust]v: created_at 2016-04-15T14:25:51.676Z+0200
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.8.2
4.8.3

0 comments on commit 5074e35

Please sign in to comment.