Skip to content

Commit 8eec0e7

Browse files
Merge pull request #244 from Countly/hybrid-session
Added enableManualSessionControlHybridMode
2 parents 60c2f06 + 45e6a26 commit 8eec0e7

File tree

7 files changed

+22
-7
lines changed

7 files changed

+22
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
- Added `automaticViewTrackingExclusionList` config for automatic view tracking exclusion list
2121
- Added `globalViewSegmentation` config to add set global view segmentation.
2222
- Added `enrollABOnRCDownload` config method to auto enroll users to AB tests when downloading RC values.
23+
- Added `enableManualSessionControlHybridMode` config. With this mode 'updateSession' calls will automatically be handled by SDK for manual session handling.
2324
- Deprecated `giveConsentForAllFeatures` method
2425
- Deprecated `CLYAutoViewTracking` in config
2526
- Deprecated existing view tracking methods and variables:

Countly-PL.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Pod::Spec.new do |s|
1717

1818
s.subspec 'Core' do |core|
1919
core.source_files = '*.{h,m}'
20-
core.public_header_files = 'Countly.h', 'CountlyUserDetails.h', 'CountlyConfig.h', 'CountlyFeedbackWidget.h', 'CountlyRCData.h', 'CountlyRemoteConfig.h'
20+
core.public_header_files = 'Countly.h', 'CountlyUserDetails.h', 'CountlyConfig.h', 'CountlyFeedbackWidget.h', 'CountlyRCData.h', 'CountlyRemoteConfig.h', 'CountlyViewTracking.h'
2121
core.preserve_path = 'countly_dsym_uploader.sh'
2222
core.ios.frameworks = ['Foundation', 'UIKit', 'UserNotifications', 'CoreLocation', 'WebKit', 'CoreTelephony', 'WatchConnectivity']
2323
end

Countly.m

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ - (void)startWithConfig:(CountlyConfig *)config
124124
CountlyPersistency.sharedInstance.storedRequestsLimit = MAX(1, config.storedRequestsLimit);
125125

126126
CountlyCommon.sharedInstance.manualSessionHandling = config.manualSessionHandling;
127+
CountlyCommon.sharedInstance.enableManualSessionControlHybridMode = config.enableManualSessionControlHybridMode;
127128

128129
CountlyCommon.sharedInstance.attributionID = config.attributionID;
129130

@@ -243,7 +244,14 @@ - (void)onTimer:(NSTimer *)timer
243244
return;
244245

245246
if (!CountlyCommon.sharedInstance.manualSessionHandling)
247+
{
246248
[CountlyConnectionManager.sharedInstance updateSession];
249+
}
250+
// this condtion is called only when both manual session handling and hybrid mode is enabled.
251+
else if(CountlyCommon.sharedInstance.enableManualSessionControlHybridMode)
252+
{
253+
[CountlyConnectionManager.sharedInstance updateSession];
254+
}
247255

248256
[CountlyConnectionManager.sharedInstance sendEvents];
249257
}

Countly.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Pod::Spec.new do |s|
1717

1818
s.subspec 'Core' do |core|
1919
core.source_files = '*.{h,m}'
20-
core.public_header_files = 'Countly.h', 'CountlyUserDetails.h', 'CountlyConfig.h', 'CountlyFeedbackWidget.h', 'CountlyRCData.h', 'CountlyRemoteConfig.h'
20+
core.public_header_files = 'Countly.h', 'CountlyUserDetails.h', 'CountlyConfig.h', 'CountlyFeedbackWidget.h', 'CountlyRCData.h', 'CountlyRemoteConfig.h', 'CountlyViewTracking.h'
2121
core.preserve_path = 'countly_dsym_uploader.sh'
2222
core.ios.frameworks = ['Foundation', 'UIKit', 'UserNotifications', 'CoreLocation', 'WebKit', 'CoreTelephony', 'WatchConnectivity']
2323
end

CountlyCommon.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ extern NSString* const kCountlySDKName;
8080
@property (nonatomic) CLYInternalLogLevel internalLogLevel;
8181
@property (nonatomic, copy) NSString* attributionID;
8282
@property (nonatomic) BOOL manualSessionHandling;
83+
@property (nonatomic) BOOL enableManualSessionControlHybridMode;
8384
@property (nonatomic) BOOL enableOrientationTracking;
8485
@property (nonatomic) BOOL enableServerConfiguration;
8586

CountlyConfig.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,14 @@ typedef enum : NSUInteger
403403
*/
404404
@property (nonatomic) BOOL manualSessionHandling;
405405

406+
/**
407+
* For handling start and stop sessions manually.
408+
* @discussion If set, SDK does not handle beginning and ending sessions automatically. Methods @c beginSession and @c endSession need to be called manually.
409+
* update session will handle auto automatically, no need to call @c updateSession when hybrid mode is enabled.
410+
* NOTE: It will work only when manualSessionHandling is enabled.
411+
*/
412+
@property (nonatomic) BOOL enableManualSessionControlHybridMode;
413+
406414
#pragma mark -
407415

408416
/**

CountlyViewTrackingInternal.m

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,7 @@ - (void)addAutoViewTrackingExclutionList:(NSArray *)viewTrackingExclusionList
238238
{
239239
[self.automaticViewTrackingExclusionList addObjectsFromArray:viewTrackingExclusionList];
240240
}
241-
#endif
242241

243-
#if (TARGET_OS_IOS || TARGET_OS_TV)
244242
- (void)startAutoViewTracking
245243
{
246244
if (!self.isEnabledOnInitialConfig)
@@ -281,9 +279,6 @@ - (void)setIsAutoViewTrackingActive:(BOOL)isAutoViewTrackingActive
281279
}
282280

283281

284-
#endif
285-
286-
287282
#pragma mark - Public methods Deprecated
288283

289284
- (void)addExceptionForAutoViewTracking:(NSString *)exception
@@ -299,6 +294,8 @@ - (void)removeExceptionForAutoViewTracking:(NSString *)exception
299294
[self.automaticViewTrackingExclusionList removeObject:exception];
300295
}
301296

297+
#endif
298+
302299
#pragma mark - Internal methods old
303300
- (void)stopViewWithNameInternal:(NSString *) viewName customSegmentation:(NSDictionary *)customSegmentation
304301
{

0 commit comments

Comments
 (0)