show no internet error in edit account

Daniel Gultsch created

Change summary

src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java | 21 +
1 file changed, 11 insertions(+), 10 deletions(-)

Detailed changes

src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java 🔗

@@ -1045,11 +1045,7 @@ public class EditAccountActivity extends OmemoActivity
     }
 
     private void deleteAccount() {
-        this.deleteAccount(
-                mAccount,
-                () -> {
-                    finish();
-                });
+        this.deleteAccount(mAccount, () -> finish());
     }
 
     private boolean inNeedOfSaslAccept() {
@@ -1393,7 +1389,7 @@ public class EditAccountActivity extends OmemoActivity
             if (hasKeys
                     && Config.supportOmemo()) { // TODO: either the button should be visible if we
                 // print an active device or the device list should
-                // be fed with reactived devices
+                // be fed with reactivated devices
                 this.binding.otherDeviceKeysCard.setVisibility(View.VISIBLE);
                 Set<Integer> otherDevices = mAccount.getAxolotlService().getOwnDeviceIds();
                 if (otherDevices == null || otherDevices.isEmpty()) {
@@ -1409,12 +1405,17 @@ public class EditAccountActivity extends OmemoActivity
             }
         } else {
             final TextInputLayout errorLayout;
-            if (this.mAccount.errorStatus()) {
-                if (this.mAccount.getStatus() == Account.State.UNAUTHORIZED
-                        || this.mAccount.getStatus() == Account.State.DOWNGRADE_ATTACK) {
+            final var status = this.mAccount.getStatus();
+            if (status.isError()
+                    || Arrays.asList(
+                                    Account.State.NO_INTERNET,
+                                    Account.State.MISSING_INTERNET_PERMISSION)
+                            .contains(status)) {
+                if (status == Account.State.UNAUTHORIZED
+                        || status == Account.State.DOWNGRADE_ATTACK) {
                     errorLayout = this.binding.accountPasswordLayout;
                 } else if (mShowOptions
-                        && this.mAccount.getStatus() == Account.State.SERVER_NOT_FOUND
+                        && status == Account.State.SERVER_NOT_FOUND
                         && this.binding.hostname.getText().length() > 0) {
                     errorLayout = this.binding.hostnameLayout;
                 } else {