mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-08 01:53:25 +02:00
Experiment: application/ld+json
This commit is contained in:
@@ -146,6 +146,7 @@ import androidx.webkit.WebViewFeature;
|
||||
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
||||
import org.json.JSONObject;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.nodes.Element;
|
||||
|
||||
@@ -3164,6 +3165,20 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
}
|
||||
args.putBoolean("has_amp", has_amp);
|
||||
|
||||
// Check for structured email
|
||||
// https://structured.email/content/introduction/getting_started.html
|
||||
if (BuildConfig.DEBUG)
|
||||
for (Element struct : document.select("script[type=application/ld+json]"))
|
||||
try {
|
||||
JSONObject jstruct = new JSONObject(struct.html());
|
||||
document.body()
|
||||
.appendElement("pre")
|
||||
.attr("style", "font-size: smaller !important;")
|
||||
.text(jstruct.toString(2));
|
||||
} catch (Throwable ex) {
|
||||
Log.w(ex);
|
||||
}
|
||||
|
||||
// Format message
|
||||
if (show_full) {
|
||||
if (HtmlHelper.truncate(document, HtmlHelper.MAX_FULL_TEXT_SIZE)) {
|
||||
|
||||
Reference in New Issue
Block a user