Browse Source

Merge pull request #13081 from nextcloud/improvement/show-snackbar-message-instead-throwing-exception

Show Snackbar Message Instead Throwing Exception For Sync Folder Operations
Alper Öztürk 10 months ago
parent
commit
009bb25b22

+ 2 - 1
app/src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java

@@ -804,7 +804,8 @@ public class ReceiveExternalFilesActivity extends FileActivity
 
 
     private void startSyncFolderOperation(OCFile folder) {
     private void startSyncFolderOperation(OCFile folder) {
         if (folder == null) {
         if (folder == null) {
-            throw new IllegalArgumentException("Folder must not be null");
+            DisplayUtils.showSnackMessage(this, R.string.receive_external_files_activity_start_sync_folder_is_not_exists_message);
+            return;
         }
         }
 
 
         long currentSyncTime = System.currentTimeMillis();
         long currentSyncTime = System.currentTimeMillis();

+ 2 - 0
app/src/main/res/values/strings.xml

@@ -448,6 +448,8 @@
     <string name="clipboard_unexpected_error">Unexpected error while copying to clipboard</string>
     <string name="clipboard_unexpected_error">Unexpected error while copying to clipboard</string>
     <string name="clipboard_label">Text copied from %1$s</string>
     <string name="clipboard_label">Text copied from %1$s</string>
 
 
+    <string name="receive_external_files_activity_start_sync_folder_is_not_exists_message">Folder cannot be found, sync operation is cancelled</string>
+
     <string name="error_cant_bind_to_operations_service">Critical error: Unable to perform operations</string>
     <string name="error_cant_bind_to_operations_service">Critical error: Unable to perform operations</string>
 
 
     <string name="network_error_socket_exception">An error occurred during connection to the server</string>
     <string name="network_error_socket_exception">An error occurred during connection to the server</string>