Skip to content

Commit

Permalink
Merge pull request #456 from Countly/fix_after_close
Browse files Browse the repository at this point in the history
Fix after close
  • Loading branch information
turtledreams authored Jan 31, 2025
2 parents 37ec527 + 51ba51a commit 401354c
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 25.1.1
* Mitigated an issue where after closing a content, they were not being fetched again.

## 25.1.0
* Improved content size management of content blocks.

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ org.gradle.configureondemand=true
android.useAndroidX=true
android.enableJetifier=true
# RELEASE FIELD SECTION
VERSION_NAME=25.1.0
VERSION_NAME=25.1.1
GROUP=ly.count.android
POM_URL=https://github.com/Countly/countly-sdk-android
POM_SCM_URL=https://github.com/Countly/countly-sdk-android
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class TestUtils {
public final static String commonAppKey = "appkey";
public final static String commonDeviceId = "1234";
public final static String SDK_NAME = "java-native-android";
public final static String SDK_VERSION = "25.1.0";
public final static String SDK_VERSION = "25.1.1";
public static final int MAX_THREAD_COUNT_PER_STACK_TRACE = 50;

public static class Activity2 extends Activity {
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/java/ly/count/android/sdk/Countly.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ of this software and associated documentation files (the "Software"), to deal
*/
public class Countly {

private final String DEFAULT_COUNTLY_SDK_VERSION_STRING = "25.1.0";
private final String DEFAULT_COUNTLY_SDK_VERSION_STRING = "25.1.1";

/**
* Used as request meta data on every request
Expand Down
10 changes: 8 additions & 2 deletions sdk/src/main/java/ly/count/android/sdk/ModuleContent.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit 401354c

Please sign in to comment.