diff --git a/Adjust.podspec b/Adjust.podspec index ef8c4dbed..57b341678 100644 --- a/Adjust.podspec +++ b/Adjust.podspec @@ -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" => "welle@adjust.com" } - 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' diff --git a/Adjust/ADJUtil.m b/Adjust/ADJUtil.m index bfbdb16be..15b137f46 100644 --- a/Adjust/ADJUtil.m +++ b/Adjust/ADJUtil.m @@ -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"; @@ -40,6 +43,7 @@ + (void) initialize { [self initializeDateFormat]; [self initializeUniversalLinkRegex]; [self initializeSecondsNumberFormatter]; + [self initializeShortUniversalLinkRegex]; } + (void)initializeDateFormat { @@ -69,6 +73,7 @@ + (void)initializeDateFormat { [dateFormat setDateFormat:kDateFormat]; } + + (void)initializeUniversalLinkRegex { NSError *error = NULL; @@ -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"]; @@ -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 *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) { diff --git a/AdjustTests/ADJPackageFields.m b/AdjustTests/ADJPackageFields.m index b348c38a1..31cc665c9 100644 --- a/AdjustTests/ADJPackageFields.m +++ b/AdjustTests/ADJPackageFields.m @@ -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"; diff --git a/CHANGELOG.md b/CHANGELOG.md index 42b383055..a39fb47b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. --- @@ -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. --- diff --git a/README.md b/README.md index 59d23daee..2e8fb076e 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/VERSION b/VERSION index 326ec6355..f99c6583c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.8.2 +4.8.3