Skip to content

Commit 8a29e86

Browse files
committed
Remove logic for massaging concerns as it is no longer necessary
1 parent 8c04a7c commit 8a29e86

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/main/java/org/medicmobile/webapp/mobile/ChtExternalApp.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ public Optional<JSONObject> getData() {
239239
return Optional.empty();
240240
}
241241

242-
JSONObject json = parseBundleToJson(null, intent.getExtras());
242+
JSONObject json = parseBundleToJson(intent.getExtras());
243243
if (json == null) {
244244
return Optional.empty();
245245
}
@@ -249,13 +249,13 @@ public Optional<JSONObject> getData() {
249249

250250
//> PRIVATE
251251

252-
private JSONObject parseBundleToJson(String parentKey, Bundle bundle) {
252+
private JSONObject parseBundleToJson(Bundle bundle) {
253253
try {
254254
JSONObject json = new JSONObject();
255255
bundle
256256
.keySet()
257257
.iterator()
258-
.forEachRemaining(key -> setValueInJson(parentKey, key, json, bundle));
258+
.forEachRemaining(key -> setValueInJson(key, json, bundle));
259259
return json;
260260

261261
} catch (Exception exception) {
@@ -265,28 +265,26 @@ private JSONObject parseBundleToJson(String parentKey, Bundle bundle) {
265265
return null;
266266
}
267267

268-
private void setValueInJson(String parentKey, String childKey, JSONObject json, Bundle bundle) {
269-
String key = ("detectedRdt".equals(parentKey) && "concerns".equals(childKey))
270-
? "detectionConcerns"
271-
: childKey;
268+
private void setValueInJson(String key, JSONObject json, Bundle bundle) {
272269
try {
273-
Object value = bundle.get(childKey);
270+
Object value = bundle.get(key);
274271

275272
if (value instanceof Bitmap) {
276273
json.put(key, parseBitmapImageToBase64((Bitmap) value, false));
277274
return;
278275
}
279276

280277
if (value instanceof Bundle) {
281-
json.put(key, parseBundleToJson(key, (Bundle) value));
278+
json.put(key, parseBundleToJson((Bundle) value));
282279
return;
283280
}
284281

285282
if (isBundleList(value)) {
286283
JSONArray jsonArray = ((List<Bundle>) value)
287284
.stream()
288-
.map(val -> this.parseBundleToJson(key, val))
285+
.map(this::parseBundleToJson)
289286
.collect(Collector.of(JSONArray::new, JSONArray::put, JSONArray::put));
287+
290288
json.put(key, jsonArray);
291289
return;
292290
}

0 commit comments

Comments
 (0)