mirror of https://github.com/M66B/FairEmail.git
Simplification
This commit is contained in:
parent
66b5971847
commit
d287a45d48
|
@ -3167,11 +3167,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
// Check for structured email
|
||||
if (json_ld)
|
||||
for (Element struct : document.select("script[type=application/ld+json]"))
|
||||
try {
|
||||
document.body().append(new JsonLd(struct.html()).getHtml(context));
|
||||
} catch (Throwable ex) {
|
||||
Log.w(ex);
|
||||
}
|
||||
document.body().append(new JsonLd(struct.html()).getHtml(context));
|
||||
|
||||
// Format message
|
||||
if (show_full) {
|
||||
|
|
|
@ -35,14 +35,23 @@ import java.util.Iterator;
|
|||
// https://structured.email/content/introduction/getting_started.html
|
||||
|
||||
public class JsonLd {
|
||||
private final JSONObject jroot;
|
||||
private JSONObject jroot;
|
||||
private Throwable error = null;
|
||||
|
||||
public JsonLd(String json) throws JSONException {
|
||||
jroot = new JSONObject(json);
|
||||
public JsonLd(String json) {
|
||||
try {
|
||||
jroot = new JSONObject(json);
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
error = ex;
|
||||
}
|
||||
}
|
||||
|
||||
public String getHtml(Context context) throws JSONException {
|
||||
public String getHtml(Context context) {
|
||||
try {
|
||||
if (error != null)
|
||||
throw error;
|
||||
|
||||
Document d = Document.createShell("");
|
||||
d.body().appendElement("hr");
|
||||
d.body().appendElement("div")
|
||||
|
|
Loading…
Reference in New Issue