Use username for account name

This commit is contained in:
M66B 2020-07-14 08:29:52 +02:00
parent 82c9d82396
commit 88433c9c38
3 changed files with 12 additions and 3 deletions

View File

@ -341,6 +341,9 @@ public class FragmentGmail extends FragmentBase {
if (TextUtils.isEmpty(password))
throw new IllegalArgumentException(context.getString(R.string.title_no_password));
int at = user.indexOf('@');
String username = user.substring(0, at);
EmailProvider provider = EmailProvider.fromDomain(context, "gmail.com", EmailProvider.Discover.ALL);
List<EntityFolder> folders;
@ -388,7 +391,7 @@ public class FragmentGmail extends FragmentBase {
account.user = user;
account.password = password;
account.name = provider.name;
account.name = provider.name + "/" + username;
account.synchronize = true;
account.primary = (primary == null);

View File

@ -446,10 +446,16 @@ public class FragmentOAuth extends FragmentBase {
if (TextUtils.isEmpty(primaryEmail) || identities.size() == 0)
throw new IllegalArgumentException("Primary email address not found");
if (!Helper.EMAIL_ADDRESS.matcher(primaryEmail).matches())
throw new IllegalArgumentException(context.getString(R.string.title_email_invalid, primaryEmail));
Log.i("OAuth email=" + primaryEmail);
for (Pair<String, String> identity : identities)
Log.i("OAuth identity=" + identity.first + "/" + identity.second);
int at = primaryEmail.indexOf('@');
String username = primaryEmail.substring(0, at);
List<EntityFolder> folders;
Log.i("OAuth checking IMAP provider=" + provider.id);
@ -499,7 +505,7 @@ public class FragmentOAuth extends FragmentBase {
account.user = primaryEmail;
account.password = state;
account.name = provider.name;
account.name = provider.name + "/" + username;
account.synchronize = true;
account.primary = (primary == null);

View File

@ -372,7 +372,7 @@ public class FragmentQuickSetup extends FragmentBase {
account.password = password;
account.fingerprint = imap_fingerprint;
account.name = provider.name;
account.name = provider.name + "/" + username;
account.synchronize = true;
account.primary = (primary == null);