OAuth: ask tenant

This commit is contained in:
M66B 2022-03-24 00:19:28 +01:00
parent 632a82a870
commit 83731d082e
3 changed files with 10 additions and 2 deletions

View File

@ -1291,5 +1291,10 @@ public class EmailProvider implements Parcelable {
String privacy;
String prompt;
Map<String, String> parameters;
boolean askTenant() {
return (authorizationEndpoint.contains("{tenant}") ||
tokenEndpoint.contains("{tenant}"));
}
}
}

View File

@ -98,6 +98,7 @@ public class FragmentOAuth extends FragmentBase {
private String name;
private String privacy;
private boolean askAccount;
private boolean askTenant;
private String personal;
private String address;
@ -137,6 +138,7 @@ public class FragmentOAuth extends FragmentBase {
name = args.getString("name");
privacy = args.getString("privacy");
askAccount = args.getBoolean("askAccount", false);
askTenant = args.getBoolean("askTenant", false);
personal = args.getString("personal");
address = args.getString("address");
@ -214,7 +216,7 @@ public class FragmentOAuth extends FragmentBase {
tvTitle.setText(getString(R.string.title_setup_oauth_rationale, name));
etName.setVisibility(askAccount ? View.VISIBLE : View.GONE);
etEmail.setVisibility(askAccount ? View.VISIBLE : View.GONE);
grpTenant.setVisibility(isOutlook(id) ? View.VISIBLE : View.GONE);
grpTenant.setVisibility(askTenant ? View.VISIBLE : View.GONE);
pbOAuth.setVisibility(View.GONE);
tvConfiguring.setVisibility(View.GONE);
tvGmailHint.setVisibility("gmail".equals(id) ? View.VISIBLE : View.GONE);

View File

@ -266,7 +266,8 @@ public class FragmentSetup extends FragmentBase {
.putExtra("id", provider.id)
.putExtra("name", provider.description)
.putExtra("privacy", provider.oauth.privacy)
.putExtra("askAccount", provider.oauth.askAccount));
.putExtra("askAccount", provider.oauth.askAccount)
.putExtra("askTenant", provider.oauth.askTenant()));
resid = res.getIdentifier("provider_" + provider.id, "drawable", pkg);
if (resid != 0)
item.setIcon(resid);