Explorar el Código

Disable the remote user suggestion when the capabilities does not allow federate sharing

Juan Carlos González Cabrero hace 9 años
padre
commit
7c1f8e0370

+ 5 - 1
src/com/owncloud/android/providers/UsersAndGroupsSearchProvider.java

@@ -37,6 +37,7 @@ import android.widget.Toast;
 
 import com.owncloud.android.R;
 import com.owncloud.android.authentication.AccountUtils;
+import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult;
 import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.lib.resources.shares.GetRemoteShareesOperation;
@@ -188,7 +189,10 @@ public class UsersAndGroupsSearchProvider extends ContentProvider {
         }
 
         // add a remote user suggestion if the query has the character '@'
-        if (userQuery.contains("@")) {
+        FileDataStorageManager manager = new FileDataStorageManager(account, getContext().getContentResolver());
+        boolean federatedShareAllowed = manager.getCapability(account.name).getFilesSharingFederationOutgoing().isTrue();
+
+        if (userQuery.contains("@") && federatedShareAllowed) {
             if (response == null)
                 response = new MatrixCursor(COLUMNS);
 

+ 3 - 2
src/com/owncloud/android/ui/fragment/EditShareFragment.java

@@ -147,10 +147,11 @@ public class EditShareFragment extends Fragment {
             setPermissionsListening(editShareView, false);
 
             int sharePermissions = mShare.getPermissions();
+            boolean isFederated = mShare.getShareType().equals(ShareType.FEDERATED);
             CompoundButton compound;
 
             compound = (CompoundButton) editShareView.findViewById(R.id.canShareSwitch);
-            if(mShare.getShareType().equals(ShareType.FEDERATED))
+            if(isFederated)
                 compound.setVisibility(View.INVISIBLE);
             compound.setChecked((sharePermissions & OCShare.SHARE_PERMISSION_FLAG) > 0);
 
@@ -162,7 +163,7 @@ public class EditShareFragment extends Fragment {
             boolean canEdit = (sharePermissions & anyUpdatePermission) > 0;
             compound.setChecked(canEdit);
 
-            if (mFile.isFolder()) {
+            if (mFile.isFolder() && !isFederated) {
                 compound = (CompoundButton) editShareView.findViewById(R.id.canEditCreateCheckBox);
                 compound.setChecked((sharePermissions & OCShare.CREATE_PERMISSION_FLAG) > 0);
                 compound.setVisibility(canEdit ? View.VISIBLE : View.GONE);