Add new attribute to OCFile to know if this file is shared with users/groups
authormasensio <masensio@solidgear.es>
Mon, 5 Oct 2015 13:17:39 +0000 (15:17 +0200)
committerDavid A. Velasco <dvelasco@solidgear.es>
Fri, 30 Oct 2015 14:10:41 +0000 (15:10 +0100)
src/com/owncloud/android/datamodel/OCFile.java
src/com/owncloud/android/files/FileMenuFilter.java

index fcde054..4b68986 100644 (file)
@@ -75,6 +75,7 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
     private boolean mIsDownloading;
 
     private String mEtagInConflict;    // Save file etag in the server, when there is a conflict. No conflict =  null
+    private boolean mShareWithUser;
 
 
     /**
@@ -120,6 +121,7 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
         mNeedsUpdateThumbnail = source.readInt() == 1;
         mIsDownloading = source.readInt() == 1;
         mEtagInConflict = source.readString();
+        mShareWithUser = source.readInt() == 1;
 
     }
 
@@ -146,6 +148,7 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
         dest.writeInt(mNeedsUpdateThumbnail ? 1 : 0);
         dest.writeInt(mIsDownloading ? 1 : 0);
         dest.writeString(mEtagInConflict);
+        dest.writeInt(mShareWithUser ? 1 : 0);
     }
 
     /**
@@ -344,6 +347,7 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
         mNeedsUpdateThumbnail = false;
         mIsDownloading = false;
         mEtagInConflict = null;
+        mShareWithUser = false;
     }
 
     /**
@@ -591,4 +595,12 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
     public void setEtagInConflict(String etagInConflict) {
         mEtagInConflict = etagInConflict;
     }
+
+    public boolean isShareWithUser() {
+        return mShareWithUser;
+    }
+
+    public void setShareWithUser(boolean shareWithUser) {
+        this.mShareWithUser = shareWithUser;
+    }
 }
index 6d53c99..01ca41f 100644 (file)
@@ -209,7 +209,7 @@ public class FileMenuFilter {
         }
 
         // UNSHARE FILE, with Users
-        if ( !shareAllowed || !shareWithUsersEnable || (mFile == null || !mFile.isShareByLink())) {
+        if ( !shareAllowed || !shareWithUsersEnable || (mFile == null || !mFile.isShareWithUser())) {
             toHide.add(R.id.action_unshare_with_users);
         } else {
             toShow.add(R.id.action_unshare_with_users);