Skip to content

Commit

Permalink
Parses extra notification avatars
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonis Lilis committed Feb 6, 2024
1 parent 3704986 commit 3dab4a4
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions WordPress/src/main/java/org/wordpress/android/models/Note.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import android.util.Base64;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import org.json.JSONArray;
import org.json.JSONException;
Expand All @@ -22,9 +23,11 @@
import org.wordpress.android.util.StringUtils;

import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.EnumSet;
import java.util.List;
import java.util.zip.DataFormatException;
import java.util.zip.Inflater;

Expand Down Expand Up @@ -215,6 +218,21 @@ public String getIconURL() {
return queryJSON("icon", "");
}

public @Nullable List<String> getIconURLs() {
synchronized (mSyncLock) {
JSONArray bodyArray = mNoteJSON.optJSONArray("body");
if (bodyArray != null && bodyArray.length() > 0) {
ArrayList<String> iconUrls = new ArrayList<>();
for (int i = 0; i < bodyArray.length(); i++) {
String iconUrl = JSONUtils.queryJSON(bodyArray, "body[" + i + "].media[0].url", "");
iconUrls.add(iconUrl);
}
return iconUrls;
}
}
return null;
}

public String getCommentSubject() {
synchronized (mSyncLock) {
JSONArray subjectArray = mNoteJSON.optJSONArray("subject");
Expand Down

0 comments on commit 3dab4a4

Please sign in to comment.