Skip to content

Commit cedf27a

Browse files
authored
Merge pull request #394 from Countly/disable_sc
feat: disable sc calls
2 parents 2b6e7ef + 666b0dd commit cedf27a

File tree

4 files changed

+13
-18
lines changed

4 files changed

+13
-18
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## XX.XX.XX
22
* Adding SDK health check requests after init
33
* The feedback widgets now have fullscreen and transparent backgrounds for a cleaner look.
4-
* Added a config method to disable server config in the initialization "disableSDKBehaviorSettings()".
4+
* Added a config method to disable server config in the initialization "disableSDKBehaviorSettingsUpdates()".
55

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

Countly.m

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

9393
config = [self checkAndFixInternalLimitsConfig:config];
9494

95-
if (config.disableSDKBehaviorSettings) {
95+
if (config.disableSDKBehaviorSettingsUpdates) {
9696
[CountlyServerConfig.sharedInstance disableSDKBehaviourSettings];
9797
}
9898
[CountlyServerConfig.sharedInstance retrieveServerConfigFromStorage:config.sdkBehaviorSettings];
@@ -170,7 +170,7 @@ - (void)startWithConfig:(CountlyConfig *)config
170170
CountlyDeviceInfo.sharedInstance.customMetrics = [customMetricsTruncated cly_limited:@"Custom metric"];
171171

172172
[Countly.user save];
173-
// If something added related to server config, make sure to check CountlyServerConfig.notifySdkConfigChange
173+
// If something added related to server config, make sure to check CountlyServerConfig.notifySdkConfigChange
174174
[CountlyServerConfig.sharedInstance fetchServerConfig:config];
175175

176176
#if (TARGET_OS_IOS)

CountlyConfig.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -676,9 +676,9 @@ typedef enum : NSUInteger
676676
@property(nonatomic, copy) NSString *sdkBehaviorSettings;
677677

678678
/**
679-
* Disable the server configuration
679+
* Disable the server configuration updates to the server
680680
*/
681-
@property(nonatomic) BOOL disableSDKBehaviorSettings;
681+
@property(nonatomic) BOOL disableSDKBehaviorSettingsUpdates;
682682

683683
#if (TARGET_OS_IOS)
684684
/**

CountlyServerConfig.m

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +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;
41+
@property (nonatomic) BOOL serverConfigUpdatesDisabled;
4242

4343
@end
4444

@@ -109,16 +109,13 @@ - (instancetype)init
109109
_version = 0;
110110
_currentServerConfigUpdateInterval = 4;
111111
_requestTimer = nil;
112-
_serverConfigDisabled = NO;
112+
_serverConfigUpdatesDisabled = NO;
113113
}
114114
return self;
115115
}
116116

117117
- (void)retrieveServerConfigFromStorage:(NSString *)sdkBehaviorSettings
118118
{
119-
if (_serverConfigDisabled) {
120-
return;
121-
}
122119
NSError *error = nil;
123120
NSDictionary *serverConfigObject = [CountlyPersistency.sharedInstance retrieveServerConfig];
124121
if (serverConfigObject.count == 0 && sdkBehaviorSettings)
@@ -202,10 +199,6 @@ - (void)populateServerConfig:(NSDictionary *)serverConfig
202199

203200
- (void)notifySdkConfigChange:(CountlyConfig *)config
204201
{
205-
if (_serverConfigDisabled) {
206-
return;
207-
}
208-
209202
config.enableDebug = _loggingEnabled || config.enableDebug;
210203
CountlyCommon.sharedInstance.enableDebug = config.enableDebug;
211204

@@ -306,7 +299,7 @@ - (void)fetchServerConfigTimer:(NSTimer *)timer
306299

307300
- (void)fetchServerConfigIfTimeIsUp
308301
{
309-
if (_serverConfigDisabled) {
302+
if (_serverConfigUpdatesDisabled) {
310303
return;
311304
}
312305

@@ -324,10 +317,12 @@ - (void)fetchServerConfigIfTimeIsUp
324317

325318
- (void)fetchServerConfig:(CountlyConfig *)config
326319
{
327-
if (_serverConfigDisabled) {
320+
CLY_LOG_D(@"%s, fetching sdk behavior settings", __FUNCTION__);
321+
322+
if (_serverConfigUpdatesDisabled) {
323+
CLY_LOG_D(@"%s, sdk behavior settings updates disabled, omitting fetch", __FUNCTION__);
328324
return;
329325
}
330-
CLY_LOG_D(@"Fetching server configs...");
331326

332327
if (CountlyDeviceInfo.sharedInstance.isDeviceIDTemporary)
333328
return;
@@ -417,7 +412,7 @@ - (NSURLRequest *)serverConfigRequest
417412
}
418413

419414
- (void)disableSDKBehaviourSettings {
420-
_serverConfigDisabled = YES;
415+
_serverConfigUpdatesDisabled = YES;
421416
}
422417

423418
- (BOOL)trackingEnabled

0 commit comments

Comments
 (0)