From b642a317529ac072adda4676c4d5f3b72c82a8f7 Mon Sep 17 00:00:00 2001 From: Arif Burak Demiray Date: Tue, 3 Dec 2024 15:32:10 +0300 Subject: [PATCH] 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; }