Skip to content

Commit

Permalink
Add trackImpressions to Split DTO
Browse files Browse the repository at this point in the history
  • Loading branch information
gthea committed Dec 11, 2024
1 parent 4c3b592 commit a5015f7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/main/java/io/split/android/client/dtos/Split.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,7 @@ public class Split {
@Nullable
@SerializedName("sets")
public Set<String> sets;

@SerializedName("trackImpressions")
public boolean trackImpressions = true;
}
15 changes: 12 additions & 3 deletions src/main/java/io/split/android/engine/experiments/ParsedSplit.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class ParsedSplit {
private final int mAlgo;
private final Map<String, String> mConfigurations;
private final Set<String> mSets;
private final boolean mTrackImpressions;

public ParsedSplit(
String feature,
Expand All @@ -36,7 +37,8 @@ public ParsedSplit(
int trafficAllocationSeed,
int algo,
Map<String, String> configurations,
Set<String> sets
Set<String> sets,
boolean trackImpressions
) {
mSplit = feature;
mSeed = seed;
Expand All @@ -47,6 +49,7 @@ public ParsedSplit(
mChangeNumber = changeNumber;
mAlgo = algo;
mConfigurations = configurations;
mTrackImpressions = trackImpressions;

if (mDefaultTreatment == null) {
throw new IllegalArgumentException("DefaultTreatment is null");
Expand Down Expand Up @@ -104,6 +107,10 @@ public Set<String> sets() {
return mSets;
}

public boolean trackImpression() {
return mTrackImpressions;
}

@Override
public int hashCode() {
int result = 17;
Expand All @@ -116,6 +123,7 @@ public int hashCode() {
result = 31 * result + (int) (mChangeNumber ^ (mChangeNumber >>> 32));
result = 31 * result + (mAlgo ^ (mAlgo >>> 32));
result = 31 * result + ((mSets != null) ? mSets.hashCode() : 0);
result = 31 * result + (mTrackImpressions ? 1 : 0);
return result;
}

Expand All @@ -135,7 +143,8 @@ public boolean equals(Object obj) {
&& mChangeNumber == other.mChangeNumber
&& mAlgo == other.mAlgo
&& (Objects.equals(mConfigurations, other.mConfigurations))
&& (Objects.equals(mSets, other.mSets));
&& (Objects.equals(mSets, other.mSets)
&& mTrackImpressions == other.mTrackImpressions);

}

Expand All @@ -146,7 +155,7 @@ public String toString() {
", default treatment:" + mDefaultTreatment +
", parsedConditions:" + mParsedCondition +
", trafficTypeName:" + mTrafficTypeName + ", changeNumber:" + mChangeNumber +
", algo:" + mAlgo + ", config:" + mConfigurations + ", sets:" + mSets;
", algo:" + mAlgo + ", config:" + mConfigurations + ", sets:" + mSets + ", trackImpression:" + mTrackImpressions;

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ private ParsedSplit parseWithoutExceptionHandling(Split split, String matchingKe
split.trafficAllocationSeed,
split.algo,
split.configurations,
split.sets);
split.sets,
split.trackImpressions);
}

private CombiningMatcher toMatcher(MatcherGroup matcherGroup, String matchingKey) throws UnsupportedMatcherException {
Expand Down

0 comments on commit a5015f7

Please sign in to comment.