From d2b9be32d8dd8ce61a3b99f57dc02816cce1c73a Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 15 Jul 2021 07:33:40 +0200 Subject: [PATCH] Added option to check VMC certificate --- .../main/java/eu/faircode/email/ContactInfo.java | 6 +++++- .../faircode/email/FragmentOptionsDisplay.java | 15 ++++++++++++++- .../main/res/layout/fragment_options_display.xml | 16 +++++++++++++++- app/src/main/res/values/strings.xml | 1 + 4 files changed, 35 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ContactInfo.java b/app/src/main/java/eu/faircode/email/ContactInfo.java index 4d03e233de..b16f123fdd 100644 --- a/app/src/main/java/eu/faircode/email/ContactInfo.java +++ b/app/src/main/java/eu/faircode/email/ContactInfo.java @@ -270,6 +270,7 @@ public class ContactInfo { boolean avatars = prefs.getBoolean("avatars", true); boolean gravatars = prefs.getBoolean("gravatars", false); boolean bimi = prefs.getBoolean("bimi", false); + boolean bimi_vmc = prefs.getBoolean("bimi_vmc", false); boolean favicons = prefs.getBoolean("favicons", false); boolean generated = prefs.getBoolean("generated_icons", true); boolean identicons = prefs.getBoolean("identicons", false); @@ -415,7 +416,7 @@ public class ContactInfo { Log.i("BIMI got TXT=" + bimi[0].name); Bitmap bitmap = null; - boolean verified = false; + boolean verified = !bimi_vmc; String[] params = bimi[0].name.split(";"); for (String param : params) { String[] kv = param.split("="); @@ -428,6 +429,9 @@ public class ContactInfo { break; case "l": { // Image link + if (!bimi_vmc) + continue; + String svg = kv[1].trim(); if (TextUtils.isEmpty(svg)) continue; diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java b/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java index fb6429bbea..c05775e4b1 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java @@ -88,6 +88,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer private TextView tvGravatarsHint; private SwitchCompat swGravatars; private SwitchCompat swBimi; + private SwitchCompat swBimiVmc; private ImageButton ibBimi; private SwitchCompat swFavicons; private TextView tvFaviconsHint; @@ -155,7 +156,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer "date", "date_bold", "navbar_colorize", "portrait2", "landscape", "landscape3", "threading", "threading_unread", "indentation", "seekbar", "actionbar", "actionbar_color", "highlight_unread", "highlight_color", "color_stripe", - "avatars", "gravatars", "bimi", "favicons", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold", + "avatars", "gravatars", "bimi", "bimi_vmc", "favicons", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold", "email_format", "prefer_contact", "only_contact", "distinguish_contacts", "show_recipients", "subject_top", "font_size_sender", "font_size_subject", "subject_italic", "highlight_subject", "subject_ellipsize", "keywords_header", "labels_header", "flags", "flags_background", @@ -204,6 +205,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer swGravatars = view.findViewById(R.id.swGravatars); tvGravatarsHint = view.findViewById(R.id.tvGravatarsHint); swBimi = view.findViewById(R.id.swBimi); + swBimiVmc = view.findViewById(R.id.swBimiVmc); ibBimi = view.findViewById(R.id.ibBimi); swFavicons = view.findViewById(R.id.swFavicons); tvFaviconsHint = view.findViewById(R.id.tvFaviconsHint); @@ -488,6 +490,15 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { prefs.edit().putBoolean("bimi", checked).apply(); + swBimiVmc.setEnabled(checked); + ContactInfo.clearCache(getContext()); + } + }); + + swBimiVmc.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("bimi_vmc", checked).apply(); ContactInfo.clearCache(getContext()); } }); @@ -1018,6 +1029,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer swAvatars.setChecked(prefs.getBoolean("avatars", true)); swGravatars.setChecked(prefs.getBoolean("gravatars", false)); swBimi.setChecked(prefs.getBoolean("bimi", false)); + swBimiVmc.setChecked(prefs.getBoolean("bimi_vmc", false)); + swBimiVmc.setEnabled(swBimi.isChecked()); swFavicons.setChecked(prefs.getBoolean("favicons", false)); swGeneratedIcons.setChecked(prefs.getBoolean("generated_icons", true)); swIdenticons.setChecked(prefs.getBoolean("identicons", false)); diff --git a/app/src/main/res/layout/fragment_options_display.xml b/app/src/main/res/layout/fragment_options_display.xml index f533c00e15..2ab2808e7a 100644 --- a/app/src/main/res/layout/fragment_options_display.xml +++ b/app/src/main/res/layout/fragment_options_display.xml @@ -521,14 +521,28 @@ app:layout_constraintTop_toBottomOf="@id/tvGravatarsHint" app:switchPadding="12dp" /> + + Show contact photos Show Gravatars Show Brand Indicators for Message Identification (BIMI) + Check security certificate Show favicons Show generated icons Show identicons