Skip to content

Commit ce27f71

Browse files
authored
Merge pull request #335 from Countly/fix_3e
fix: do not remove RC on remote-config consent revoke
2 parents 7fddf11 + ef0df13 commit ce27f71

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* When an event is recorded
44
* During an internal timer tick
55
* Upon flushing the event queue
6+
7+
* Mitigated an issue where on consent revoke, remote config values were cleared, not anymore.
68

79
* Added support for array, List and JSONArray to all user given segmentations. They will support only mutable and ummutable versions of the primitive types. Which are:
810
* String, Integer, int, Boolean, bool, Float, float, Double, double, Long, long

sdk/src/androidTest/java/ly/count/android/sdk/ModuleRemoteConfigTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public void setUp() {
3030
}
3131

3232
/**
33-
* Consent removal should clear stored remote config values
33+
* Consent removal shouldn't clear stored remote config values
3434
*/
3535
@Test
3636
public void valuesClearedOnConsentRemoval() {
@@ -50,7 +50,8 @@ public void valuesClearedOnConsentRemoval() {
5050

5151
countly.consent().removeConsentAll();
5252

53-
Assert.assertEquals(0, countly.remoteConfig().getValues().size());
53+
Assert.assertEquals(2, countly.remoteConfig().getValues().size()); // values are cache cleared
54+
countly.remoteConfig().getValues().forEach((k, v) -> Assert.assertTrue(v.isCurrentUsersData));
5455
}
5556

5657
/**

sdk/src/main/java/ly/count/android/sdk/ModuleRemoteConfig.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -426,12 +426,9 @@ void RCAutomaticDownloadTrigger(boolean cacheClearOldValues) {
426426
void onConsentChanged(@NonNull final List<String> consentChangeDelta, final boolean newConsent, @NonNull final ModuleConsent.ConsentChangeSource changeSource) {
427427
if (consentChangeDelta.contains(Countly.CountlyFeatureNames.remoteConfig) && changeSource == ChangeConsentCall) {
428428
if (newConsent) {
429+
L.d("[RemoteConfig] onConsentChanged, Consent given, will update RC values");
429430
//if consent was just given trigger automatic RC download if needed
430431
RCAutomaticDownloadTrigger(false);
431-
} else {
432-
L.d("[RemoteConfig] removing remote-config consent. Clearing stored values");
433-
clearValueStoreInternal();
434-
// if consent is removed, we should clear remote config values
435432
}
436433
}
437434
}

0 commit comments

Comments
 (0)