Skip to content

Commit a6ab181

Browse files
feat: new config option to reverse it
1 parent e358aff commit a6ab181

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
## XX.XX.XX
2+
* Added a new config option `disableStoreDefaultPushConsent()` to change push consent storing behavior. When enabled default push consent will be stored if consent is not required.
3+
24
* Mitigated an issue where push notifications were blocked when consent was not required.
35

46
## 25.4.7

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,9 @@ public class CountlyConfig {
213213
// If set to true, request queue cleaner will remove all overflow at once instead of gradually (loop limited) removing
214214
boolean disableGradualRequestCleaner = false;
215215

216+
// If set to true, the SDK will not store the default push consent state on initialization for not requiring consent
217+
boolean disableStoreDefaultPushConsent = false;
218+
216219
/**
217220
* THIS VARIABLE SHOULD NOT BE USED
218221
* IT IS ONLY FOR INTERNAL TESTING
@@ -1063,7 +1066,7 @@ public synchronized CountlyConfig setRequestTimeoutDuration(int requestTimeoutDu
10631066
* Set the webview display option for Content and Feedback Widgets
10641067
*
10651068
* @param displayOption IMMERSIVE for full screen with hidden system UI, or
1066-
* SAFE_AREA to use app usable area and not overlap system UI
1069+
* SAFE_AREA to use app usable area and not overlap system UI
10671070
* @return config content to chain calls
10681071
*/
10691072
public synchronized CountlyConfig setWebviewDisplayOption(WebViewDisplayOption displayOption) {
@@ -1100,6 +1103,19 @@ public synchronized CountlyConfig disableGradualRequestCleaner() {
11001103
return this;
11011104
}
11021105

1106+
/**
1107+
* Disable storing the default push consent on initialization.
1108+
* By default, if consent is required and push consent is not set,
1109+
* the SDK was storing push consent as false on initialization.
1110+
* Now, if consent is not required, the SDK will store push consent as true on initialization.
1111+
*
1112+
* @return Returns the same config object for convenient linking
1113+
*/
1114+
public synchronized CountlyConfig disableStoreDefaultPushConsent() {
1115+
this.disableStoreDefaultPushConsent = true;
1116+
return this;
1117+
}
1118+
11031119
/**
11041120
* APM configuration interface to be used with CountlyConfig
11051121
*/

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ void initFinished(@NonNull final CountlyConfig config) {
284284
if (L.logEnabled()) {
285285
checkAllConsentInternal();
286286
}
287-
} else {
287+
} else if (!config.disableStoreDefaultPushConsent) {
288288
//if consent is not required, we need to make sure that the push consent is set to true
289289
//so that the "getConsentPushNoInit" returns true
290290
doPushConsentSpecialAction(true);

0 commit comments

Comments
 (0)