Просмотр исходного кода

Fix bug maintenance mode in share view

davigonz 8 лет назад
Родитель
Сommit
3ff3dcc62d

+ 12 - 9
src/main/java/com/owncloud/android/providers/UsersAndGroupsSearchProvider.java

@@ -266,15 +266,18 @@ public class UsersAndGroupsSearchProvider extends ContentProvider {
                 // the thread may die before, an exception will occur, and the message will be left on the screen
                 // until the app dies
 
-                Toast.makeText(
-                        getContext().getApplicationContext(),
-                        ErrorMessageAdapter.getErrorCauseMessage(
-                                result,
-                                null,
-                                getContext().getResources()
-                        ),
-                        Toast.LENGTH_SHORT
-                ).show();
+                // Edited: this toast message has no sense. If operation is being passed as null to getErrorCauseMessage(),
+                // the returned message is always null and therefore an empty toast is shown. Pending to review and change/delete
+
+//                Toast.makeText(
+//                        getContext().getApplicationContext(),
+//                        ErrorMessageAdapter.getErrorCauseMessage(
+//                                result,
+//                                null,
+//                                getContext().getResources()
+//                        ),
+//                        Toast.LENGTH_SHORT
+//                ).show();
             }
         });
     }

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

@@ -30,6 +30,7 @@ import com.owncloud.android.operations.CreateFolderOperation;
 import com.owncloud.android.operations.CreateShareViaLinkOperation;
 import com.owncloud.android.operations.CreateShareWithShareeOperation;
 import com.owncloud.android.operations.DownloadFileOperation;
+import com.owncloud.android.operations.GetSharesForFileOperation;
 import com.owncloud.android.operations.MoveFileOperation;
 import com.owncloud.android.operations.RemoveFileOperation;
 import com.owncloud.android.operations.RenameFileOperation;
@@ -308,6 +309,10 @@ public class ErrorMessageAdapter {
                 // Show a Message, operation finished without success
                 message = res.getString(R.string.copy_file_error);
             }
+        } else if (operation instanceof GetSharesForFileOperation) {
+            if (result.getCode() == ResultCode.MAINTENANCE_MODE) {
+                message = res.getString(R.string.maintenance_mode);
+            }
         }
 
         return message;