From 37ffe556806a6fcdb563f6a564e450d9e826121f Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 17 Sep 2022 12:33:35 +0200 Subject: [PATCH] Debug encrypted message structure --- .../eu/faircode/email/FragmentMessages.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index ed295882c0..c2d4b73755 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -8168,8 +8168,17 @@ public class FragmentMessages extends FragmentBase String protect_subject = parts.getProtectedSubject(); // Write decrypted body + boolean debug = prefs.getBoolean("debug", false); boolean download_plain = prefs.getBoolean("download_plain", false); String html = parts.getHtml(context, download_plain); + + if (html == null && (debug || BuildConfig.DEBUG)) { + int textColorLink = Helper.resolveColor(context, android.R.attr.textColorLink); + SpannableStringBuilder ssb = new SpannableStringBuilderEx(); + MessageHelper.getStructure(imessage, ssb, 0, textColorLink); + html = HtmlHelper.toHtml(ssb, context); + } + Helper.writeText(message.getFile(context), html); Log.i("pgp html=" + (html == null ? null : html.length())); @@ -8863,8 +8872,17 @@ public class FragmentMessages extends FragmentBase // Write decrypted body SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); + boolean debug = prefs.getBoolean("debug", false); boolean download_plain = prefs.getBoolean("download_plain", false); String html = parts.getHtml(context, download_plain); + + if (html == null && (debug || BuildConfig.DEBUG)) { + int textColorLink = Helper.resolveColor(context, android.R.attr.textColorLink); + SpannableStringBuilder ssb = new SpannableStringBuilderEx(); + MessageHelper.getStructure(imessage, ssb, 0, textColorLink); + html = HtmlHelper.toHtml(ssb, context); + } + Helper.writeText(message.getFile(context), html); Log.i("s/mime html=" + (html == null ? null : html.length()));