Browse Source

on connection exception use host not available

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
tobiasKaminsky 6 years ago
parent
commit
072480b58d

+ 17 - 8
src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java

@@ -1411,14 +1411,23 @@ public class FileDisplayActivity extends HookActivity
                                 // TODO refactor and make common
                                 if (checkForRemoteOperationError(synchResult)) {
                                     requestCredentialsUpdate(context);
-                                } else if (RemoteOperationResult.ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED.equals(
-                                        synchResult.getCode())) {
-                                    showUntrustedCertDialog(synchResult);
-                                } else if (ResultCode.MAINTENANCE_MODE.equals(synchResult.getCode())) {
-                                    showInfoBox(R.string.maintenance_mode);
-                                } else if (ResultCode.NO_NETWORK_CONNECTION.equals(synchResult.getCode()) ||
-                                        ResultCode.HOST_NOT_AVAILABLE.equals(synchResult.getCode())) {
-                                    showInfoBox(R.string.offline_mode);
+                                } else {
+                                    switch (synchResult.getCode()) {
+                                        case SSL_RECOVERABLE_PEER_UNVERIFIED:
+                                            showUntrustedCertDialog(synchResult);
+                                            break;
+
+                                        case MAINTENANCE_MODE:
+                                            showInfoBox(R.string.maintenance_mode);
+                                            break;
+
+                                        case NO_NETWORK_CONNECTION:
+                                            showInfoBox(R.string.offline_mode);
+                                            break;
+
+                                        case HOST_NOT_AVAILABLE:
+                                            showInfoBox(R.string.host_not_available);
+                                    }
                                 }
                             }
                         }

+ 1 - 0
src/main/res/values/strings.xml

@@ -857,4 +857,5 @@
     <string name="upload_sync_conflict">Sync conflict, please resolve manually</string>
     <string name="upload_cannot_create_file">Cannot create local file</string>
     <string name="upload_local_storage_not_copied">File could not be copied to local storage</string>
+    <string name="host_not_available">Server not available</string>
 </resources>