소스 검색

Merge pull request #3574 from nextcloud/serverUnavailable

Server unavailable
Andy Scherzinger 6 년 전
부모
커밋
db96ceec25
2개의 변경된 파일23개의 추가작업 그리고 9개의 파일을 삭제
  1. 22 8
      src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java
  2. 1 1
      src/main/res/values/strings.xml

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

@@ -1411,14 +1411,28 @@ 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);
+                                            break;
+
+                                        default:
+                                            // nothing to do
+                                            break;
+                                    }
                                 }
                             }
                         }

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

@@ -826,7 +826,6 @@
     <string name="no_pdf_app_available">No App available to handle PDF</string>
     <string name="share_via_link_hide_download">Hide download</string>
     <string name="unread_comments">Unread comments exist</string>
-
     <string name="richdocuments_failed_to_load_document">Failed to load document!</string>
     <string name="create_new_document">Create new document</string>
     <string name="create_new_spreadsheet">Create new spreadsheet</string>
@@ -854,5 +853,6 @@
     <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>
     <string name="delete_entries">Delete entries</string>
 </resources>