Skip to content

Commit

Permalink
Adjust flushAt and flushInterval values
Browse files Browse the repository at this point in the history
  • Loading branch information
mahmoud-elmorabea committed Oct 15, 2024
1 parent 8f5d2ac commit 2cad68b
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ private static class Keys {
static final String SITE_ID = "cio_sdk_site_id";
static final String API_HOST = "cio_sdk_api_host";
static final String CDN_HOST = "cio_sdk_cdn_host";
static final String FLUSH_INTERVAL = "cio_sdk_flush_interval";
static final String FLUSH_AT = "cio_sdk_flush_at";
static final String TRACK_SCREENS = "cio_sdk_track_screens";
static final String TRACK_DEVICE_ATTRIBUTES = "cio_sdk_track_device_attributes";
static final String LOG_LEVEL = "cio_sdk_log_level";
Expand All @@ -40,8 +38,6 @@ public static CustomerIOSDKConfig getDefaultConfigurations() {
BuildConfig.SITE_ID,
RegionExtKt.apiHost(Region.US.INSTANCE),
RegionExtKt.cdnHost(Region.US.INSTANCE),
30,
20,
true,
true,
CioLogLevel.DEBUG,
Expand All @@ -62,8 +58,6 @@ public static Optional<CustomerIOSDKConfig> fromMap(@NonNull Map<String, String>
CustomerIOSDKConfig defaultConfig = getDefaultConfigurations();
String apiHost = bundle.get(Keys.API_HOST);
String cdnHost = bundle.get(Keys.CDN_HOST);
Integer flushInterval = StringUtils.parseInteger(bundle.get(Keys.FLUSH_INTERVAL), defaultConfig.flushInterval);
Integer flushAt = StringUtils.parseInteger(bundle.get(Keys.FLUSH_AT), defaultConfig.flushAt);
boolean screenTrackingEnabled = StringUtils.parseBoolean(bundle.get(Keys.TRACK_SCREENS), defaultConfig.screenTrackingEnabled);
boolean deviceAttributesTrackingEnabled = StringUtils.parseBoolean(bundle.get(Keys.TRACK_DEVICE_ATTRIBUTES), defaultConfig.deviceAttributesTrackingEnabled);
CioLogLevel logLevel = CioLogLevel.Companion.getLogLevel(bundle.get(Keys.LOG_LEVEL), CioLogLevel.DEBUG);
Expand All @@ -76,8 +70,6 @@ public static Optional<CustomerIOSDKConfig> fromMap(@NonNull Map<String, String>
siteId,
apiHost,
cdnHost,
flushInterval,
flushAt,
screenTrackingEnabled,
deviceAttributesTrackingEnabled,
logLevel,
Expand All @@ -95,8 +87,6 @@ public static Map<String, String> toMap(@NonNull CustomerIOSDKConfig config) {
bundle.put(Keys.SITE_ID, config.siteId);
bundle.put(Keys.API_HOST, config.apiHost);
bundle.put(Keys.CDN_HOST, config.cdnHost);
bundle.put(Keys.FLUSH_INTERVAL, StringUtils.fromInteger(config.flushInterval));
bundle.put(Keys.FLUSH_AT, StringUtils.fromInteger(config.flushAt));
bundle.put(Keys.TRACK_SCREENS, StringUtils.fromBoolean(config.screenTrackingEnabled));
bundle.put(Keys.TRACK_DEVICE_ATTRIBUTES, StringUtils.fromBoolean(config.deviceAttributesTrackingEnabled));
bundle.put(Keys.LOG_LEVEL, config.logLevel.name());
Expand All @@ -115,10 +105,6 @@ public static Map<String, String> toMap(@NonNull CustomerIOSDKConfig config) {
private final String apiHost;
@Nullable
private final String cdnHost;
@Nullable
private final Integer flushInterval;
@Nullable
private final Integer flushAt;
private final boolean screenTrackingEnabled;
private final boolean deviceAttributesTrackingEnabled;
@NonNull
Expand All @@ -133,8 +119,6 @@ public CustomerIOSDKConfig(@NonNull String cdpApiKey,
@NonNull String siteId,
@Nullable String apiHost,
@Nullable String cdnHost,
@Nullable Integer flushInterval,
@Nullable Integer flushAt,
boolean screenTrackingEnabled,
boolean deviceAttributesTrackingEnabled,
@NonNull CioLogLevel logLevel,
Expand All @@ -146,8 +130,6 @@ public CustomerIOSDKConfig(@NonNull String cdpApiKey,
this.siteId = siteId;
this.apiHost = apiHost;
this.cdnHost = cdnHost;
this.flushInterval = flushInterval;
this.flushAt = flushAt;
this.screenTrackingEnabled = screenTrackingEnabled;
this.deviceAttributesTrackingEnabled = deviceAttributesTrackingEnabled;
this.logLevel = logLevel;
Expand Down Expand Up @@ -177,16 +159,6 @@ public String getCdnHost() {
return cdnHost;
}

@Nullable
public Integer getFlushInterval() {
return flushInterval;
}

@Nullable
public Integer getFlushAt() {
return flushAt;
}

public boolean isScreenTrackingEnabled() {
return screenTrackingEnabled;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,7 @@ private void configureSdk(CustomerIOBuilder builder, final CustomerIOSDKConfig s
}

if (sdkConfig.isTestModeEnabled()) {
builder.flushInterval(1);
builder.flushAt(1);
} else {
if (sdkConfig.getFlushAt() != null) {
builder.flushAt(sdkConfig.getFlushAt());
}
if (sdkConfig.getFlushInterval() != null) {
builder.flushInterval(sdkConfig.getFlushInterval());
}
}

builder.autoTrackActivityScreens(sdkConfig.isScreenTrackingEnabled());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,6 @@ private static CustomerIOSDKConfig createNewSettings(CustomerIOSDKConfig current
currentSettings.getSiteId(),
apiHost,
cdnHost,
currentSettings.getFlushInterval(),
currentSettings.getFlushAt(),
currentSettings.isScreenTrackingEnabled(),
currentSettings.isDeviceAttributesTrackingEnabled(),
currentSettings.getLogLevel(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,6 @@ private CustomerIOSDKConfig createNewSettings(String cdpApiKey, String siteId, C
siteId,
currentSettings.getApiHost(),
currentSettings.getCdnHost(),
currentSettings.getFlushInterval(),
currentSettings.getFlushAt(),
featTrackScreens,
featTrackDeviceAttributes,
logLevel,
Expand Down

0 comments on commit 2cad68b

Please sign in to comment.