Skip to content

Commit 72ac899

Browse files
authored
Merge pull request #428 from Countly/fix_contetns
fix: support segmentation
2 parents 80cc4f1 + 930063d commit 72ac899

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Mitigated an issue where visibility could have been wrongly assigned if a view was closed while going to background. (Experimental!)
55
* Fixed a bug where passing the global content callback was not possible.
66
* Mitigated an issue related to content actions navigation.
7-
7+
* Mitigated an issue that parsing internal content event segmentation.
88
## 24.7.5
99
* ! Minor breaking change ! All active views will now automatically stop when consent for "views" is revoked.
1010

sdk/src/main/java/ly/count/android/sdk/TransparentActivity.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -287,15 +287,17 @@ private void eventAction(Map<String, Object> query) {
287287
JSONObject eventJson = event.getJSONObject(i);
288288
Log.v(Countly.TAG, "[TransparentActivity] eventAction, event JSON: [" + eventJson.toString() + "]");
289289

290-
if (!eventJson.has("sg")) {
290+
Map<String, Object> segmentation = new ConcurrentHashMap<>();
291+
JSONObject sgJson = eventJson.optJSONObject("sg");
292+
JSONObject segmentationJson = eventJson.optJSONObject("segmentation");
293+
294+
if (sgJson != null) {
295+
segmentationJson = sgJson;
296+
} else if (segmentationJson == null) {
291297
Log.w(Countly.TAG, "[TransparentActivity] eventAction, event JSON is missing segmentation data event: [" + eventJson + "]");
292298
continue;
293299
}
294300

295-
Map<String, Object> segmentation = new ConcurrentHashMap<>();
296-
JSONObject segmentationJson = eventJson.getJSONObject("sg");
297-
assert segmentationJson != null; // this is already checked above
298-
299301
for (int j = 0; j < segmentationJson.names().length(); j++) {
300302
String key = segmentationJson.names().getString(j);
301303
Object value = segmentationJson.get(key);

0 commit comments

Comments
 (0)