Browse Source

Merge pull request #973 from owncloud/delete_share_option_in_app

Make share feature configurable
David A. Velasco 10 years ago
parent
commit
47343ca299
2 changed files with 6 additions and 4 deletions
  1. 1 0
      res/values/setup.xml
  2. 5 4
      src/com/owncloud/android/files/FileMenuFilter.java

+ 1 - 0
res/values/setup.xml

@@ -24,6 +24,7 @@
     
     <!-- Flags to enable/disable some features -->
     <string name = "send_files_to_other_apps">on</string>
+    <string name = "share_feature">on</string>
     
     
     <!-- Colors -->

+ 5 - 4
src/com/owncloud/android/files/FileMenuFilter.java

@@ -216,7 +216,9 @@ public class FileMenuFilter {
         
         // SHARE FILE 
         // TODO add check on SHARE available on server side?
-        if (mFile == null) {
+        boolean shareAllowed = (mContext != null  &&
+                mContext.getString(R.string.share_feature).equalsIgnoreCase("on"));
+        if (!shareAllowed || mFile == null) {
             toHide.add(R.id.action_share_file);
         } else {
             toShow.add(R.id.action_share_file);
@@ -224,13 +226,12 @@ public class FileMenuFilter {
         
         // UNSHARE FILE  
         // TODO add check on SHARE available on server side?
-        if (mFile == null || !mFile.isShareByLink()) { 
+        if ( !shareAllowed || (mFile == null || !mFile.isShareByLink())) {
             toHide.add(R.id.action_unshare_file);
         } else {
             toShow.add(R.id.action_unshare_file);
         }
-        
-        
+
         // SEE DETAILS
         if (mFile == null || mFile.isFolder()) {
             toHide.add(R.id.action_see_details);