Эх сурвалжийг харах

Merge pull request #973 from owncloud/delete_share_option_in_app

Make share feature configurable
David A. Velasco 10 жил өмнө
parent
commit
47343ca299

+ 1 - 0
res/values/setup.xml

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

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

@@ -216,7 +216,9 @@ public class FileMenuFilter {
         
         
         // SHARE FILE 
         // SHARE FILE 
         // TODO add check on SHARE available on server side?
         // 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);
             toHide.add(R.id.action_share_file);
         } else {
         } else {
             toShow.add(R.id.action_share_file);
             toShow.add(R.id.action_share_file);
@@ -224,13 +226,12 @@ public class FileMenuFilter {
         
         
         // UNSHARE FILE  
         // UNSHARE FILE  
         // TODO add check on SHARE available on server side?
         // 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);
             toHide.add(R.id.action_unshare_file);
         } else {
         } else {
             toShow.add(R.id.action_unshare_file);
             toShow.add(R.id.action_unshare_file);
         }
         }
-        
-        
+
         // SEE DETAILS
         // SEE DETAILS
         if (mFile == null || mFile.isFolder()) {
         if (mFile == null || mFile.isFolder()) {
             toHide.add(R.id.action_see_details);
             toHide.add(R.id.action_see_details);