Skip to content

Commit cddd968

Browse files
fix: do not remove on consent revoke
1 parent 0aa5361 commit cddd968

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

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

Lines changed: 2 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() {
@@ -51,7 +51,7 @@ public void valuesClearedOnConsentRemoval() {
5151
countly.consent().removeConsentAll();
5252

5353
Assert.assertEquals(2, countly.remoteConfig().getValues().size()); // values are cache cleared
54-
countly.remoteConfig().getValues().forEach((k, v) -> Assert.assertFalse(v.isCurrentUsersData));
54+
countly.remoteConfig().getValues().forEach((k, v) -> Assert.assertTrue(v.isCurrentUsersData));
5555
}
5656

5757
/**

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -426,11 +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-
CacheOrClearRCValuesIfNeeded();
434432
}
435433
}
436434
}

0 commit comments

Comments
 (0)