1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-29 11:15:51 +00:00

OAuth improvements

This commit is contained in:
M66B 2020-01-09 17:53:00 +01:00
parent 73e5fa3b89
commit 25aaae6960

View file

@ -253,9 +253,15 @@ public class FragmentOAuth extends FragmentBase {
prefs.edit().putString("oauth." + provider.id, authState.jsonSerializeString()).apply();
Map<String, String> params = new HashMap<>();
if ("gmail".equals(provider.id))
params.put("access_type", "offline");
if ("yandex".equals(provider.id)) {
params.put("device_name", "Android/FairEmail");
params.put("force_confirm", "true");
}
AuthorizationRequest.Builder authRequestBuilder =
new AuthorizationRequest.Builder(
serviceConfig,
@ -352,6 +358,7 @@ public class FragmentOAuth extends FragmentBase {
args.putString("name", name);
args.putString("token", accessToken);
args.putString("state", state.jsonSerializeString());
args.putBoolean("askAccount", askAccount);
args.putString("personal", etName.getText().toString().trim());
args.putString("address", etEmail.getText().toString().trim());
@ -362,6 +369,7 @@ public class FragmentOAuth extends FragmentBase {
String name = args.getString("name");
String token = args.getString("token");
String state = args.getString("state");
boolean askAccount = args.getBoolean("askAccount", false);
String personal = args.getString("personal");
String address = args.getString("address");
@ -443,7 +451,7 @@ public class FragmentOAuth extends FragmentBase {
identities.add(new Pair<>(email, displayName));
}
}
} else if ("yandex".equals(id)) {
} else if (askAccount) {
primaryEmail = address;
identities.add(new Pair<>(address, personal));
} else