return serverVersion;\r
}\r
\r
+ public static boolean hasSearchUsersSupport(Account account){\r
+ OwnCloudVersion serverVersion = null;\r
+ if (account != null) {\r
+ AccountManager accountMgr = AccountManager.get(MainApp.getAppContext());\r
+ String serverVersionStr = accountMgr.getUserData(account, Constants.KEY_OC_VERSION);\r
+ if (serverVersionStr != null) {\r
+ serverVersion = new OwnCloudVersion(serverVersionStr);\r
+ }\r
+ }\r
+ return (serverVersion != null ? serverVersion.isSearchUsersSupported() : false);\r
+ }\r
}\r
import android.view.MenuItem;
import com.owncloud.android.R;
+import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.files.services.FileDownloader;
import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder;
* {@link FileUploader} and {@link FileDownloader} services
* @param context Android {@link Context}, needed to access build setup resources.
*/
- public FileMenuFilter(OCFile targetFile, Account account, ComponentsGetter cg, Context context) {
+ public FileMenuFilter(OCFile targetFile, Account account, ComponentsGetter cg,
+ Context context) {
mFile = targetFile;
mAccount = account;
mComponentsGetter = cg;
* @param toHide List to save the options that must be shown in the menu.
*/
private void filter(List<Integer> toShow, List <Integer> toHide) {
+ boolean shareWithUsersEnable = false;
boolean synchronizing = false;
if (mComponentsGetter != null && mFile != null && mAccount != null) {
OperationsServiceBinder opsBinder = mComponentsGetter.getOperationsServiceBinder();
// uploading
(uploaderBinder != null && uploaderBinder.isUploading(mAccount, mFile))
);
+ shareWithUsersEnable = AccountUtils.hasSearchUsersSupport(mAccount);
}
/// decision is taken for each possible action on a file in the menu
}
// SHARE FILE, with Users
- if (!shareAllowed || mFile == null) {
+ if (!shareAllowed || !shareWithUsersEnable || mFile == null) {
toHide.add(R.id.action_share_with_users);
} else {
toShow.add(R.id.action_share_with_users);
}
// UNSHARE FILE, with Users
- // TODO add check on SHARE available on server side?
- if ( !shareAllowed || (mFile == null || !mFile.isShareByLink())) {
+ if ( !shareAllowed || !shareWithUsersEnable || (mFile == null || !mFile.isShareByLink())) {
toHide.add(R.id.action_unshare_with_users);
} else {
toShow.add(R.id.action_unshare_with_users);