diff --git a/sdk/src/main/java/ly/count/android/sdk/ModuleContent.java b/sdk/src/main/java/ly/count/android/sdk/ModuleContent.java index 624c5f51..0ab7e733 100644 --- a/sdk/src/main/java/ly/count/android/sdk/ModuleContent.java +++ b/sdk/src/main/java/ly/count/android/sdk/ModuleContent.java @@ -21,11 +21,11 @@ public class ModuleContent extends ModuleBase { private boolean shouldFetchContents = false; private final int zoneTimerInterval; private final ContentCallback globalContentCallback; - static int waitForDelay = 0; + private int waitForDelay = 0; ModuleContent(@NonNull Countly cly, @NonNull CountlyConfig config) { super(cly, config); - L.v("[ModuleContent] Initialising"); + L.v("[ModuleContent] Initialising, zoneTimerInterval: [" + config.content.zoneTimerInterval + "], globalContentCallback: [" + config.content.globalContentCallback + "]"); iRGenerator = config.immediateRequestGenerator; contentInterface = new Content(); @@ -107,6 +107,12 @@ void registerForContentUpdates(@Nullable String[] categories) { }, L); } + void notifyAfterContentIsClosed() { + L.v("[ModuleContent] notifyAfterContentIsClosed, setting waitForDelay to 2 and shouldFetchContents to true"); + waitForDelay = 2; // this is indicating that we will wait 1 min after closing the content and before fetching the next one + shouldFetchContents = true; + } + @NonNull private String prepareContentFetchRequest(@NonNull DisplayMetrics displayMetrics, @NonNull String[] categories) { Resources resources = _cly.context_.getResources(); diff --git a/sdk/src/main/java/ly/count/android/sdk/TransparentActivity.java b/sdk/src/main/java/ly/count/android/sdk/TransparentActivity.java index c376c736..e3995d0a 100644 --- a/sdk/src/main/java/ly/count/android/sdk/TransparentActivity.java +++ b/sdk/src/main/java/ly/count/android/sdk/TransparentActivity.java @@ -233,7 +233,10 @@ private boolean contentUrlAction(String url, WebView view) { if (globalContentCallback != null) { // TODO: verify this later globalContentCallback.onContentCallback(ContentStatus.CLOSED, query); } - ModuleContent.waitForDelay = 2; // this is indicating that we will wait 1 min after closing the content and before fetching the next one + + if (Countly.sharedInstance().isInitialized()) { + Countly.sharedInstance().moduleContent.notifyAfterContentIsClosed(); + } finish(); }