1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-27 10:17:18 +00:00

Office365 has outlook.com addresses

This commit is contained in:
M66B 2020-11-19 13:15:55 +01:00
parent 43e975ab7f
commit 58d2bbee62
2 changed files with 23 additions and 9 deletions

View file

@ -98,6 +98,7 @@ public class FragmentOAuth extends FragmentBase {
private TextView tvError;
private TextView tvGmailDraftsHint;
private TextView tvOfficeAuthHint;
private TextView tvOfficeOutlookHint;
private Button btnSupport;
private Group grpError;
@ -133,6 +134,7 @@ public class FragmentOAuth extends FragmentBase {
tvError = view.findViewById(R.id.tvError);
tvGmailDraftsHint = view.findViewById(R.id.tvGmailDraftsHint);
tvOfficeAuthHint = view.findViewById(R.id.tvOfficeAuthHint);
tvOfficeOutlookHint = view.findViewById(R.id.tvOfficeOutlookHint);
btnSupport = view.findViewById(R.id.btnSupport);
grpError = view.findViewById(R.id.grpError);
@ -225,13 +227,6 @@ public class FragmentOAuth extends FragmentBase {
throw new IllegalArgumentException(getString(R.string.title_no_email));
if (!Helper.EMAIL_ADDRESS.matcher(email).matches())
throw new IllegalArgumentException(getString(R.string.title_email_invalid, email));
String e = email.toLowerCase();
if (e.contains("@outlook") ||
e.contains("@live") ||
e.contains("@hotmail") ||
e.contains("@msn"))
throw new IllegalArgumentException(getString(R.string.title_setup_office_remark));
}
etName.setEnabled(false);
@ -640,8 +635,15 @@ public class FragmentOAuth extends FragmentBase {
tvGmailDraftsHint.setVisibility(View.VISIBLE);
if ("office365".equals(id) &&
ex instanceof AuthenticationFailedException)
ex instanceof AuthenticationFailedException) {
tvOfficeAuthHint.setVisibility(View.VISIBLE);
String e = etEmail.getText().toString().toLowerCase();
if (e.contains("@outlook") ||
e.contains("@live") ||
e.contains("@hotmail") ||
e.contains("@msn"))
tvOfficeOutlookHint.setVisibility(View.VISIBLE);
}
etName.setEnabled(true);
etEmail.setEnabled(true);
@ -660,5 +662,6 @@ public class FragmentOAuth extends FragmentBase {
grpError.setVisibility(View.GONE);
tvGmailDraftsHint.setVisibility(View.GONE);
tvOfficeAuthHint.setVisibility(View.GONE);
tvOfficeOutlookHint.setVisibility(View.GONE);
}
}

View file

@ -139,6 +139,17 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvGmailDraftsHint" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvOfficeOutlookHint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_setup_office_remark"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="italic"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvOfficeAuthHint" />
<Button
android:id="@+id/btnSupport"
android:layout_width="wrap_content"
@ -149,7 +160,7 @@
android:textColor="?attr/colorInfoForeground"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvOfficeAuthHint" />
app:layout_constraintTop_toBottomOf="@id/tvOfficeOutlookHint" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpError"