Quellcode durchsuchen

Add configuration variables to setup and show or hide share feature on file menu

jabarros vor 9 Jahren
Ursprung
Commit
4bdea46b63
2 geänderte Dateien mit 8 neuen und 4 gelöschten Zeilen
  1. 2 1
      res/values/setup.xml
  2. 6 3
      src/com/owncloud/android/files/FileMenuFilter.java

+ 2 - 1
res/values/setup.xml

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

+ 6 - 3
src/com/owncloud/android/files/FileMenuFilter.java

@@ -181,14 +181,17 @@ public class FileMenuFilter {
         }
 
         // SHARE FILE
-        boolean shareAllowed = (mContext != null  &&
-                mContext.getString(R.string.share_feature).equalsIgnoreCase("on"));
+        boolean shareByLinkAllowed = (mContext != null  &&
+                mContext.getString(R.string.show_share_by_link_section).equalsIgnoreCase("true"));
+        boolean shareWithUsersAllowed = (mContext != null  &&
+                mContext.getString(R.string.show_share_with_users_section).equalsIgnoreCase("true"));
+
         OCCapability capability = mComponentsGetter.getStorageManager().getCapability(mAccount.name);
         boolean shareApiEnabled  = capability != null &&
                 (capability.getFilesSharingApiEnabled().isTrue() ||
                         capability.getFilesSharingApiEnabled().isUnknown()
                 );
-        if (!shareAllowed ||  mFile == null || !shareApiEnabled) {
+        if ((!shareByLinkAllowed && !shareWithUsersAllowed) ||  mFile == null || !shareApiEnabled) {
             toHide.add(R.id.action_share_file);
         } else {
             toShow.add(R.id.action_share_file);