Merge pull request #973 from owncloud/delete_share_option_in_app
authorDavid A. Velasco <dvelasco@owncloud.com>
Fri, 8 May 2015 12:55:07 +0000 (14:55 +0200)
committerDavid A. Velasco <dvelasco@owncloud.com>
Fri, 8 May 2015 12:55:07 +0000 (14:55 +0200)
Make share feature configurable

res/values/setup.xml
src/com/owncloud/android/files/FileMenuFilter.java

index 524aa2a..76bdd9f 100644 (file)
@@ -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 -->
index 04e9fbc..4b8c55d 100644 (file)
@@ -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);