Skip to content

Commit

Permalink
feat: irGenerator to cnfig
Browse files Browse the repository at this point in the history
  • Loading branch information
arifBurakDemiray committed Sep 25, 2023
1 parent d38cb1a commit 2fd128b
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 10 deletions.
8 changes: 6 additions & 2 deletions sdk-java/src/main/java/ly/count/sdk/java/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import ly.count.sdk.java.internal.*;
import ly.count.sdk.java.internal.Byteable;
import ly.count.sdk.java.internal.CoreFeature;
import ly.count.sdk.java.internal.Log;
import ly.count.sdk.java.internal.LogCallback;
import ly.count.sdk.java.internal.ModuleBase;
import ly.count.sdk.java.internal.Utils;

/**
* Countly configuration object.
Expand Down
8 changes: 6 additions & 2 deletions sdk-java/src/main/java/ly/count/sdk/java/Countly.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

import java.io.File;
import java.util.Map;

import ly.count.sdk.java.internal.*;
import ly.count.sdk.java.internal.CtxCore;
import ly.count.sdk.java.internal.Device;
import ly.count.sdk.java.internal.InternalConfig;
import ly.count.sdk.java.internal.Log;
import ly.count.sdk.java.internal.ModuleBackendMode;
import ly.count.sdk.java.internal.SDKCore;

/**
* Main Countly SDK API class.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package ly.count.sdk.java.internal;

public interface ImmediateRequestGenerator {
ImmediateRequestI createImmediateRequestMaker();
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package ly.count.sdk.java.internal;

interface ImmediateRequestI {
public interface ImmediateRequestI {
void doWork(String requestData, String customEndpoint, Transport cp, boolean requestShouldBeDelayed, boolean networkingIsEnabled, ImmediateRequestMaker.InternalImmediateRequestCallback callback, Log log);
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import java.util.List;
import java.util.Map;
import java.util.Set;

import ly.count.sdk.java.Config;

/**
Expand All @@ -34,6 +33,8 @@ public final class InternalConfig extends Config implements Storable {
*/
private final List<DID> dids = new ArrayList<>();

ImmediateRequestGenerator immediateRequestGenerator = null;

/**
* Shouldn't be used!
*/
Expand Down
16 changes: 12 additions & 4 deletions sdk-java/src/main/java/ly/count/sdk/java/internal/SDKCore.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
package ly.count.sdk.java.internal;

import ly.count.sdk.java.Config;
import org.json.JSONObject;

import java.util.*;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.TreeMap;
import java.util.concurrent.Future;
import ly.count.sdk.java.Config;

public class SDKCore {

Expand Down Expand Up @@ -89,6 +93,10 @@ public boolean isTracking(Integer feat) {
}

public void init(CtxCore ctx) {
InternalConfig config = ctx.getConfig();
if (config.immediateRequestGenerator == null) {
config.immediateRequestGenerator = ImmediateRequestMaker::new;
}
prepareMappings(ctx);
}

Expand Down

0 comments on commit 2fd128b

Please sign in to comment.