فهرست منبع

Enable/disable share option in the menu: long press and details menu, using setup option

masensio 10 سال پیش
والد
کامیت
05df07a362
1فایلهای تغییر یافته به همراه5 افزوده شده و 4 حذف شده
  1. 5 4
      src/com/owncloud/android/files/FileMenuFilter.java

+ 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_link).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);