From 3f002e8439d3a74c62ce30bee8fc5dcf40c64faf Mon Sep 17 00:00:00 2001 From: ijunaid Date: Tue, 5 Nov 2024 13:52:08 +0500 Subject: [PATCH 01/13] Fixed visibility tracking flag issue Updated SDK to version 24.7.7 --- CHANGELOG.md | 3 +++ Countly-PL.podspec | 2 +- Countly.m | 2 +- Countly.podspec | 2 +- Countly.xcodeproj/project.pbxproj | 4 ++-- CountlyCommon.m | 2 +- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b5a63af..61784091 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 24.7.7 +* Mitigated an issue where the experimental `enableVisibilityTracking` flag was recorded as true/false instead of 0/1 + ## 24.7.6 * Mitigated an issue with experimental visibility tracking and previous name recording, ensuring they’re included even when no segmentation is provided in event or view recording. diff --git a/Countly-PL.podspec b/Countly-PL.podspec index 8631363a..738b41f7 100644 --- a/Countly-PL.podspec +++ b/Countly-PL.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Countly-PL' - s.version = '24.7.6' + s.version = '24.7.7' s.license = { :type => 'MIT', :file => 'LICENSE' } s.summary = 'Countly is an innovative, real-time, open source mobile analytics platform.' s.homepage = 'https://github.com/Countly/countly-sdk-ios' diff --git a/Countly.m b/Countly.m index 7cf1d60f..a69dbfe4 100644 --- a/Countly.m +++ b/Countly.m @@ -941,7 +941,7 @@ - (NSDictionary*) processSegmentation:(NSMutableDictionary *) segmentation event } if(CountlyCommon.sharedInstance.enableVisibiltyTracking) { - segmentation[kCountlyVisibility] = @([self isAppInForeground]); + segmentation[kCountlyVisibility] = @([self isAppInForeground] ? 1 : 0); } return segmentation.count == 0 ? nil : segmentation; diff --git a/Countly.podspec b/Countly.podspec index fe20e91b..620dac2b 100644 --- a/Countly.podspec +++ b/Countly.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Countly' - s.version = '24.7.6' + s.version = '24.7.7' s.license = { :type => 'MIT', :file => 'LICENSE' } s.summary = 'Countly is an innovative, real-time, open source mobile analytics platform.' s.homepage = 'https://github.com/Countly/countly-sdk-ios' diff --git a/Countly.xcodeproj/project.pbxproj b/Countly.xcodeproj/project.pbxproj index c03ad326..e42a8628 100644 --- a/Countly.xcodeproj/project.pbxproj +++ b/Countly.xcodeproj/project.pbxproj @@ -738,7 +738,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.14; - MARKETING_VERSION = 24.7.6; + MARKETING_VERSION = 24.7.7; PRODUCT_BUNDLE_IDENTIFIER = ly.count.CountlyiOSSDK; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -770,7 +770,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.14; - MARKETING_VERSION = 24.7.6; + MARKETING_VERSION = 24.7.7; PRODUCT_BUNDLE_IDENTIFIER = ly.count.CountlyiOSSDK; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/CountlyCommon.m b/CountlyCommon.m index 893b488d..20db5c3f 100644 --- a/CountlyCommon.m +++ b/CountlyCommon.m @@ -29,7 +29,7 @@ @interface CountlyCommon () #endif @end -NSString* const kCountlySDKVersion = @"24.7.6"; +NSString* const kCountlySDKVersion = @"24.7.7"; NSString* const kCountlySDKName = @"objc-native-ios"; NSString* const kCountlyErrorDomain = @"ly.count.ErrorDomain"; From f13026c787910d037771b21431f3aabe5e05849e Mon Sep 17 00:00:00 2001 From: turtledreams <62231246+turtledreams@users.noreply.github.com> Date: Tue, 5 Nov 2024 20:14:11 +0900 Subject: [PATCH 02/13] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61784091..16091236 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ ## 24.7.7 -* Mitigated an issue where the experimental `enableVisibilityTracking` flag was recorded as true/false instead of 0/1 +* Changed the visibility tracking segmentation values to binary ## 24.7.6 * Mitigated an issue with experimental visibility tracking and previous name recording, ensuring they’re included even when no segmentation is provided in event or view recording. From 060fa062ee2e5fadb677c40ffa8485c1446322ed Mon Sep 17 00:00:00 2001 From: ijunaid Date: Tue, 12 Nov 2024 13:14:59 +0500 Subject: [PATCH 03/13] Removed visibility from end view event --- Countly.m | 25 ++++++++++++++++--------- CountlyViewTrackingInternal.h | 1 + 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Countly.m b/Countly.m index a69dbfe4..6c51a817 100644 --- a/Countly.m +++ b/Countly.m @@ -932,19 +932,26 @@ - (void)recordEvent:(NSString *)key segmentation:(NSDictionary *)segmentation co [CountlyPersistency.sharedInstance recordEvent:event]; } -- (NSDictionary*) processSegmentation:(NSMutableDictionary *) segmentation eventKey:(NSString *)eventKey -{ - if(CountlyViewTrackingInternal.sharedInstance.enablePreviousNameRecording) { - if([eventKey isEqualToString:kCountlyReservedEventView]) { - segmentation[kCountlyPreviousView] = CountlyViewTrackingInternal.sharedInstance.previousViewName ?: @""; - } +- (NSDictionary *)processSegmentation:(NSMutableDictionary *)segmentation eventKey:(NSString *)eventKey { + BOOL isViewEvent = [eventKey isEqualToString:kCountlyReservedEventView]; + + // Add previous view name if enabled and the event is a view event + if (isViewEvent && CountlyViewTrackingInternal.sharedInstance.enablePreviousNameRecording) { + segmentation[kCountlyPreviousView] = CountlyViewTrackingInternal.sharedInstance.previousViewName ?: @""; } - if(CountlyCommon.sharedInstance.enableVisibiltyTracking) { - segmentation[kCountlyVisibility] = @([self isAppInForeground] ? 1 : 0); + // Add visibility tracking information if enabled + if (CountlyCommon.sharedInstance.enableVisibiltyTracking) { + BOOL isViewStart = [segmentation[kCountlyVTKeyVisit] isEqual:@1]; + + // Add visibility if it's not a view event or it's a view start event + if (!isViewEvent || isViewStart) { + segmentation[kCountlyVisibility] = @([self isAppInForeground] ? 1 : 0); + } } - return segmentation.count == 0 ? nil : segmentation; + // Return segmentation dictionary if not empty, otherwise return nil + return segmentation.count > 0 ? segmentation : nil; } - (BOOL)isAppInForeground { diff --git a/CountlyViewTrackingInternal.h b/CountlyViewTrackingInternal.h index b2260209..b21e2e1e 100644 --- a/CountlyViewTrackingInternal.h +++ b/CountlyViewTrackingInternal.h @@ -11,6 +11,7 @@ extern NSString* const kCountlyReservedEventView; extern NSString* const kCountlyCurrentView; extern NSString* const kCountlyPreviousView; extern NSString* const kCountlyPreviousEventName; +extern NSString* const kCountlyVTKeyVisit; @interface CountlyViewTrackingInternal : NSObject @property (nonatomic) BOOL isEnabledOnInitialConfig; From 38dc63190361f92d1ee343120d7d5525faeec9f5 Mon Sep 17 00:00:00 2001 From: ijunaid Date: Tue, 12 Nov 2024 13:17:11 +0500 Subject: [PATCH 04/13] Added changelog entry --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16091236..3a67eec0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## XX.XX.XX +* Mitigated an issue where visibility could have been wrongly assigned if a view was closed while going to background. (Experimental!) + ## 24.7.7 * Changed the visibility tracking segmentation values to binary From 0ded0386a1cfc86c0c4ec43ca26ca7af34d75a80 Mon Sep 17 00:00:00 2001 From: ijunaid Date: Wed, 13 Nov 2024 17:39:30 +0500 Subject: [PATCH 05/13] Applied URLSessionConfiguration to non-queued requests --- CountlyCommon.h | 2 ++ CountlyCommon.m | 12 ++++++++++++ CountlyFeedbackWidget.m | 2 +- CountlyFeedbacksInternal.m | 4 ++-- CountlyNotificationService.m | 3 ++- CountlyRemoteConfigInternal.m | 8 ++++---- CountlyServerConfig.m | 2 +- 7 files changed, 24 insertions(+), 9 deletions(-) diff --git a/CountlyCommon.h b/CountlyCommon.h index 2aaf4e66..08ad66f5 100644 --- a/CountlyCommon.h +++ b/CountlyCommon.h @@ -122,6 +122,8 @@ void CountlyPrint(NSString *stringToPrint); - (void)recordOrientation; - (BOOL)hasStarted_; + +- (NSURLSession *)URLSession; @end diff --git a/CountlyCommon.m b/CountlyCommon.m index 20db5c3f..1017d2c2 100644 --- a/CountlyCommon.m +++ b/CountlyCommon.m @@ -317,6 +317,18 @@ - (void)tryPresentingViewController:(UIViewController *)viewController withCompl } #endif +- (NSURLSession *)URLSession +{ + if (CountlyConnectionManager.sharedInstance.URLSessionConfiguration) + { + return [NSURLSession sessionWithConfiguration:CountlyConnectionManager.sharedInstance.URLSessionConfiguration]; + } + else + { + return NSURLSession.sharedSession; + } +} + @end diff --git a/CountlyFeedbackWidget.m b/CountlyFeedbackWidget.m index 7631dd69..258f265a 100644 --- a/CountlyFeedbackWidget.m +++ b/CountlyFeedbackWidget.m @@ -115,7 +115,7 @@ - (void)getWidgetData:(void (^)(NSDictionary * __nullable widgetData, NSError * return; } - NSURLSessionTask* task = [NSURLSession.sharedSession dataTaskWithRequest:[self dataRequest] completionHandler:^(NSData* data, NSURLResponse* response, NSError* error) + NSURLSessionTask* task = [CountlyCommon.sharedInstance.URLSession dataTaskWithRequest:[self dataRequest] completionHandler:^(NSData* data, NSURLResponse* response, NSError* error) { NSDictionary *widgetData = nil; diff --git a/CountlyFeedbacksInternal.m b/CountlyFeedbacksInternal.m index 4a7bb9e2..6b320811 100644 --- a/CountlyFeedbacksInternal.m +++ b/CountlyFeedbacksInternal.m @@ -252,7 +252,7 @@ - (void)presentRatingWidgetWithID:(NSString *)widgetID closeButtonText:(NSString return; NSURLRequest* feedbackWidgetCheckRequest = [self widgetCheckURLRequest:widgetID]; - NSURLSessionTask* task = [NSURLSession.sharedSession dataTaskWithRequest:feedbackWidgetCheckRequest completionHandler:^(NSData* data, NSURLResponse* response, NSError* error) + NSURLSessionTask* task = [CountlyCommon.sharedInstance.URLSession dataTaskWithRequest:feedbackWidgetCheckRequest completionHandler:^(NSData* data, NSURLResponse* response, NSError* error) { NSDictionary* widgetInfo = nil; @@ -425,7 +425,7 @@ - (void)getFeedbackWidgets:(void (^)(NSArray *feedback if (CountlyDeviceInfo.sharedInstance.isDeviceIDTemporary) return; - NSURLSessionTask* task = [NSURLSession.sharedSession dataTaskWithRequest:[self feedbacksRequest] completionHandler:^(NSData* data, NSURLResponse* response, NSError* error) + NSURLSessionTask* task = [CountlyCommon.sharedInstance.URLSession dataTaskWithRequest:[self feedbacksRequest] completionHandler:^(NSData* data, NSURLResponse* response, NSError* error) { NSDictionary *feedbacksResponse = nil; diff --git a/CountlyNotificationService.m b/CountlyNotificationService.m index a42a08ad..87841808 100644 --- a/CountlyNotificationService.m +++ b/CountlyNotificationService.m @@ -5,6 +5,7 @@ // Please visit www.count.ly for more information. #import "CountlyNotificationService.h" +#import "CountlyCommon.h" #if DEBUG #define COUNTLY_EXT_LOG(fmt, ...) NSLog([@"%@ " stringByAppendingString:fmt], @"[CountlyNSE]", ##__VA_ARGS__) @@ -85,7 +86,7 @@ + (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withConte COUNTLY_EXT_LOG(@"Attachment specified in Countly payload: %@", attachmentURL); - [[NSURLSession.sharedSession downloadTaskWithURL:[NSURL URLWithString:attachmentURL] completionHandler:^(NSURL * location, NSURLResponse * response, NSError * error) + [[CountlyCommon.sharedInstance.URLSession downloadTaskWithURL:[NSURL URLWithString:attachmentURL] completionHandler:^(NSURL * location, NSURLResponse * response, NSError * error) { if (!error) { diff --git a/CountlyRemoteConfigInternal.m b/CountlyRemoteConfigInternal.m index dd2ed7a8..5e0aee79 100644 --- a/CountlyRemoteConfigInternal.m +++ b/CountlyRemoteConfigInternal.m @@ -197,7 +197,7 @@ - (void)fetchRemoteConfigForKeys:(NSArray *)keys omitKeys:(NSArray *)omitKeys i return; NSURLRequest* request = [self remoteConfigRequestForKeys:keys omitKeys:omitKeys isLegacy:isLegacy]; - NSURLSessionTask* task = [NSURLSession.sharedSession dataTaskWithRequest:request completionHandler:^(NSData* data, NSURLResponse* response, NSError* error) + NSURLSessionTask* task = [CountlyCommon.sharedInstance.URLSession dataTaskWithRequest:request completionHandler:^(NSData* data, NSURLResponse* response, NSError* error) { NSDictionary* remoteConfig = nil; @@ -496,7 +496,7 @@ - (void)testingDownloadAllVariantsInternal:(void (^)(CLYRequestResult response, return; NSURLRequest* request = [self downloadVariantsRequest]; - NSURLSessionTask* task = [NSURLSession.sharedSession dataTaskWithRequest:request completionHandler:^(NSData* data, NSURLResponse* response, NSError* error) + NSURLSessionTask* task = [CountlyCommon.sharedInstance.URLSession dataTaskWithRequest:request completionHandler:^(NSData* data, NSURLResponse* response, NSError* error) { NSMutableDictionary* variants = NSMutableDictionary.new; @@ -607,7 +607,7 @@ - (void)testingEnrollIntoVariantInternal:(NSString *)key variantName:(NSString * } NSURLRequest* request = [self enrollInVarianRequestForKey:key variantName:variantName]; - NSURLSessionTask* task = [NSURLSession.sharedSession dataTaskWithRequest:request completionHandler:^(NSData* data, NSURLResponse* response, NSError* error) + NSURLSessionTask* task = [CountlyCommon.sharedInstance.URLSession dataTaskWithRequest:request completionHandler:^(NSData* data, NSURLResponse* response, NSError* error) { NSDictionary* variants = nil; [self clearCachedRemoteConfig]; @@ -721,7 +721,7 @@ - (void)testingDownloaExperimentInfoInternal:(void (^)(CLYRequestResult response return; NSURLRequest* request = [self downloadExperimentInfoRequest]; - NSURLSessionTask* task = [NSURLSession.sharedSession dataTaskWithRequest:request completionHandler:^(NSData* data, NSURLResponse* response, NSError* error) + NSURLSessionTask* task = [CountlyCommon.sharedInstance.URLSession dataTaskWithRequest:request completionHandler:^(NSData* data, NSURLResponse* response, NSError* error) { NSMutableDictionary * experiments = NSMutableDictionary.new; diff --git a/CountlyServerConfig.m b/CountlyServerConfig.m index 300f14e7..c8c93623 100644 --- a/CountlyServerConfig.m +++ b/CountlyServerConfig.m @@ -84,7 +84,7 @@ - (void)fetchServerConfig if (CountlyDeviceInfo.sharedInstance.isDeviceIDTemporary) return; - NSURLSessionTask* task = [NSURLSession.sharedSession dataTaskWithRequest:[self serverConfigRequest] completionHandler:^(NSData* data, NSURLResponse* response, NSError* error) + NSURLSessionTask* task = [CountlyCommon.sharedInstance.URLSession dataTaskWithRequest:[self serverConfigRequest] completionHandler:^(NSData* data, NSURLResponse* response, NSError* error) { NSDictionary *serverConfigResponse = nil; From c2ea9fae9f1d5c726564bf29a492873ab3d0f72f Mon Sep 17 00:00:00 2001 From: turtledreams <62231246+turtledreams@users.noreply.github.com> Date: Thu, 14 Nov 2024 22:00:25 +0900 Subject: [PATCH 06/13] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a67eec0..3f8d3e68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## XX.XX.XX * Mitigated an issue where visibility could have been wrongly assigned if a view was closed while going to background. (Experimental!) +* Mitigated an issue where the user provided URLSessionConfiguration was not applied to direct requests ## 24.7.7 * Changed the visibility tracking segmentation values to binary From 995f351beb7bfe537aa4884024bb5ca82de612a9 Mon Sep 17 00:00:00 2001 From: turtledreams <62231246+turtledreams@users.noreply.github.com> Date: Thu, 14 Nov 2024 22:57:37 +0900 Subject: [PATCH 07/13] Version update to 7.8 --- CHANGELOG.md | 2 +- Countly-PL.podspec | 2 +- Countly.podspec | 2 +- Countly.xcodeproj/project.pbxproj | 4 ++-- CountlyCommon.m | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f8d3e68..5a61dfd3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## XX.XX.XX +## 24.7.8 * Mitigated an issue where visibility could have been wrongly assigned if a view was closed while going to background. (Experimental!) * Mitigated an issue where the user provided URLSessionConfiguration was not applied to direct requests diff --git a/Countly-PL.podspec b/Countly-PL.podspec index 738b41f7..45158958 100644 --- a/Countly-PL.podspec +++ b/Countly-PL.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Countly-PL' - s.version = '24.7.7' + s.version = '24.7.8' s.license = { :type => 'MIT', :file => 'LICENSE' } s.summary = 'Countly is an innovative, real-time, open source mobile analytics platform.' s.homepage = 'https://github.com/Countly/countly-sdk-ios' diff --git a/Countly.podspec b/Countly.podspec index 620dac2b..b529a9a3 100644 --- a/Countly.podspec +++ b/Countly.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Countly' - s.version = '24.7.7' + s.version = '24.7.8' s.license = { :type => 'MIT', :file => 'LICENSE' } s.summary = 'Countly is an innovative, real-time, open source mobile analytics platform.' s.homepage = 'https://github.com/Countly/countly-sdk-ios' diff --git a/Countly.xcodeproj/project.pbxproj b/Countly.xcodeproj/project.pbxproj index e42a8628..d3f02e6f 100644 --- a/Countly.xcodeproj/project.pbxproj +++ b/Countly.xcodeproj/project.pbxproj @@ -738,7 +738,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.14; - MARKETING_VERSION = 24.7.7; + MARKETING_VERSION = 24.7.8; PRODUCT_BUNDLE_IDENTIFIER = ly.count.CountlyiOSSDK; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -770,7 +770,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.14; - MARKETING_VERSION = 24.7.7; + MARKETING_VERSION = 24.7.8; PRODUCT_BUNDLE_IDENTIFIER = ly.count.CountlyiOSSDK; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/CountlyCommon.m b/CountlyCommon.m index 1017d2c2..6ab0a594 100644 --- a/CountlyCommon.m +++ b/CountlyCommon.m @@ -29,7 +29,7 @@ @interface CountlyCommon () #endif @end -NSString* const kCountlySDKVersion = @"24.7.7"; +NSString* const kCountlySDKVersion = @"24.7.8"; NSString* const kCountlySDKName = @"objc-native-ios"; NSString* const kCountlyErrorDomain = @"ly.count.ErrorDomain"; From 68eec6abd213ca8a7b9e6fca32ed0138e8d5fe56 Mon Sep 17 00:00:00 2001 From: turtledreams <62231246+turtledreams@users.noreply.github.com> Date: Fri, 15 Nov 2024 22:19:15 +0900 Subject: [PATCH 08/13] Concurrent modification fix --- CHANGELOG.md | 1 + CountlyViewTrackingInternal.m | 26 ++++++++++++++++---------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a61dfd3..2d8ae75e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## 24.7.8 * Mitigated an issue where visibility could have been wrongly assigned if a view was closed while going to background. (Experimental!) * Mitigated an issue where the user provided URLSessionConfiguration was not applied to direct requests +* Mitigated an issue where a concurrent modification error could have happen when starting multiple stopped views ## 24.7.7 * Changed the visibility tracking segmentation values to binary diff --git a/CountlyViewTrackingInternal.m b/CountlyViewTrackingInternal.m index 6b74a0c2..48bf365c 100644 --- a/CountlyViewTrackingInternal.m +++ b/CountlyViewTrackingInternal.m @@ -545,27 +545,33 @@ - (void)startStoppedViewsInternal { // Create an array to store keys for views that need to be removed NSMutableArray *keysToRemove = [NSMutableArray array]; - + NSMutableArray *keysToStart = [NSMutableArray array]; + + // Collect keys without modifying the dictionary [self.viewDataDictionary enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, CountlyViewData * _Nonnull viewData, BOOL * _Nonnull stop) { if (viewData.willStartAgain) { - NSString *viewID = [self startViewInternal:viewData.viewName customSegmentation:viewData.startSegmentation isAutoStoppedView:viewData.isAutoStoppedView]; - - // Retrieve the newly created viewData for the viewID - CountlyViewData* viewDataNew = self.viewDataDictionary[viewID]; - - // Copy the segmentation data from the old view to the new view - viewDataNew.segmentation = viewData.segmentation.mutableCopy; - - // Add the old view's ID to the array for removal later + [keysToStart addObject:key]; [keysToRemove addObject:viewData.viewID]; } }]; + // Start the collected views after enumeration + for (NSString *key in keysToStart) + { + CountlyViewData *viewData = self.viewDataDictionary[key]; + NSString *viewID = [self startViewInternal:viewData.viewName customSegmentation:viewData.startSegmentation isAutoStoppedView:viewData.isAutoStoppedView]; + + // Retrieve and update the newly created viewData + CountlyViewData *viewDataNew = self.viewDataDictionary[viewID]; + viewDataNew.segmentation = viewData.segmentation.mutableCopy; + } + // Remove the entries from the dictionary [self.viewDataDictionary removeObjectsForKeys:keysToRemove]; } + - (void)stopAllViewsInternal:(NSDictionary *)segmentation { // TODO: Should apply all the segmenation operations here at one place instead of doing it for individual view From 31a3e37c7651b45e01519aa9dd6638df833c4917 Mon Sep 17 00:00:00 2001 From: Arif Burak Demiray Date: Thu, 21 Nov 2024 09:45:54 +0300 Subject: [PATCH 09/13] feat: content language support --- CHANGELOG.md | 2 ++ CountlyContentBuilderInternal.m | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a61dfd3..f314987a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,6 @@ ## 24.7.8 +* Added support for localization of content blocks. + * Mitigated an issue where visibility could have been wrongly assigned if a view was closed while going to background. (Experimental!) * Mitigated an issue where the user provided URLSessionConfiguration was not applied to direct requests diff --git a/CountlyContentBuilderInternal.m b/CountlyContentBuilderInternal.m index ec0bbcb0..196edb8a 100644 --- a/CountlyContentBuilderInternal.m +++ b/CountlyContentBuilderInternal.m @@ -137,6 +137,11 @@ - (NSURLRequest *)fetchContentsRequest queryString = [CountlyConnectionManager.sharedInstance appendChecksum:queryString]; + NSArray *components = [CountlyDeviceInfo.locale componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"_-"]]; + + queryString = [queryString stringByAppendingFormat:@"&%@=%@", + @"la", components.firstObject]; + NSString* URLString = [NSString stringWithFormat:@"%@%@?%@", CountlyConnectionManager.sharedInstance.host, kCountlyEndpointContent, From aee039fa7d47d0ca18ffe28e788f1af29a02ef3b Mon Sep 17 00:00:00 2001 From: turtledreams <62231246+turtledreams@users.noreply.github.com> Date: Thu, 28 Nov 2024 01:58:11 +0900 Subject: [PATCH 10/13] Update CountlyNotificationService.m --- CountlyNotificationService.m | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CountlyNotificationService.m b/CountlyNotificationService.m index 87841808..a42a08ad 100644 --- a/CountlyNotificationService.m +++ b/CountlyNotificationService.m @@ -5,7 +5,6 @@ // Please visit www.count.ly for more information. #import "CountlyNotificationService.h" -#import "CountlyCommon.h" #if DEBUG #define COUNTLY_EXT_LOG(fmt, ...) NSLog([@"%@ " stringByAppendingString:fmt], @"[CountlyNSE]", ##__VA_ARGS__) @@ -86,7 +85,7 @@ + (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withConte COUNTLY_EXT_LOG(@"Attachment specified in Countly payload: %@", attachmentURL); - [[CountlyCommon.sharedInstance.URLSession downloadTaskWithURL:[NSURL URLWithString:attachmentURL] completionHandler:^(NSURL * location, NSURLResponse * response, NSError * error) + [[NSURLSession.sharedSession downloadTaskWithURL:[NSURL URLWithString:attachmentURL] completionHandler:^(NSURL * location, NSURLResponse * response, NSError * error) { if (!error) { From 791f23633571843dc278a4c4d9977fe88d825593 Mon Sep 17 00:00:00 2001 From: Arif Burak Demiray Date: Thu, 28 Nov 2024 11:57:01 +0300 Subject: [PATCH 11/13] fix: added support for segmentation for event action for contents --- CHANGELOG.md | 1 + CountlyWebViewManager.m | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1b2e77a..daec9b8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * Mitigated an issue where visibility could have been wrongly assigned if a view was closed while going to background. (Experimental!) * Mitigated an issue where the user provided URLSessionConfiguration was not applied to direct requests * Mitigated an issue where a concurrent modification error could have happen when starting multiple stopped views +* Mitigated an issue that parsing internal content event segmentation. ## 24.7.7 * Changed the visibility tracking segmentation values to binary diff --git a/CountlyWebViewManager.m b/CountlyWebViewManager.m index 258588a0..14a954ff 100644 --- a/CountlyWebViewManager.m +++ b/CountlyWebViewManager.m @@ -208,11 +208,15 @@ - (void)recordEventsWithJSONString:(NSString *)jsonString { for (NSDictionary *event in events) { NSString *key = event[@"key"]; - NSDictionary *segmentation = event[@"sg"]; + NSDictionary *segmentation = event[@"segmentation"]; + NSDictionary *sg = event[@"sg"]; if(!key) { CLY_LOG_I(@"Skipping the event due to key is empty or nil"); continue; } + if(sg) { + segmentation = sg; + } if(!segmentation) { CLY_LOG_I(@"Skipping the event due to missing segmentation"); continue; From b642a317529ac072adda4676c4d5f3b72c82a8f7 Mon Sep 17 00:00:00 2001 From: Arif Burak Demiray Date: Tue, 3 Dec 2024 15:32:10 +0300 Subject: [PATCH 12/13] fix: views --- CountlyConnectionManager.h | 2 ++ CountlyConnectionManager.m | 6 ++++++ CountlyViewTrackingInternal.m | 4 ++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CountlyConnectionManager.h b/CountlyConnectionManager.h index 273621b5..53cff0c9 100644 --- a/CountlyConnectionManager.h +++ b/CountlyConnectionManager.h @@ -69,4 +69,6 @@ extern const NSInteger kCountlyGETRequestMaxLength; - (NSString *)queryEssentials; - (NSString *)appendChecksum:(NSString *)queryString; +- (BOOL)isSessionStarted; + @end diff --git a/CountlyConnectionManager.m b/CountlyConnectionManager.m index 1368f748..4bc1f207 100644 --- a/CountlyConnectionManager.m +++ b/CountlyConnectionManager.m @@ -16,6 +16,7 @@ @interface CountlyConnectionManager () @property (nonatomic) NSURLSession* URLSession; @property (nonatomic, strong) NSDate *startTime; + @end NSString* const kCountlyQSKeyAppKey = @"app_key"; @@ -105,6 +106,11 @@ - (instancetype)init return self; } + +- (BOOL)isSessionStarted { + return isSessionStarted; +} + - (void)resetInstance { CLY_LOG_I(@"%s", __FUNCTION__); onceToken = 0; diff --git a/CountlyViewTrackingInternal.m b/CountlyViewTrackingInternal.m index 48bf365c..53f9b319 100644 --- a/CountlyViewTrackingInternal.m +++ b/CountlyViewTrackingInternal.m @@ -436,7 +436,7 @@ - (NSString*)startViewInternal:(NSString *)viewName customSegmentation:(NSDictio segmentation[kCountlyVTKeySegment] = CountlyDeviceInfo.osName; segmentation[kCountlyVTKeyVisit] = @1; - if (self.isFirstView) + if (self.isFirstView && [CountlyConnectionManager.sharedInstance isSessionStarted]) { self.isFirstView = NO; segmentation[kCountlyVTKeyStart] = @1; @@ -765,7 +765,7 @@ - (void)applicationWillTerminate { - (void)resetFirstView { - self.isFirstView = NO; + self.isFirstView = YES; } From d0c54f8b33b5cc0f4da311e1c7e19ade99572d2b Mon Sep 17 00:00:00 2001 From: turtledreams <62231246+turtledreams@users.noreply.github.com> Date: Tue, 3 Dec 2024 23:19:10 +0900 Subject: [PATCH 13/13] Version 7.9 --- CHANGELOG.md | 3 +++ Countly-PL.podspec | 2 +- Countly.podspec | 2 +- Countly.xcodeproj/project.pbxproj | 4 ++-- CountlyCommon.m | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index daec9b8a..ec54172d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 24.7.9 +* Improved view tracking capabilities + ## 24.7.8 * Added support for localization of content blocks. diff --git a/Countly-PL.podspec b/Countly-PL.podspec index 45158958..2d85adbd 100644 --- a/Countly-PL.podspec +++ b/Countly-PL.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Countly-PL' - s.version = '24.7.8' + s.version = '24.7.9' s.license = { :type => 'MIT', :file => 'LICENSE' } s.summary = 'Countly is an innovative, real-time, open source mobile analytics platform.' s.homepage = 'https://github.com/Countly/countly-sdk-ios' diff --git a/Countly.podspec b/Countly.podspec index b529a9a3..41dd3402 100644 --- a/Countly.podspec +++ b/Countly.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Countly' - s.version = '24.7.8' + s.version = '24.7.9' s.license = { :type => 'MIT', :file => 'LICENSE' } s.summary = 'Countly is an innovative, real-time, open source mobile analytics platform.' s.homepage = 'https://github.com/Countly/countly-sdk-ios' diff --git a/Countly.xcodeproj/project.pbxproj b/Countly.xcodeproj/project.pbxproj index d3f02e6f..071f99d1 100644 --- a/Countly.xcodeproj/project.pbxproj +++ b/Countly.xcodeproj/project.pbxproj @@ -738,7 +738,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.14; - MARKETING_VERSION = 24.7.8; + MARKETING_VERSION = 24.7.9; PRODUCT_BUNDLE_IDENTIFIER = ly.count.CountlyiOSSDK; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -770,7 +770,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.14; - MARKETING_VERSION = 24.7.8; + MARKETING_VERSION = 24.7.9; PRODUCT_BUNDLE_IDENTIFIER = ly.count.CountlyiOSSDK; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/CountlyCommon.m b/CountlyCommon.m index 6ab0a594..000094f4 100644 --- a/CountlyCommon.m +++ b/CountlyCommon.m @@ -29,7 +29,7 @@ @interface CountlyCommon () #endif @end -NSString* const kCountlySDKVersion = @"24.7.8"; +NSString* const kCountlySDKVersion = @"24.7.9"; NSString* const kCountlySDKName = @"objc-native-ios"; NSString* const kCountlyErrorDomain = @"ly.count.ErrorDomain";