From 69615f7985e8fc895f778b85fbdd0a7e941691cf Mon Sep 17 00:00:00 2001 From: Desu Sai Venkat <48179357+desusai7@users.noreply.github.com> Date: Tue, 28 Jun 2022 19:25:06 +0530 Subject: [PATCH] [Bugfix] Fixed additional `/` issue in the URL for Data Plane and Control Plane --- CHANGELOG.md | 3 +++ Podfile.lock | 24 +++--------------------- README.md | 10 +++++----- Rudder.podspec | 2 +- Rudder.xcodeproj/project.pbxproj | 4 ++-- Sources/Classes/Public/RSUtils.h | 1 + Sources/Classes/RSConfigBuilder.m | 12 ++++++------ Sources/Classes/RSConstants.m | 6 +++--- Sources/Classes/RSEventRepository.m | 2 +- Sources/Classes/RSServerConfigManager.m | 7 +------ Sources/Classes/RSUtils.m | 7 +++++++ 11 files changed, 33 insertions(+), 45 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a4de427a..5e324e61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -72,3 +72,6 @@ All notable changes to this project will be documented in this file. ## Version - 1.6.1 - 2022-06-20 - Included Build Number as well in the life cycle events Application Installed & Application Updated. - Accepting path as well as part of the url for both control plane url and data plane url. + +## Version - 1.6.2 - 2022-06-28 +- Fixed additional / in the url for both control plane url and dataplaneurl as a result of which the network requests to both control plane and data plane url are being failed. diff --git a/Podfile.lock b/Podfile.lock index 1ffc0c8a..438de9e9 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,7 +1,4 @@ PODS: - - AppsFlyerFramework (6.4.4): - - AppsFlyerFramework/Main (= 6.4.4) - - AppsFlyerFramework/Main (6.4.4) - Firebase/Analytics (6.34.0): - Firebase/Core - Firebase/Core (6.34.0): @@ -82,25 +79,15 @@ PODS: - nanopb/encode (1.30906.0) - PromisesObjC (1.2.12) - Protobuf (3.20.1) - - Rudder (1.6.0) - - Rudder-Appsflyer (1.1.0): - - AppsFlyerFramework (~> 6.4.3) - - Rudder (~> 1.0) - - Rudder-Firebase (1.0.2): - - Firebase/Core - - FirebaseAnalytics - - Rudder + - Rudder (1.6.2) DEPENDENCIES: - Firebase/Analytics - Firebase/Messaging - Rudder (from `.`) - - Rudder-Appsflyer (= 1.1.0) - - Rudder-Firebase SPEC REPOS: trunk: - - AppsFlyerFramework - Firebase - FirebaseAnalytics - FirebaseCore @@ -114,15 +101,12 @@ SPEC REPOS: - nanopb - PromisesObjC - Protobuf - - Rudder-Appsflyer - - Rudder-Firebase EXTERNAL SOURCES: Rudder: :path: "." SPEC CHECKSUMS: - AppsFlyerFramework: 6ea252ecb04cf443550576922cddb95b35c958ed Firebase: c23a36d9e4cdf7877dfcba8dd0c58add66358999 FirebaseAnalytics: 3bb096873ee0d7fa4b6c70f5e9166b6da413cc7f FirebaseCore: d3a978a3cfa3240bf7e4ba7d137fdf5b22b628ec @@ -136,10 +120,8 @@ SPEC CHECKSUMS: nanopb: 59317e09cf1f1a0af72f12af412d54edf52603fc PromisesObjC: 3113f7f76903778cf4a0586bd1ab89329a0b7b97 Protobuf: b60ec2f51ad74765f44d0c09d2e0579d7de21745 - Rudder: f2cb6780d8b2e261f830b47a44333e55be9ce68e - Rudder-Appsflyer: 7b1b9b66513f70ac9c305ee28febbc72ce37a746 - Rudder-Firebase: 42b9a7d143cbe6d125f5bdf535cba73e24cba1c1 + Rudder: 57717e83b632760b411636ee532e16008698520e -PODFILE CHECKSUM: d5ddcdfc9129105310a8c03f048b4d0ec5e232d8 +PODFILE CHECKSUM: 33b0e9f1b94a028aa8a3b4aecf718a44c9b6265e COCOAPODS: 1.11.3 diff --git a/README.md b/README.md index cea47261..37f52c48 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@

- +

@@ -39,7 +39,7 @@ The iOS SDK is available through [**CocoaPods**](https://cocoapods.org), [**Cart To install the SDK, simply add the following line to your Podfile: ```xcode -pod 'Rudder', '1.6.1' +pod 'Rudder', '1.6.2' ``` ### Carthage @@ -47,7 +47,7 @@ pod 'Rudder', '1.6.1' For Carthage support, add the following line to your `Cartfile`: ```xcode -github "rudderlabs/rudder-sdk-ios" "v1.6.1" +github "rudderlabs/rudder-sdk-ios" "v1.6.2" ``` > Remember to include the following code in all `.m` and `.h` files where you want to refer to or use the RudderStack SDK classes, as shown: @@ -71,7 +71,7 @@ You can also add the RudderStack iOS SDK via Swift Package Mangaer, via one of t * Enter the package repository (`git@github.com:rudderlabs/rudder-sdk-ios.git`) in the search bar. -* In **Dependency Rule**, select **Up to Next Major Version** and enter `1.6.1` as the value, as shown: +* In **Dependency Rule**, select **Up to Next Major Version** and enter `1.6.2` as the value, as shown: ![Setting dependency](https://user-images.githubusercontent.com/59817155/145574696-8c849749-13e0-40d5-aacb-3fccb5c8e67d.png) @@ -99,7 +99,7 @@ let package = Package( ], dependencies: [ // Dependencies declare other packages that this package depends on. - .package(url: "git@github.com:rudderlabs/rudder-sdk-ios.git", from: "1.6.1") + .package(url: "git@github.com:rudderlabs/rudder-sdk-ios.git", from: "1.6.2") ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. diff --git a/Rudder.podspec b/Rudder.podspec index 9513639a..4b75ba06 100644 --- a/Rudder.podspec +++ b/Rudder.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Rudder' - s.version = "1.6.1" + s.version = "1.6.2" s.summary = "Privacy and Security focused Segment-alternative. iOS ,tvOS and watchOS SDK" s.description = <<-DESC Rudder is a platform for collecting, storing and routing customer event data to dozens of tools. Rudder is open-source, can run in your cloud environment (AWS, GCP, Azure or even your data-centre) and provides a powerful transformation framework to process your event data on the fly. diff --git a/Rudder.xcodeproj/project.pbxproj b/Rudder.xcodeproj/project.pbxproj index 6530c8c0..0a5d1a85 100644 --- a/Rudder.xcodeproj/project.pbxproj +++ b/Rudder.xcodeproj/project.pbxproj @@ -1021,7 +1021,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MARKETING_VERSION = 1.6.1; + MARKETING_VERSION = 1.6.2; PRODUCT_BUNDLE_IDENTIFIER = com.rudderstack.Rudder; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; @@ -1055,7 +1055,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MARKETING_VERSION = 1.6.1; + MARKETING_VERSION = 1.6.2; PRODUCT_BUNDLE_IDENTIFIER = com.rudderstack.Rudder; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; diff --git a/Sources/Classes/Public/RSUtils.h b/Sources/Classes/Public/RSUtils.h index 87d0cbd8..cbdce116 100644 --- a/Sources/Classes/Public/RSUtils.h +++ b/Sources/Classes/Public/RSUtils.h @@ -25,6 +25,7 @@ NS_ASSUME_NONNULL_BEGIN + (int) getNumberOfBatches:(RSDBMessage*) dbMessage withFlushQueueSize: (int) queueSize; + (NSMutableArray*) getBatch:(NSMutableArray*) messageDetails withQueueSize: (int) queueSize; + (BOOL) isValidURL:(NSURL*) url; ++ (NSString*) appendSlashToUrl:(NSString*) url; extern unsigned int MAX_EVENT_SIZE; extern unsigned int MAX_BATCH_SIZE; diff --git a/Sources/Classes/RSConfigBuilder.m b/Sources/Classes/RSConfigBuilder.m index 31241263..83139489 100644 --- a/Sources/Classes/RSConfigBuilder.m +++ b/Sources/Classes/RSConfigBuilder.m @@ -19,7 +19,7 @@ - (instancetype) withEndPointUrl:(NSString *) endPointUrl{ } NSURL *url = [[NSURL alloc] initWithString:endPointUrl]; if([RSUtils isValidURL:url]) { - config.dataPlaneUrl = url.absoluteString; + config.dataPlaneUrl = [RSUtils appendSlashToUrl: url.absoluteString]; } return self; } @@ -31,7 +31,7 @@ - (instancetype) withDataPlaneUrl: (NSString*) dataPlaneUrl { NSURL *url = [[NSURL alloc] initWithString:dataPlaneUrl]; if([RSUtils isValidURL:url]) { - config.dataPlaneUrl = url.absoluteString; + config.dataPlaneUrl = [RSUtils appendSlashToUrl: url.absoluteString]; } return self; } @@ -41,7 +41,7 @@ - (instancetype)withDataPlaneURL:(NSURL *) dataPlaneURL { config = [[RSConfig alloc] init]; } if([RSUtils isValidURL:dataPlaneURL]) { - config.dataPlaneUrl = dataPlaneURL.absoluteString; + config.dataPlaneUrl = [RSUtils appendSlashToUrl: dataPlaneURL.absoluteString]; } return self; } @@ -142,7 +142,7 @@ -(instancetype)withConfigPlaneUrl:(NSString *) configPlaneUrl { } NSURL *url = [[NSURL alloc] initWithString:configPlaneUrl]; if([RSUtils isValidURL:url]) { - config.controlPlaneUrl = url.absoluteString; + config.controlPlaneUrl = [RSUtils appendSlashToUrl: url.absoluteString]; } return self; } @@ -153,7 +153,7 @@ - (instancetype)withControlPlaneUrl:(NSString *) controlPlaneUrl { } NSURL *url = [[NSURL alloc] initWithString:controlPlaneUrl]; if([RSUtils isValidURL:url]) { - config.controlPlaneUrl = url.absoluteString; + config.controlPlaneUrl = [RSUtils appendSlashToUrl: url.absoluteString]; } return self; } @@ -163,7 +163,7 @@ - (instancetype)withControlPlaneURL:(NSURL *) controlPlaneURL { config = [[RSConfig alloc] init]; } if([RSUtils isValidURL:controlPlaneURL]) { - config.controlPlaneUrl = controlPlaneURL.absoluteString; + config.controlPlaneUrl = [RSUtils appendSlashToUrl: controlPlaneURL.absoluteString]; } return self; } diff --git a/Sources/Classes/RSConstants.m b/Sources/Classes/RSConstants.m index 6616ddf4..1966776b 100644 --- a/Sources/Classes/RSConstants.m +++ b/Sources/Classes/RSConstants.m @@ -10,15 +10,15 @@ @implementation RSConstants int const RSConfigRefreshInterval = 2; -NSString *const RSDataPlaneUrl = @"https://hosted.rudderlabs.com"; +NSString *const RSDataPlaneUrl = @"https://hosted.rudderlabs.com/"; int const RSFlushQueueSize = 30; int const RSDBCountThreshold = 10000; int const RSSleepTimeout = 10; -NSString *const RSControlPlaneUrl = @"https://api.rudderlabs.com"; +NSString *const RSControlPlaneUrl = @"https://api.rudderlabs.com/"; bool const RSTrackLifeCycleEvents = YES; bool const RSRecordScreenViews = NO; bool const RSEnableBackgroundMode = NO; -NSString *const RS_VERSION = @"1.6.1"; +NSString *const RS_VERSION = @"1.6.2"; NSString* const DISABLE = @"disable"; NSString* const WHITELISTED_EVENTS = @"whitelistedEvents"; NSString* const BLACKLISTED_EVENTS = @"blacklistedEvents"; diff --git a/Sources/Classes/RSEventRepository.m b/Sources/Classes/RSEventRepository.m index ce287769..b1c60dc4 100644 --- a/Sources/Classes/RSEventRepository.m +++ b/Sources/Classes/RSEventRepository.m @@ -397,7 +397,7 @@ - (int) __flushEventsToServer: (NSString*) payload { dispatch_semaphore_t semaphore = dispatch_semaphore_create(0); int __block respStatus = NETWORKSUCCESS; - NSString *dataPlaneEndPoint = [self->config.dataPlaneUrl stringByAppendingString:@"/v1/batch"]; + NSString *dataPlaneEndPoint = [self->config.dataPlaneUrl stringByAppendingString:@"v1/batch"]; [RSLogger logDebug:[[NSString alloc] initWithFormat:@"endPointToFlush %@", dataPlaneEndPoint]]; NSMutableURLRequest *urlRequest = [[NSMutableURLRequest alloc] initWithURL:[[NSURL alloc] initWithString:dataPlaneEndPoint]]; diff --git a/Sources/Classes/RSServerConfigManager.m b/Sources/Classes/RSServerConfigManager.m index 996aff38..837c09a8 100644 --- a/Sources/Classes/RSServerConfigManager.m +++ b/Sources/Classes/RSServerConfigManager.m @@ -169,12 +169,7 @@ - (NSString *)_networkRequest { dispatch_semaphore_t semaphore = dispatch_semaphore_create(0); __block NSString *responseStr = nil; - NSString *controlPlaneEndPoint = nil; - if([_rudderConfig.controlPlaneUrl hasSuffix:@"/"]) { - controlPlaneEndPoint= [NSString stringWithFormat:@"%@sourceConfig?p=ios&v=%@", _rudderConfig.controlPlaneUrl, RS_VERSION]; - } else { - controlPlaneEndPoint= [NSString stringWithFormat:@"%@/sourceConfig?p=ios&v=%@", _rudderConfig.controlPlaneUrl, RS_VERSION]; - } + NSString *controlPlaneEndPoint = [NSString stringWithFormat:@"%@sourceConfig?p=ios&v=%@", _rudderConfig.controlPlaneUrl, RS_VERSION]; [RSLogger logDebug:[[NSString alloc] initWithFormat:@"configUrl: %@", controlPlaneEndPoint]]; NSMutableURLRequest *urlRequest = [[NSMutableURLRequest alloc] initWithURL:[[NSURL alloc] initWithString:controlPlaneEndPoint]]; NSData *authData = [[[NSString alloc] initWithFormat:@"%@:", _writeKey] dataUsingEncoding:NSUTF8StringEncoding]; diff --git a/Sources/Classes/RSUtils.m b/Sources/Classes/RSUtils.m index dd202d27..9ac358d7 100644 --- a/Sources/Classes/RSUtils.m +++ b/Sources/Classes/RSUtils.m @@ -139,6 +139,13 @@ + (BOOL) isValidURL:(NSURL*) url { return url && [url scheme] && [url host]; } ++ (NSString*) appendSlashToUrl:(NSString*) url { + if([url hasSuffix:@"/"]){ + return url; + } + return [url stringByAppendingString:@"/"]; +} + unsigned int MAX_EVENT_SIZE = 32 * 1024; // 32 KB unsigned int MAX_BATCH_SIZE = 500 * 1024; // 500 KB