From 5fc5f23bc7d845c8956167842f577463b29eda68 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 24 Jan 2020 11:57:11 +0100 Subject: [PATCH] OAuth ask account precedence --- app/src/main/java/eu/faircode/email/FragmentOAuth.java | 9 ++++----- app/src/main/res/xml/providers.xml | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentOAuth.java b/app/src/main/java/eu/faircode/email/FragmentOAuth.java index 8a69099f43..7a53989aeb 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOAuth.java +++ b/app/src/main/java/eu/faircode/email/FragmentOAuth.java @@ -376,7 +376,10 @@ public class FragmentOAuth extends FragmentBase { String primaryEmail = null; List> identities = new ArrayList<>(); - if ("gmail".equals(id)) { + if (askAccount) { + primaryEmail = address; + identities.add(new Pair<>(address, personal)); + } else if ("gmail".equals(id)) { // https://developers.google.com/gmail/api/v1/reference/users/getProfile URL url = new URL("https://www.googleapis.com/gmail/v1/users/me/settings/sendAs"); Log.i("Fetching " + url); @@ -414,7 +417,6 @@ public class FragmentOAuth extends FragmentBase { } } } - } else if ("outlook".equals(id)) { // https://docs.microsoft.com/en-us/graph/api/user-get?view=graph-rest-1.0&tabs=http#http-request URL url = new URL("https://graph.microsoft.com/v1.0/me?$select=displayName,otherMails"); @@ -451,9 +453,6 @@ public class FragmentOAuth extends FragmentBase { identities.add(new Pair<>(email, displayName)); } } - } else if (askAccount) { - primaryEmail = address; - identities.add(new Pair<>(address, personal)); } else throw new IllegalArgumentException("Unknown provider=" + id); diff --git a/app/src/main/res/xml/providers.xml b/app/src/main/res/xml/providers.xml index 798e3e4001..3d146db901 100644 --- a/app/src/main/res/xml/providers.xml +++ b/app/src/main/res/xml/providers.xml @@ -34,6 +34,7 @@ port="587" starttls="true" />