Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove enableServerConfiguration #457

Open
wants to merge 4 commits into
base: staging
Choose a base branch
from
Open
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
* ! Minor breaking change ! The experimental configuration function enableServerConfiguration has been removed. It is now enabled by default and can be controlled directly from the server.

## 25.1.1
* Mitigated an issue where after closing a content, they were not being fetched again.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public void init_disabled_storageEmpty() {
CountlyConfig config = TestUtils.createConfigurationConfig(false, null);
Countly countly = (new Countly()).init(config);

Assert.assertFalse(countly.moduleConfiguration.serverConfigEnabled);
Assert.assertNull(countlyStore.getServerConfig());
assertConfigDefault(countly);
}
Expand All @@ -50,7 +49,6 @@ public void init_enabled_storageEmpty() {
CountlyConfig config = TestUtils.createConfigurationConfig(true, null);
Countly countly = (new Countly()).init(config);

Assert.assertTrue(countly.moduleConfiguration.serverConfigEnabled);
Assert.assertNull(countlyStore.getServerConfig());
assertConfigDefault(countly);
}
Expand All @@ -68,7 +66,6 @@ public void init_enabled_storageAllowing() throws JSONException {
CountlyConfig config = TestUtils.createConfigurationConfig(true, null);
Countly countly = (new Countly()).init(config);

Assert.assertTrue(countly.moduleConfiguration.serverConfigEnabled);
Assert.assertNotNull(countlyStore.getServerConfig());
assertConfigDefault(countly);
}
Expand All @@ -86,7 +83,6 @@ public void init_enabled_storageForbidding() throws JSONException {
CountlyConfig config = TestUtils.createConfigurationConfig(true, null);
Countly countly = (new Countly()).init(config);

Assert.assertTrue(countly.moduleConfiguration.serverConfigEnabled);
Assert.assertNotNull(countlyStore.getServerConfig());
Assert.assertFalse(countly.moduleConfiguration.getNetworkingEnabled());
Assert.assertFalse(countly.moduleConfiguration.getTrackingEnabled());
Expand All @@ -105,7 +101,6 @@ public void init_disabled_storageAllowing() throws JSONException {
CountlyConfig config = TestUtils.createConfigurationConfig(false, null);
Countly countly = Countly.sharedInstance().init(config);

Assert.assertFalse(countly.moduleConfiguration.serverConfigEnabled);
Assert.assertNotNull(countlyStore.getServerConfig());
assertConfigDefault(countly);
}
Expand All @@ -123,7 +118,6 @@ public void init_disabled_storageForbidding() throws JSONException {
CountlyConfig config = TestUtils.createConfigurationConfig(false, null);
Countly countly = (new Countly()).init(config);

Assert.assertFalse(countly.moduleConfiguration.serverConfigEnabled);
Assert.assertNotNull(countlyStore.getServerConfig());
assertConfigDefault(countly);
}
Expand Down
15 changes: 0 additions & 15 deletions sdk/src/main/java/ly/count/android/sdk/CountlyConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,6 @@ public class CountlyConfig {

boolean explicitStorageModeEnabled = false;

boolean serverConfigurationEnabled = false;

boolean healthCheckEnabled = true;

// Requests older than this value in hours would be dropped (0 means this feature is disabled)
Expand Down Expand Up @@ -994,19 +992,6 @@ public synchronized CountlyConfig enableExplicitStorageMode() {
return this;
}

/**
* This is an experimental feature and it can have breaking changes
*
* With this mode enable, the SDK will acquire additional configuration from it's Countly server
*
* @return Returns the same config object for convenient linking
* @apiNote This is an EXPERIMENTAL feature, and it can have breaking changes
*/
public synchronized CountlyConfig enableServerConfiguration() {
serverConfigurationEnabled = true;
return this;
}

protected synchronized CountlyConfig disableHealthCheck() {
healthCheckEnabled = false;
return this;
Expand Down
32 changes: 6 additions & 26 deletions sdk/src/main/java/ly/count/android/sdk/ModuleConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
class ModuleConfiguration extends ModuleBase implements ConfigurationProvider {
ImmediateRequestGenerator immediateRequestGenerator;

boolean serverConfigEnabled = false;

JSONObject latestRetrievedConfigurationFull = null;
JSONObject latestRetrievedConfiguration = null;

Expand All @@ -34,27 +32,21 @@ class ModuleConfiguration extends ModuleBase implements ConfigurationProvider {
config.configProvider = this;
configProvider = this;

serverConfigEnabled = config.serverConfigurationEnabled;

immediateRequestGenerator = config.immediateRequestGenerator;

config.countlyStore.setConfigurationProvider(this);

if (serverConfigEnabled) {
//load the previously saved configuration
loadConfigFromStorage();
//load the previously saved configuration
loadConfigFromStorage();

//update the config variables according to the new state
updateConfigVariables();
}
//update the config variables according to the new state
updateConfigVariables();
}

@Override
void initFinished(@NonNull final CountlyConfig config) {
if (serverConfigEnabled) {
//once the SDK has loaded, init fetching the server config
fetchConfigFromServer();
}
//once the SDK has loaded, init fetching the server config
fetchConfigFromServer();
}

@Override
Expand Down Expand Up @@ -178,11 +170,6 @@ void saveAndStoreDownloadedConfig(@NonNull JSONObject config) {
void fetchConfigFromServer() {
L.v("[ModuleConfiguration] fetchConfigFromServer");

if (!serverConfigEnabled) {
L.d("[ModuleConfiguration] fetchConfigFromServer, fetch config from the server is aborted, server config is disabled");
return;
}

// why _cly? because module configuration is created before module device id, so we need to access it like this
// call order to module device id is after module configuration and device id provider is module device id
if (_cly.config_.deviceIdProvider.isTemporaryIdEnabled()) {
Expand Down Expand Up @@ -217,18 +204,11 @@ void fetchConfigFromServer() {

@Override
public boolean getNetworkingEnabled() {
if (!serverConfigEnabled) {
return defaultVNetworking;
}

return currentVNetworking;
}

@Override
public boolean getTrackingEnabled() {
if (!serverConfigEnabled) {
return defaultVTracking;
}
return currentVTracking;
}
}
Loading