From 01c40aa532a63b74b066f77e1dc278776045182f Mon Sep 17 00:00:00 2001
From: agarcia <agarcia@solidgeargroup.com>
Date: Tue, 23 Jun 2020 17:46:48 +0200
Subject: [PATCH] Add owner field to remote file

---
 .../lib/resources/files/ReadRemoteFolderOperation.kt     | 6 +++++-
 .../owncloud/android/lib/resources/files/RemoteFile.java | 9 +++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/ReadRemoteFolderOperation.kt b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/ReadRemoteFolderOperation.kt
index 619e7a03..f838c7e3 100644
--- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/ReadRemoteFolderOperation.kt
+++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/ReadRemoteFolderOperation.kt
@@ -70,11 +70,15 @@ class ReadRemoteFolderOperation(
                 val mFolderAndFiles = ArrayList<RemoteFile>()
 
                 // parse data from remote folder
-                mFolderAndFiles.add(RemoteFile(propfindMethod.root, AccountUtils.getUserId(mAccount, mContext)))
+                val remoteFolder = RemoteFile(propfindMethod.root, AccountUtils.getUserId(mAccount, mContext)).apply {
+                    owner = mAccount.name
+                }
+                mFolderAndFiles.add(remoteFolder)
 
                 // loop to update every child
                 propfindMethod.members.forEach { resource ->
                     val file = RemoteFile(resource, AccountUtils.getUserId(mAccount, mContext))
+                    file.owner = mAccount.name
                     mFolderAndFiles.add(file)
                 }
 
diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/RemoteFile.java b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/RemoteFile.java
index 84a48bcd..47879fc9 100644
--- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/RemoteFile.java
+++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/RemoteFile.java
@@ -91,6 +91,7 @@ public class RemoteFile implements Parcelable, Serializable {
     private String mPrivateLink;
     private boolean mSharedByLink;
     private boolean mSharedWithSharee;
+    private String mOwner;
 
     public RemoteFile() {
         resetData();
@@ -305,6 +306,14 @@ public class RemoteFile implements Parcelable, Serializable {
         return mSharedByLink;
     }
 
+    public String getOwner() {
+        return mOwner;
+    }
+
+    public void setOwner(String owner) {
+        mOwner = owner;
+    }
+
     /**
      * Used internally. Reset all file properties
      */