Browse Source

Deprecate OwncloudClient - Comments

Signed-off-by: ZetaTom <70907959+ZetaTom@users.noreply.github.com>
ZetaTom 1 year ago
parent
commit
c1d2d8af13

+ 4 - 4
app/src/main/java/com/owncloud/android/operations/CommentFileOperation.java

@@ -7,7 +7,7 @@
  */
 package com.owncloud.android.operations;
 
-import com.owncloud.android.lib.common.OwnCloudClient;
+import com.nextcloud.common.NextcloudClient;
 import com.owncloud.android.lib.common.operations.RemoteOperation;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult;
 import com.owncloud.android.lib.common.utils.Log_OC;
@@ -16,7 +16,7 @@ import com.owncloud.android.lib.resources.comments.CommentFileRemoteOperation;
 /**
  * Comment file
  */
-public class CommentFileOperation extends RemoteOperation {
+public class CommentFileOperation extends RemoteOperation<Void> {
 
     private final String message;
     private final long fileId;
@@ -37,8 +37,8 @@ public class CommentFileOperation extends RemoteOperation {
      * @param client Client object to communicate with the remote ownCloud server.
      */
     @Override
-    protected RemoteOperationResult run(OwnCloudClient client) {
-        RemoteOperationResult result = new CommentFileRemoteOperation(message, fileId).execute(client);
+    public RemoteOperationResult<Void> run(NextcloudClient client) {
+        RemoteOperationResult<Void> result = new CommentFileRemoteOperation(message, fileId).execute(client);
 
         if (!result.isSuccess()) {
             Log_OC.e(this, "File with Id " + fileId + " could not be commented");

+ 5 - 5
app/src/main/java/com/owncloud/android/ui/fragment/FileDetailActivitiesFragment.java

@@ -183,8 +183,8 @@ public class FileDetailActivitiesFragment extends Fragment implements
 
         String trimmedComment = commentField.toString().trim();
 
-        if (trimmedComment.length() > 0 && ownCloudClient != null && isDataFetched) {
-            new SubmitCommentTask(trimmedComment, file.getLocalId(), callback, ownCloudClient).execute();
+        if (!trimmedComment.isEmpty() && nextcloudClient != null && isDataFetched) {
+            new SubmitCommentTask(trimmedComment, file.getLocalId(), callback, nextcloudClient).execute();
         }
     }
 
@@ -461,12 +461,12 @@ public class FileDetailActivitiesFragment extends Fragment implements
         private final String message;
         private final long fileId;
         private final VersionListInterface.CommentCallback callback;
-        private final OwnCloudClient client;
+        private final NextcloudClient client;
 
         private SubmitCommentTask(String message,
                                   long fileId,
                                   VersionListInterface.CommentCallback callback,
-                                  OwnCloudClient client) {
+                                  NextcloudClient client) {
             this.message = message;
             this.fileId = fileId;
             this.callback = callback;
@@ -477,7 +477,7 @@ public class FileDetailActivitiesFragment extends Fragment implements
         protected Boolean doInBackground(Void... voids) {
             CommentFileOperation commentFileOperation = new CommentFileOperation(message, fileId);
 
-            RemoteOperationResult result = commentFileOperation.execute(client);
+            RemoteOperationResult<Void> result = commentFileOperation.execute(client);
 
             return result.isSuccess();
         }