From 43ceb4e576fe2a5e8d7f671fe896c2e3c42c3fce Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 3 Mar 2022 08:26:01 +0100 Subject: [PATCH] Show full client ID --- .../java/eu/faircode/email/EmailService.java | 18 ++++++++++-------- .../faircode/email/FragmentOptionsPrivacy.java | 9 ++++++++- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/EmailService.java b/app/src/main/java/eu/faircode/email/EmailService.java index 62857f81a5..4abaf80208 100644 --- a/app/src/main/java/eu/faircode/email/EmailService.java +++ b/app/src/main/java/eu/faircode/email/EmailService.java @@ -743,14 +743,7 @@ public class EmailService implements AutoCloseable { try { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); boolean client_id = prefs.getBoolean("client_id", true); - - Map id = new LinkedHashMap<>(); - id.put("name", context.getString(R.string.app_name)); - id.put("version", BuildConfig.VERSION_NAME); - id.put("os", "Android"); - id.put("os-version", Build.VERSION.RELEASE); - - Map sid = istore.id(client_id ? id : null); + Map sid = istore.id(client_id ? getId(context) : null); if (sid != null) { Map crumb = new HashMap<>(); for (String key : sid.keySet()) { @@ -804,6 +797,15 @@ public class EmailService implements AutoCloseable { throw new NoSuchProviderException(protocol); } + static Map getId(Context context) { + Map id = new LinkedHashMap<>(); + id.put("name", context.getString(R.string.app_name)); + id.put("version", BuildConfig.VERSION_NAME); + id.put("os", "Android"); + id.put("os-version", Build.VERSION.RELEASE); + return id; + } + static String getDefaultEhlo() { if (BuildConfig.APPLICATION_ID.startsWith("eu.faircode.email")) return "dummy.faircode.eu"; diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsPrivacy.java b/app/src/main/java/eu/faircode/email/FragmentOptionsPrivacy.java index d89f0696f6..f7201d3a96 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsPrivacy.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsPrivacy.java @@ -439,7 +439,14 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer // Initialize FragmentDialogTheme.setBackground(getContext(), view, false); - tvClientId.setText(getString(R.string.app_name) + " " + BuildConfig.VERSION_NAME); + + StringBuilder sb = new StringBuilder(); + for (String value : EmailService.getId(getContext()).values()) { + if (sb.length() > 0) + sb.append(' '); + sb.append(value); + } + tvClientId.setText(sb); PreferenceManager.getDefaultSharedPreferences(getContext()).registerOnSharedPreferenceChangeListener(this);