Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## XX.XX.XX
* Added a config method to disable server config in the initialization "disableSDKBehaviorSettings()".

## 25.4.1
* Mitigated an issue that could occur while serializing events to improve stability, performance and memory usage.

Expand Down
5 changes: 4 additions & 1 deletion Countly.m
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ - (void)startWithConfig:(CountlyConfig *)config

config = [self checkAndFixInternalLimitsConfig:config];

[CountlyServerConfig.sharedInstance retrieveServerConfigFromStorage:config.sdkBehaviorSettings];
if (config.disableSDKBehaviorSettings) {
[CountlyServerConfig.sharedInstance disableSDKBehaviourSettings];
}
[CountlyServerConfig.sharedInstance retrieveServerConfigFromStorage:config.sdkBehaviorSettings];

CountlyCommon.sharedInstance.maxKeyLength = config.sdkInternalLimits.getMaxKeyLength;
CountlyCommon.sharedInstance.maxValueLength = config.sdkInternalLimits.getMaxValueSize;
Expand Down
5 changes: 5 additions & 0 deletions CountlyConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,11 @@ typedef enum : NSUInteger
*/
@property(nonatomic, copy) NSString *sdkBehaviorSettings;

/**
* Disable the server configuration
*/
@property(nonatomic) BOOL disableSDKBehaviorSettings;

#if (TARGET_OS_IOS)
/**
* Variable to access content configurations.
Expand Down
1 change: 1 addition & 0 deletions CountlyServerConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ extern NSString* const kCountlySCKeySC;
- (void)fetchServerConfig:(CountlyConfig *)config;
- (void)retrieveServerConfigFromStorage:(NSString*) sdkBehaviorSettings;
- (void)fetchServerConfigIfTimeIsUp;
- (void)disableSDKBehaviourSettings;

- (BOOL)trackingEnabled;
- (BOOL)networkingEnabled;
Expand Down
21 changes: 21 additions & 0 deletions CountlyServerConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ @interface CountlyServerConfig () {
@property (nonatomic) NSInteger version;
@property (nonatomic) long long timestamp;
@property (nonatomic) long long lastFetchTimestamp;
@property (nonatomic) BOOL serverConfigDisabled;

@end

Expand Down Expand Up @@ -108,12 +109,16 @@ - (instancetype)init
_version = 0;
_currentServerConfigUpdateInterval = 4;
_requestTimer = nil;
_serverConfigDisabled = NO;
}
return self;
}

- (void)retrieveServerConfigFromStorage:(NSString *)sdkBehaviorSettings
{
if (_serverConfigDisabled) {
return;
}
NSError *error = nil;
NSDictionary *serverConfigObject = [CountlyPersistency.sharedInstance retrieveServerConfig];
if (serverConfigObject.count == 0 && sdkBehaviorSettings)
Expand Down Expand Up @@ -197,6 +202,10 @@ - (void)populateServerConfig:(NSDictionary *)serverConfig

- (void)notifySdkConfigChange:(CountlyConfig *)config
{
if (_serverConfigDisabled) {
return;
}

config.enableDebug = _loggingEnabled || config.enableDebug;
CountlyCommon.sharedInstance.enableDebug = config.enableDebug;

Expand Down Expand Up @@ -297,6 +306,10 @@ - (void)fetchServerConfigTimer:(NSTimer *)timer

- (void)fetchServerConfigIfTimeIsUp
{
if (_serverConfigDisabled) {
return;
}

if (_lastFetchTimestamp)
{
long long currentTime = NSDate.date.timeIntervalSince1970 * 1000;
Expand All @@ -311,7 +324,11 @@ - (void)fetchServerConfigIfTimeIsUp

- (void)fetchServerConfig:(CountlyConfig *)config
{
if (_serverConfigDisabled) {
return;
}
CLY_LOG_D(@"Fetching server configs...");

if (CountlyDeviceInfo.sharedInstance.isDeviceIDTemporary)
return;

Expand Down Expand Up @@ -399,6 +416,10 @@ - (NSURLRequest *)serverConfigRequest
CLY_LOG_D(@"serverConfigRequest URL :%@", URL);
}

- (void)disableSDKBehaviourSettings {
_serverConfigDisabled = YES;
}

- (BOOL)trackingEnabled
{
return _trackingEnabled;
Expand Down
Loading