diff --git a/README.md b/README.md index f7ca68b1b..22999f1a7 100644 --- a/README.md +++ b/README.md @@ -244,6 +244,8 @@ The `onError` callback can return the following responses: | `RequestFailedException` | Request failed due to a 4XX or 5XX error | | `InvalidRequestException` | Request is invalid | +By default, the SDK preserves all user consent data in case of OnError event is called. Set `spConsentLib.cleanUserDataOnError` flag to true after you initialize `spConsentLib` if you wish to opt-out from this behavior. This may cause a consent message to be shown again, depending on your scenario. + ## Loading the First Layer Message In order to show the FLM, the method `spConsentLib.loadMessage()` has to be called. diff --git a/cmplibrary/gradle.properties b/cmplibrary/gradle.properties index 8c52a2401..aada79908 100644 --- a/cmplibrary/gradle.properties +++ b/cmplibrary/gradle.properties @@ -1 +1 @@ -VERSION_NAME = 7.15.4 +VERSION_NAME = 7.15.5 diff --git a/cmplibrary/release_note.txt b/cmplibrary/release_note.txt index 7a0ef84aa..6f6d20457 100644 --- a/cmplibrary/release_note.txt +++ b/cmplibrary/release_note.txt @@ -1 +1 @@ -* removed `coreLibraryDesugaring`. [#872](https://github.com/SourcePointUSA/ios-cmp-app/pull/872) +* Expose opt out setting `cleanUserDataOnError` to clear user data on error [#873](https://github.com/SourcePointUSA/android-cmp-app/pull/873) diff --git a/cmplibrary/src/main/java/com/sourcepoint/cmplibrary/SpConsentLib.kt b/cmplibrary/src/main/java/com/sourcepoint/cmplibrary/SpConsentLib.kt index 245e6d78e..e1291ec6b 100644 --- a/cmplibrary/src/main/java/com/sourcepoint/cmplibrary/SpConsentLib.kt +++ b/cmplibrary/src/main/java/com/sourcepoint/cmplibrary/SpConsentLib.kt @@ -16,6 +16,8 @@ interface SpConsentLib { */ val dismissMessageOnBackPress: Boolean + var cleanUserDataOnError: Boolean + /** * Load the First Layer Message (FLM) */ diff --git a/cmplibrary/src/main/java/com/sourcepoint/cmplibrary/SpConsentLibMobileCore.kt b/cmplibrary/src/main/java/com/sourcepoint/cmplibrary/SpConsentLibMobileCore.kt index 0589fbf46..f61001b2a 100644 --- a/cmplibrary/src/main/java/com/sourcepoint/cmplibrary/SpConsentLibMobileCore.kt +++ b/cmplibrary/src/main/java/com/sourcepoint/cmplibrary/SpConsentLibMobileCore.kt @@ -67,7 +67,8 @@ class SpConsentLibMobileCore( private val coordinator: ICoordinator, private val connectionManager: ConnectionManager, private val spClient: SpClient, - override val dismissMessageOnBackPress: Boolean = true + override val dismissMessageOnBackPress: Boolean = true, + override var cleanUserDataOnError: Boolean = false ) : SpConsentLib, SPMessageUIClient { private var pendingActions: Int = 0 private var messagesToDisplay: ArrayDeque = ArrayDeque(emptyList()) @@ -365,6 +366,10 @@ class SpConsentLibMobileCore( pendingActions = 0 messagesToDisplay = ArrayDeque(emptyList()) + if (cleanUserDataOnError) { + clearLocalData() + } + when (error) { is NoIntentFoundForUrl -> { spClient.onNoIntentActivitiesFound(error.url ?: "")