Skip to content

Commit ee77e4e

Browse files
authored
Merge branch 'staging' into fw_rework_basic
2 parents 421d80e + a769739 commit ee77e4e

File tree

5 files changed

+32
-1
lines changed

5 files changed

+32
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## XX.XX.XX
22
* The feedback widgets now have fullscreen and transparent backgrounds for a cleaner look.
3+
* Added a config method to disable server config in the initialization "disableSDKBehaviorSettings()".
34

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

Countly.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@ - (void)startWithConfig:(CountlyConfig *)config
9292

9393
config = [self checkAndFixInternalLimitsConfig:config];
9494

95-
[CountlyServerConfig.sharedInstance retrieveServerConfigFromStorage:config.sdkBehaviorSettings];
95+
if (config.disableSDKBehaviorSettings) {
96+
[CountlyServerConfig.sharedInstance disableSDKBehaviourSettings];
97+
}
98+
[CountlyServerConfig.sharedInstance retrieveServerConfigFromStorage:config.sdkBehaviorSettings];
9699

97100
CountlyCommon.sharedInstance.maxKeyLength = config.sdkInternalLimits.getMaxKeyLength;
98101
CountlyCommon.sharedInstance.maxValueLength = config.sdkInternalLimits.getMaxValueSize;

CountlyConfig.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,11 @@ typedef enum : NSUInteger
675675
*/
676676
@property(nonatomic, copy) NSString *sdkBehaviorSettings;
677677

678+
/**
679+
* Disable the server configuration
680+
*/
681+
@property(nonatomic) BOOL disableSDKBehaviorSettings;
682+
678683
#if (TARGET_OS_IOS)
679684
/**
680685
* Variable to access content configurations.

CountlyServerConfig.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ extern NSString* const kCountlySCKeySC;
1515
- (void)fetchServerConfig:(CountlyConfig *)config;
1616
- (void)retrieveServerConfigFromStorage:(NSString*) sdkBehaviorSettings;
1717
- (void)fetchServerConfigIfTimeIsUp;
18+
- (void)disableSDKBehaviourSettings;
1819

1920
- (BOOL)trackingEnabled;
2021
- (BOOL)networkingEnabled;

CountlyServerConfig.m

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ @interface CountlyServerConfig () {
3838
@property (nonatomic) NSInteger version;
3939
@property (nonatomic) long long timestamp;
4040
@property (nonatomic) long long lastFetchTimestamp;
41+
@property (nonatomic) BOOL serverConfigDisabled;
4142

4243
@end
4344

@@ -108,12 +109,16 @@ - (instancetype)init
108109
_version = 0;
109110
_currentServerConfigUpdateInterval = 4;
110111
_requestTimer = nil;
112+
_serverConfigDisabled = NO;
111113
}
112114
return self;
113115
}
114116

115117
- (void)retrieveServerConfigFromStorage:(NSString *)sdkBehaviorSettings
116118
{
119+
if (_serverConfigDisabled) {
120+
return;
121+
}
117122
NSError *error = nil;
118123
NSDictionary *serverConfigObject = [CountlyPersistency.sharedInstance retrieveServerConfig];
119124
if (serverConfigObject.count == 0 && sdkBehaviorSettings)
@@ -197,6 +202,10 @@ - (void)populateServerConfig:(NSDictionary *)serverConfig
197202

198203
- (void)notifySdkConfigChange:(CountlyConfig *)config
199204
{
205+
if (_serverConfigDisabled) {
206+
return;
207+
}
208+
200209
config.enableDebug = _loggingEnabled || config.enableDebug;
201210
CountlyCommon.sharedInstance.enableDebug = config.enableDebug;
202211

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

298307
- (void)fetchServerConfigIfTimeIsUp
299308
{
309+
if (_serverConfigDisabled) {
310+
return;
311+
}
312+
300313
if (_lastFetchTimestamp)
301314
{
302315
long long currentTime = NSDate.date.timeIntervalSince1970 * 1000;
@@ -311,7 +324,11 @@ - (void)fetchServerConfigIfTimeIsUp
311324

312325
- (void)fetchServerConfig:(CountlyConfig *)config
313326
{
327+
if (_serverConfigDisabled) {
328+
return;
329+
}
314330
CLY_LOG_D(@"Fetching server configs...");
331+
315332
if (CountlyDeviceInfo.sharedInstance.isDeviceIDTemporary)
316333
return;
317334

@@ -399,6 +416,10 @@ - (NSURLRequest *)serverConfigRequest
399416
CLY_LOG_D(@"serverConfigRequest URL :%@", URL);
400417
}
401418

419+
- (void)disableSDKBehaviourSettings {
420+
_serverConfigDisabled = YES;
421+
}
422+
402423
- (BOOL)trackingEnabled
403424
{
404425
return _trackingEnabled;

0 commit comments

Comments
 (0)