Browse Source

Show maintenance mode message while sharing via link, unsharing, updating sharing, moving, synchronizing folders and copying operations

davigonz 8 years ago
parent
commit
ee1e47dff3
1 changed files with 22 additions and 0 deletions
  1. 22 0
      src/main/java/com/owncloud/android/utils/ErrorMessageAdapter.java

+ 22 - 0
src/main/java/com/owncloud/android/utils/ErrorMessageAdapter.java

@@ -177,6 +177,7 @@ public class ErrorMessageAdapter {
             } else {
             } else {
                 message = res.getString(R.string.create_dir_fail_msg);
                 message = res.getString(R.string.create_dir_fail_msg);
             }
             }
+
         } else if (operation instanceof CreateShareViaLinkOperation ||
         } else if (operation instanceof CreateShareViaLinkOperation ||
                 operation instanceof CreateShareWithShareeOperation) {
                 operation instanceof CreateShareWithShareeOperation) {
 
 
@@ -191,6 +192,9 @@ public class ErrorMessageAdapter {
                 message = String.format(res.getString(R.string.forbidden_permissions),
                 message = String.format(res.getString(R.string.forbidden_permissions),
                         res.getString(R.string.share_link_forbidden_permissions));
                         res.getString(R.string.share_link_forbidden_permissions));
 
 
+            } else if (result.getCode() == ResultCode.MAINTENANCE_MODE) {
+                message = res.getString(R.string.maintenance_mode);
+
             } else {    // Generic error
             } else {    // Generic error
                 // Show a Message, operation finished without success
                 // Show a Message, operation finished without success
                 message = res.getString(R.string.share_link_file_error);
                 message = res.getString(R.string.share_link_file_error);
@@ -209,6 +213,9 @@ public class ErrorMessageAdapter {
                 message = String.format(res.getString(R.string.forbidden_permissions),
                 message = String.format(res.getString(R.string.forbidden_permissions),
                         res.getString(R.string.unshare_link_forbidden_permissions));
                         res.getString(R.string.unshare_link_forbidden_permissions));
 
 
+            } else if (result.getCode() == ResultCode.MAINTENANCE_MODE) {
+                message = res.getString(R.string.maintenance_mode);
+
             } else {    // Generic error
             } else {    // Generic error
                 // Show a Message, operation finished without success
                 // Show a Message, operation finished without success
                 message = res.getString(R.string.unshare_link_file_error);
                 message = res.getString(R.string.unshare_link_file_error);
@@ -228,6 +235,9 @@ public class ErrorMessageAdapter {
                 message = String.format(res.getString(R.string.forbidden_permissions),
                 message = String.format(res.getString(R.string.forbidden_permissions),
                         res.getString(R.string.update_link_forbidden_permissions));
                         res.getString(R.string.update_link_forbidden_permissions));
 
 
+            } else if (result.getCode() == ResultCode.MAINTENANCE_MODE) {
+                message = res.getString(R.string.maintenance_mode);
+
             } else {    // Generic error
             } else {    // Generic error
                 // Show a Message, operation finished without success
                 // Show a Message, operation finished without success
                 message = res.getString(R.string.update_link_file_error);
                 message = res.getString(R.string.update_link_file_error);
@@ -250,10 +260,14 @@ public class ErrorMessageAdapter {
             } else if (result.getCode() == ResultCode.INVALID_CHARACTER_DETECT_IN_SERVER) {
             } else if (result.getCode() == ResultCode.INVALID_CHARACTER_DETECT_IN_SERVER) {
                 message = res.getString(R.string.filename_forbidden_charaters_from_server);
                 message = res.getString(R.string.filename_forbidden_charaters_from_server);
 
 
+            } else if (result.getCode() == ResultCode.MAINTENANCE_MODE) {
+                message = res.getString(R.string.maintenance_mode);
+
             } else {    // Generic error
             } else {    // Generic error
                 // Show a Message, operation finished without success
                 // Show a Message, operation finished without success
                 message = res.getString(R.string.move_file_error);
                 message = res.getString(R.string.move_file_error);
             }
             }
+
         } else if (operation instanceof SynchronizeFolderOperation) {
         } else if (operation instanceof SynchronizeFolderOperation) {
 
 
             if (!result.isSuccess()) {
             if (!result.isSuccess()) {
@@ -263,15 +277,20 @@ public class ErrorMessageAdapter {
                     message = String.format(res.getString(R.string.sync_current_folder_was_removed),
                     message = String.format(res.getString(R.string.sync_current_folder_was_removed),
                             folderPathName);
                             folderPathName);
 
 
+                } else if (result.getCode() == ResultCode.MAINTENANCE_MODE) {
+                    message = res.getString(R.string.maintenance_mode);
+
                 } else {    // Generic error
                 } else {    // Generic error
                     // Show a Message, operation finished without success
                     // Show a Message, operation finished without success
                     message = String.format(res.getString(R.string.sync_folder_failed_content),
                     message = String.format(res.getString(R.string.sync_folder_failed_content),
                             folderPathName);
                             folderPathName);
                 }
                 }
             }
             }
+
         } else if (operation instanceof CopyFileOperation) {
         } else if (operation instanceof CopyFileOperation) {
             if (result.getCode() == ResultCode.FILE_NOT_FOUND) {
             if (result.getCode() == ResultCode.FILE_NOT_FOUND) {
                 message = res.getString(R.string.copy_file_not_found);
                 message = res.getString(R.string.copy_file_not_found);
+
             } else if (result.getCode() == ResultCode.INVALID_COPY_INTO_DESCENDANT) {
             } else if (result.getCode() == ResultCode.INVALID_COPY_INTO_DESCENDANT) {
                 message = res.getString(R.string.copy_file_invalid_into_descendent);
                 message = res.getString(R.string.copy_file_invalid_into_descendent);
 
 
@@ -281,6 +300,9 @@ public class ErrorMessageAdapter {
             } else if (result.getCode() == ResultCode.FORBIDDEN) {
             } else if (result.getCode() == ResultCode.FORBIDDEN) {
                 message = String.format(res.getString(R.string.forbidden_permissions),
                 message = String.format(res.getString(R.string.forbidden_permissions),
                         res.getString(R.string.forbidden_permissions_copy));
                         res.getString(R.string.forbidden_permissions_copy));
+                
+            } else if (result.getCode() == ResultCode.MAINTENANCE_MODE) {
+                message = res.getString(R.string.maintenance_mode);
 
 
             } else {    // Generic error
             } else {    // Generic error
                 // Show a Message, operation finished without success
                 // Show a Message, operation finished without success