From 223d8bf29baf765e64165e7d3a38899e01836674 Mon Sep 17 00:00:00 2001 From: "piyush.kukadiya" Date: Fri, 3 Nov 2023 18:25:17 +0530 Subject: [PATCH] feat(inapp) - clear stale in-apps before touching in-app response key SDK-3385 --- .../clevertap/android/sdk/response/InAppResponse.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/clevertap-core/src/main/java/com/clevertap/android/sdk/response/InAppResponse.java b/clevertap-core/src/main/java/com/clevertap/android/sdk/response/InAppResponse.java index 28504cf7d..587da9b2a 100644 --- a/clevertap-core/src/main/java/com/clevertap/android/sdk/response/InAppResponse.java +++ b/clevertap-core/src/main/java/com/clevertap/android/sdk/response/InAppResponse.java @@ -5,13 +5,11 @@ import com.clevertap.android.sdk.Constants; import com.clevertap.android.sdk.ControllerManager; import com.clevertap.android.sdk.Logger; -import com.clevertap.android.sdk.Utils; import com.clevertap.android.sdk.inapp.store.preference.ImpressionStore; import com.clevertap.android.sdk.inapp.store.preference.InAppStore; import com.clevertap.android.sdk.response.data.CtResponse; import com.clevertap.android.sdk.task.CTExecutorFactory; import com.clevertap.android.sdk.task.Task; -import java.util.List; import java.util.concurrent.Callable; import kotlin.Pair; import org.json.JSONArray; @@ -89,6 +87,10 @@ public void processResponse( // from none to CS/SS to clear data. - DONE // TODO call EvaluationManager.evaluateOnAppLaunchedServerSide(appLaunchedNotifs) - DONE + JSONArray inappStaleList = response.optJSONArray("inapp_stale"); + if (inappStaleList != null) { + clearStaleInAppImpressions(inappStaleList, impressionStore); + } Pair legacyInApps = res.legacyInApps(); if (legacyInApps.getFirst()) { @@ -116,10 +118,6 @@ public void processResponse( inAppStore.setMode(inappDeliveryMode); } - JSONArray inappStaleList = response.optJSONArray("inapp_stale"); - if (inappStaleList != null) { - clearStaleInAppImpressions(inappStaleList, impressionStore); - } } catch (Throwable t) { Logger.v("InAppManager: Failed to parse response", t); }