Skip to content

Commit

Permalink
feat(inapp) - clear stale in-apps before touching in-app response key…
Browse files Browse the repository at this point in the history
… SDK-3385
  • Loading branch information
piyush-kukadiya committed Nov 3, 2023
1 parent 436bf84 commit 223d8bf
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<Boolean, JSONArray> legacyInApps = res.legacyInApps();
if (legacyInApps.getFirst()) {
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 223d8bf

Please sign in to comment.