diff --git a/app/src/main/java/eu/faircode/email/EmailProvider.java b/app/src/main/java/eu/faircode/email/EmailProvider.java index 2bb00010bf..cc4a1fedff 100644 --- a/app/src/main/java/eu/faircode/email/EmailProvider.java +++ b/app/src/main/java/eu/faircode/email/EmailProvider.java @@ -77,6 +77,7 @@ public class EmailProvider implements Parcelable { public String id; public String name; public String description; + public boolean debug; public boolean enabled; public List domain; public List mx; @@ -228,11 +229,8 @@ public class EmailProvider implements Parcelable { if (provider.description == null) provider.description = provider.name; - String enabled = xml.getAttributeValue(null, "enabled"); - if ("debug".equals(enabled)) - provider.enabled = BuildConfig.DEBUG; - else - provider.enabled = getAttributeBooleanValue(xml, "enabled", true); + provider.debug = getAttributeBooleanValue(xml, "debug", false); + provider.enabled = getAttributeBooleanValue(xml, "enabled", true); String domain = xml.getAttributeValue(null, "domain"); if (domain != null) @@ -352,10 +350,15 @@ public class EmailProvider implements Parcelable { return null; } + // For user interface static List getProviders(Context context) { + return getProviders(context, false); + } + + static List getProviders(Context context, boolean debug) { List result = new ArrayList<>(); for (EmailProvider provider : loadProfiles(context)) - if (provider.enabled) + if (provider.enabled || (provider.debug && debug)) result.add(provider); return result; } diff --git a/app/src/main/java/eu/faircode/email/FragmentSetup.java b/app/src/main/java/eu/faircode/email/FragmentSetup.java index 79399a8796..18ae917e8f 100644 --- a/app/src/main/java/eu/faircode/email/FragmentSetup.java +++ b/app/src/main/java/eu/faircode/email/FragmentSetup.java @@ -282,12 +282,16 @@ public class FragmentSetup extends FragmentBase implements SharedPreferences.OnS @Override public void onClick(View v) { final Context context = getContext(); + + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); + boolean debug = (prefs.getBoolean("debug", false) || BuildConfig.DEBUG); + PopupMenuLifecycle popupMenu = new PopupMenuLifecycle(context, getViewLifecycleOwner(), btnQuick); Menu menu = popupMenu.getMenu(); Resources res = context.getResources(); String pkg = context.getPackageName(); - List providers = EmailProvider.getProviders(context); + List providers = EmailProvider.getProviders(context, debug); int order = 1; diff --git a/app/src/main/res/xml/providers.xml b/app/src/main/res/xml/providers.xml index 22b1695ed1..4523c5646e 100644 --- a/app/src/main/res/xml/providers.xml +++ b/app/src/main/res/xml/providers.xml @@ -187,8 +187,9 @@