Show full client ID

This commit is contained in:
M66B 2022-03-03 08:26:01 +01:00
parent ffa613ca2c
commit 43ceb4e576
2 changed files with 18 additions and 9 deletions

View File

@ -743,14 +743,7 @@ public class EmailService implements AutoCloseable {
try {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean client_id = prefs.getBoolean("client_id", true);
Map<String, String> 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<String, String> sid = istore.id(client_id ? id : null);
Map<String, String> sid = istore.id(client_id ? getId(context) : null);
if (sid != null) {
Map<String, String> crumb = new HashMap<>();
for (String key : sid.keySet()) {
@ -804,6 +797,15 @@ public class EmailService implements AutoCloseable {
throw new NoSuchProviderException(protocol);
}
static Map<String, String> getId(Context context) {
Map<String, String> 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";

View File

@ -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);