diff --git a/Countly.m b/Countly.m index 6c51a817..a41cf2a4 100644 --- a/Countly.m +++ b/Countly.m @@ -275,6 +275,9 @@ - (void)startWithConfig:(CountlyConfig *)config if(config.content.getGlobalContentCallback) { CountlyContentBuilderInternal.sharedInstance.contentCallback = config.content.getGlobalContentCallback; } + if(config.content.getZoneTimerInterval){ + CountlyContentBuilderInternal.sharedInstance.zoneTimerInterval = config.content.getZoneTimerInterval; + } #endif [CountlyPerformanceMonitoring.sharedInstance startWithConfig:config.apm]; diff --git a/CountlyContentBuilderInternal.h b/CountlyContentBuilderInternal.h index be18530d..696d688a 100644 --- a/CountlyContentBuilderInternal.h +++ b/CountlyContentBuilderInternal.h @@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN @interface CountlyContentBuilderInternal: NSObject #if (TARGET_OS_IOS) @property (nonatomic, strong) NSArray *currentTags; -@property (nonatomic, assign) NSTimeInterval requestInterval; +@property (nonatomic, assign) NSTimeInterval zoneTimerInterval; @property (nonatomic) ContentCallback contentCallback; + (instancetype)sharedInstance; diff --git a/CountlyContentBuilderInternal.m b/CountlyContentBuilderInternal.m index 196edb8a..69543078 100644 --- a/CountlyContentBuilderInternal.m +++ b/CountlyContentBuilderInternal.m @@ -29,7 +29,7 @@ - (instancetype)init { if (self = [super init]) { - self.requestInterval = 30.0; + self.zoneTimerInterval = 30.0; _requestTimer = nil; } @@ -55,7 +55,7 @@ - (void)enterContentZone:(NSArray *)tags { self.currentTags = tags; [self fetchContents];; - _requestTimer = [NSTimer scheduledTimerWithTimeInterval:self.requestInterval + _requestTimer = [NSTimer scheduledTimerWithTimeInterval:self.zoneTimerInterval target:self selector:@selector(fetchContents) userInfo:nil diff --git a/CountlyContentConfig.h b/CountlyContentConfig.h index d72fac0c..ed17787b 100644 --- a/CountlyContentConfig.h +++ b/CountlyContentConfig.h @@ -32,6 +32,20 @@ typedef void (^ContentCallback)(ContentStatus contentStatus, NSDictionary 15) { + self.zoneTimerInterval = zoneTimerIntervalSeconds; + } +} + +- (NSUInteger) getZoneTimerInterval +{ + return self.zoneTimerInterval; +} #endif @end