diff --git a/CHANGELOG.md b/CHANGELOG.md index acd3e599..4c1016ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## XX.XX.XX +* Mitigated an issue where non-queued requests were affected from request timeout settings. + ## 25.4.6 * Added the ability to record reserved events. * Changed default log level from "CLYInternalLogLevelDebug" to "CLYInternalLogLevelVerbose". diff --git a/Countly.m b/Countly.m index 2db45b4a..4bcdef83 100644 --- a/Countly.m +++ b/Countly.m @@ -89,7 +89,7 @@ - (void)startWithConfig:(CountlyConfig *)config CountlyCommon.sharedInstance.shouldIgnoreTrustCheck = config.shouldIgnoreTrustCheck; CountlyCommon.sharedInstance.loggerDelegate = config.loggerDelegate; CountlyCommon.sharedInstance.internalLogLevel = config.internalLogLevel; - + config = [self checkAndFixInternalLimitsConfig:config]; if (config.disableSDKBehaviorSettingsUpdates) { diff --git a/CountlyCommon.h b/CountlyCommon.h index 42b4e1ad..3b72c049 100644 --- a/CountlyCommon.h +++ b/CountlyCommon.h @@ -125,6 +125,8 @@ void CountlyPrint(NSString *stringToPrint); - (NSURLSession *)URLSession; +- (NSURLSession *)ImmediateURLSession; + - (CGSize)getWindowSize; @end diff --git a/CountlyCommon.m b/CountlyCommon.m index 485268cd..ffd8c7ab 100644 --- a/CountlyCommon.m +++ b/CountlyCommon.m @@ -335,6 +335,17 @@ - (NSURLSession *)URLSession } } +- (NSURLSession *)ImmediateURLSession +{ + NSURLSessionConfiguration *immediateConfig = [NSURLSessionConfiguration defaultSessionConfiguration]; + if (CountlyConnectionManager.sharedInstance.URLSessionConfiguration) + { + immediateConfig.HTTPAdditionalHeaders = CountlyConnectionManager.sharedInstance.URLSessionConfiguration.HTTPAdditionalHeaders; + } + + return [NSURLSession sessionWithConfiguration:immediateConfig]; +} + - (CGSize)getWindowSize { #if (TARGET_OS_IOS) UIWindow *window = nil; diff --git a/CountlyContentBuilderInternal.m b/CountlyContentBuilderInternal.m index 6317d367..162f33df 100644 --- a/CountlyContentBuilderInternal.m +++ b/CountlyContentBuilderInternal.m @@ -157,7 +157,8 @@ - (void)fetchContents { [self setRequestQueueLockedThreadSafe:YES]; - NSURLSessionTask *dataTask = [[NSURLSession sharedSession] dataTaskWithRequest:[self fetchContentsRequest] completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { + NSURLSessionTask *dataTask = [[CountlyCommon.sharedInstance ImmediateURLSession] dataTaskWithRequest:[self fetchContentsRequest] completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { + // IMMEDIATE REQUEST to find them better in search if (error) { CLY_LOG_I(@"%s fetch content details failed: [%@]", __FUNCTION__, error); [self setRequestQueueLockedThreadSafe:NO]; diff --git a/CountlyFeedbackWidget.m b/CountlyFeedbackWidget.m index ee90867c..561b9b81 100644 --- a/CountlyFeedbackWidget.m +++ b/CountlyFeedbackWidget.m @@ -205,8 +205,9 @@ - (void)getWidgetData:(void (^)(NSDictionary * __nullable widgetData, NSError * return; } - NSURLSessionTask* task = [CountlyCommon.sharedInstance.URLSession dataTaskWithRequest:[self dataRequest] completionHandler:^(NSData* data, NSURLResponse* response, NSError* error) + NSURLSessionTask* task = [CountlyCommon.sharedInstance.ImmediateURLSession dataTaskWithRequest:[self dataRequest] completionHandler:^(NSData* data, NSURLResponse* response, NSError* error) { + // IMMEDIATE REQUEST to find them better in search NSDictionary *widgetData = nil; if (!error) diff --git a/CountlyFeedbacksInternal.m b/CountlyFeedbacksInternal.m index 71a9e46a..35a49fff 100644 --- a/CountlyFeedbacksInternal.m +++ b/CountlyFeedbacksInternal.m @@ -252,8 +252,9 @@ - (void)presentRatingWidgetWithID:(NSString *)widgetID closeButtonText:(NSString return; NSURLRequest* feedbackWidgetCheckRequest = [self widgetCheckURLRequest:widgetID]; - NSURLSessionTask* task = [CountlyCommon.sharedInstance.URLSession dataTaskWithRequest:feedbackWidgetCheckRequest completionHandler:^(NSData* data, NSURLResponse* response, NSError* error) + NSURLSessionTask* task = [CountlyCommon.sharedInstance.ImmediateURLSession dataTaskWithRequest:feedbackWidgetCheckRequest completionHandler:^(NSData* data, NSURLResponse* response, NSError* error) { + // IMMEDIATE REQUEST to find them better in search NSDictionary* widgetInfo = nil; if (!error) @@ -437,8 +438,9 @@ - (void)getFeedbackWidgets:(void (^)(NSArray *feedback return; } - NSURLSessionTask* task = [CountlyCommon.sharedInstance.URLSession dataTaskWithRequest:[self feedbacksRequest] completionHandler:^(NSData* data, NSURLResponse* response, NSError* error) + NSURLSessionTask* task = [CountlyCommon.sharedInstance.ImmediateURLSession dataTaskWithRequest:[self feedbacksRequest] completionHandler:^(NSData* data, NSURLResponse* response, NSError* error) { + // IMMEDIATE REQUEST to find them better in search NSDictionary *feedbacksResponse = nil; if (!error) diff --git a/CountlyHealthTracker.m b/CountlyHealthTracker.m index 79ef74ca..cfea795f 100644 --- a/CountlyHealthTracker.m +++ b/CountlyHealthTracker.m @@ -182,8 +182,9 @@ - (void)sendHealthCheck { CLY_LOG_D(@"%s health check status, healthCheckSent: [%d], healthCheckEnabled: [%d]", __FUNCTION__, _healthCheckSent, _healthCheckEnabled); } - NSURLSessionTask* task = [CountlyCommon.sharedInstance.URLSession dataTaskWithRequest:[self healthCheckRequest] completionHandler:^(NSData* data, NSURLResponse* response, NSError* error) + NSURLSessionTask* task = [CountlyCommon.sharedInstance.ImmediateURLSession dataTaskWithRequest:[self healthCheckRequest] completionHandler:^(NSData* data, NSURLResponse* response, NSError* error) { + // IMMEDIATE REQUEST to find them better in search if (error) { CLY_LOG_W(@"%s error while sending health checks error: [%@]", __FUNCTION__, error); diff --git a/CountlyNotificationService.m b/CountlyNotificationService.m index a42a08ad..bec63764 100644 --- a/CountlyNotificationService.m +++ b/CountlyNotificationService.m @@ -87,6 +87,7 @@ + (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withConte [[NSURLSession.sharedSession downloadTaskWithURL:[NSURL URLWithString:attachmentURL] completionHandler:^(NSURL * location, NSURLResponse * response, NSError * error) { + // IMMEDIATE REQUEST to find them better in search, but uses NSURLSession.sharedSession as it should not be blocked by SDK configurations if (!error) { COUNTLY_EXT_LOG(@"Attachment download completed!"); diff --git a/CountlyRemoteConfigInternal.m b/CountlyRemoteConfigInternal.m index 5e0aee79..9bb12663 100644 --- a/CountlyRemoteConfigInternal.m +++ b/CountlyRemoteConfigInternal.m @@ -197,8 +197,9 @@ - (void)fetchRemoteConfigForKeys:(NSArray *)keys omitKeys:(NSArray *)omitKeys i return; NSURLRequest* request = [self remoteConfigRequestForKeys:keys omitKeys:omitKeys isLegacy:isLegacy]; - NSURLSessionTask* task = [CountlyCommon.sharedInstance.URLSession dataTaskWithRequest:request completionHandler:^(NSData* data, NSURLResponse* response, NSError* error) + NSURLSessionTask* task = [CountlyCommon.sharedInstance.ImmediateURLSession dataTaskWithRequest:request completionHandler:^(NSData* data, NSURLResponse* response, NSError* error) { + // IMMEDIATE REQUEST to find them better in search NSDictionary* remoteConfig = nil; if (!error) @@ -496,8 +497,9 @@ - (void)testingDownloadAllVariantsInternal:(void (^)(CLYRequestResult response, return; NSURLRequest* request = [self downloadVariantsRequest]; - NSURLSessionTask* task = [CountlyCommon.sharedInstance.URLSession dataTaskWithRequest:request completionHandler:^(NSData* data, NSURLResponse* response, NSError* error) + NSURLSessionTask* task = [CountlyCommon.sharedInstance.ImmediateURLSession dataTaskWithRequest:request completionHandler:^(NSData* data, NSURLResponse* response, NSError* error) { + // IMMEDIATE REQUEST to find them better in search NSMutableDictionary* variants = NSMutableDictionary.new; if (!error) @@ -607,8 +609,9 @@ - (void)testingEnrollIntoVariantInternal:(NSString *)key variantName:(NSString * } NSURLRequest* request = [self enrollInVarianRequestForKey:key variantName:variantName]; - NSURLSessionTask* task = [CountlyCommon.sharedInstance.URLSession dataTaskWithRequest:request completionHandler:^(NSData* data, NSURLResponse* response, NSError* error) + NSURLSessionTask* task = [CountlyCommon.sharedInstance.ImmediateURLSession dataTaskWithRequest:request completionHandler:^(NSData* data, NSURLResponse* response, NSError* error) { + // IMMEDIATE REQUEST to find them better in search NSDictionary* variants = nil; [self clearCachedRemoteConfig]; if (!error) @@ -721,9 +724,9 @@ - (void)testingDownloaExperimentInfoInternal:(void (^)(CLYRequestResult response return; NSURLRequest* request = [self downloadExperimentInfoRequest]; - NSURLSessionTask* task = [CountlyCommon.sharedInstance.URLSession dataTaskWithRequest:request completionHandler:^(NSData* data, NSURLResponse* response, NSError* error) + NSURLSessionTask* task = [CountlyCommon.sharedInstance.ImmediateURLSession dataTaskWithRequest:request completionHandler:^(NSData* data, NSURLResponse* response, NSError* error) { - + // IMMEDIATE REQUEST to find them better in search NSMutableDictionary * experiments = NSMutableDictionary.new; if (!error) diff --git a/CountlyServerConfig.m b/CountlyServerConfig.m index 85a86dbe..ac621d7f 100644 --- a/CountlyServerConfig.m +++ b/CountlyServerConfig.m @@ -446,7 +446,8 @@ - (void)fetchServerConfig:(CountlyConfig *)config } }; // Set default values - NSURLSessionTask *task = [CountlyCommon.sharedInstance.URLSession dataTaskWithRequest:[self serverConfigRequest] completionHandler:handler]; + NSURLSessionTask *task = [CountlyCommon.sharedInstance.ImmediateURLSession dataTaskWithRequest:[self serverConfigRequest] completionHandler:handler]; + // IMMEDIATE REQUEST to find them better in search [task resume]; }