diff --git a/app/src/extra/java/eu/faircode/email/Bimi.java b/app/src/extra/java/eu/faircode/email/Bimi.java
index ac344bda8b..ffc630adf8 100644
--- a/app/src/extra/java/eu/faircode/email/Bimi.java
+++ b/app/src/extra/java/eu/faircode/email/Bimi.java
@@ -20,12 +20,15 @@ package eu.faircode.email;
*/
import android.content.Context;
+import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.net.Uri;
import android.text.TextUtils;
import android.util.Pair;
+import androidx.preference.PreferenceManager;
+
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.ASN1TaggedObject;
import org.bouncycastle.asn1.DERIA5String;
@@ -366,8 +369,13 @@ public class Bimi {
}
}
- if (bitmap != null && !verified)
+ if (bitmap != null && !verified) {
Log.i("BIMI unverified");
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
+ boolean bimi_vmc = prefs.getBoolean("bimi_vmc", false);
+ if (bimi_vmc)
+ bitmap = null;
+ }
return (bitmap == null ? null : new Pair<>(bitmap, verified));
}
diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java b/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java
index 4d8e164d2b..2a56476163 100644
--- a/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java
+++ b/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java
@@ -118,6 +118,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private TextView tvBimiHint;
private TextView tvBimiUnverified;
private SwitchCompat swBimi;
+ private SwitchCompat swBimiVmc;
private SwitchCompat swGravatars;
private TextView tvGravatarPrivacy;
private SwitchCompat swLibravatars;
@@ -216,7 +217,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
"hide_toolbar", "edge_to_edge", "nav_options", "nav_categories", "nav_last_sync", "nav_count", "nav_unseen_drafts", "nav_count_pinned", "show_unexposed",
"threading", "threading_unread", "indentation", "seekbar", "actionbar", "actionbar_swap", "actionbar_color",
"highlight_unread", "highlight_color", "color_stripe", "color_stripe_wide",
- "avatars", "bimi", "gravatars", "libravatars", "favicons", "favicons_partial", "favicons_manifest", "generated_icons", "identicons",
+ "avatars", "bimi", "bimi_vmc", "gravatars", "libravatars", "favicons", "favicons_partial", "favicons_manifest", "generated_icons", "identicons",
"circular", "saturation", "brightness", "threshold",
"email_format", "prefer_contact", "only_contact", "distinguish_contacts", "show_recipients", "reverse_addresses",
"font_size_sender", "sender_ellipsize",
@@ -293,6 +294,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swColorStripeWide = view.findViewById(R.id.swColorStripeWide);
swAvatars = view.findViewById(R.id.swAvatars);
swBimi = view.findViewById(R.id.swBimi);
+ swBimiVmc = view.findViewById(R.id.swBimiVmc);
tvBimiHint = view.findViewById(R.id.tvBimiHint);
tvBimiUnverified = view.findViewById(R.id.tvBimiUnverified);
ibBimi = view.findViewById(R.id.ibBimi);
@@ -820,6 +822,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(compoundButton.getContext());
+ }
+ });
+
+ swBimiVmc.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
+ prefs.edit().putBoolean("bimi_vmc", checked).apply();
ContactInfo.clearCache(compoundButton.getContext());
}
});
@@ -1595,6 +1606,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
//swColorStripeWide.setEnabled(swColorStripe.isChecked());
swAvatars.setChecked(prefs.getBoolean("avatars", true));
swBimi.setChecked(prefs.getBoolean("bimi", false));
+ swBimiVmc.setChecked(prefs.getBoolean("bimi_vmc", false));
+ swBimiVmc.setEnabled(swBimi.isChecked());
swGravatars.setChecked(prefs.getBoolean("gravatars", false));
swLibravatars.setChecked(prefs.getBoolean("libravatars", false));
swFavicons.setChecked(prefs.getBoolean("favicons", false));
diff --git a/app/src/main/res/layout/fragment_options_display.xml b/app/src/main/res/layout/fragment_options_display.xml
index 1010659543..0031f40dcb 100644
--- a/app/src/main/res/layout/fragment_options_display.xml
+++ b/app/src/main/res/layout/fragment_options_display.xml
@@ -927,6 +927,19 @@
app:layout_constraintTop_toBottomOf="@id/swAvatars"
app:switchPadding="12dp" />
+
+
+ app:layout_constraintTop_toBottomOf="@id/swBimiVmc" />
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 379be62dc2..7915cd380b 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -609,7 +609,8 @@
Show color stripe
Use wide color stripe
Show contact photos
- Show Brand Indicators for Message Identification (BIMI)
+ Show Brand Indicators for Message Identification (BIMI)
+ Require a valid VMC certificate
Unverified sender
Verified sender
Show Gravatars