diff --git a/src/main/java/com/nextcloud/client/account/UserAccountManager.java b/src/main/java/com/nextcloud/client/account/UserAccountManager.java
index 8eca155bf4..995ae2458c 100644
--- a/src/main/java/com/nextcloud/client/account/UserAccountManager.java
+++ b/src/main/java/com/nextcloud/client/account/UserAccountManager.java
@@ -121,19 +121,6 @@ public interface UserAccountManager extends CurrentAccountProvider {
@NonNull
OwnCloudVersion getServerVersion(Account account);
- /**
- * Check if user's account supports media streaming. This is a property of server where user has his account.
- *
- * @deprecated Please use {@link OwnCloudVersion#isMediaStreamingSupported()} directly,
- * obtainable from {@link User#getServer()} and {@link Server#getVersion()}
- *
- * @param account Account used to perform {@link android.accounts.AccountManager} lookup.
- *
- * @return true is server supports media streaming, false otherwise
- */
- @Deprecated
- boolean isMediaStreamingSupported(@Nullable Account account);
-
void resetOwnCloudAccount();
/**
diff --git a/src/main/java/com/nextcloud/client/account/UserAccountManagerImpl.java b/src/main/java/com/nextcloud/client/account/UserAccountManagerImpl.java
index 67c7db5006..7937162985 100644
--- a/src/main/java/com/nextcloud/client/account/UserAccountManagerImpl.java
+++ b/src/main/java/com/nextcloud/client/account/UserAccountManagerImpl.java
@@ -327,11 +327,6 @@ public class UserAccountManagerImpl implements UserAccountManager {
return serverVersion;
}
- @Override
- public boolean isMediaStreamingSupported(Account account) {
- return account != null && getServerVersion(account).isMediaStreamingSupported();
- }
-
@Override
public void resetOwnCloudAccount() {
SharedPreferences.Editor appPrefs = PreferenceManager.getDefaultSharedPreferences(context).edit();
diff --git a/src/main/java/com/nextcloud/client/network/ConnectivityServiceImpl.java b/src/main/java/com/nextcloud/client/network/ConnectivityServiceImpl.java
index d0d98589e5..38da063bdb 100644
--- a/src/main/java/com/nextcloud/client/network/ConnectivityServiceImpl.java
+++ b/src/main/java/com/nextcloud/client/network/ConnectivityServiceImpl.java
@@ -26,12 +26,10 @@ import android.net.NetworkInfo;
import com.nextcloud.client.account.Server;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.logger.Logger;
-import com.owncloud.android.lib.resources.status.OwnCloudVersion;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.methods.GetMethod;
-import org.json.JSONObject;
import java.io.IOException;
@@ -79,35 +77,14 @@ class ConnectivityServiceImpl implements ConnectivityService {
if (baseServerAddress.isEmpty()) {
return true;
}
- String url;
- if (server.getVersion().compareTo(OwnCloudVersion.nextcloud_13) > 0) {
- url = baseServerAddress + "/index.php/204";
- } else {
- url = baseServerAddress + "/status.php";
- }
- get = requestBuilder.invoke(url);
+ get = requestBuilder.invoke(baseServerAddress + "/index.php/204");
HttpClient client = clientFactory.createPlainClient();
int status = client.executeMethod(get);
- if (server.getVersion().compareTo(OwnCloudVersion.nextcloud_13) > 0) {
- return !(status == HttpStatus.SC_NO_CONTENT &&
- (get.getResponseContentLength() == -1 || get.getResponseContentLength() == 0));
- } else {
- if (status == HttpStatus.SC_OK) {
- try {
- // try parsing json to verify response
- // check if json contains maintenance and it should be false
- String json = get.getResponseBodyAsString();
- return new JSONObject(json).getBoolean("maintenance");
- } catch (Exception e) {
- return true;
- }
- } else {
- return true;
- }
- }
+ return !(status == HttpStatus.SC_NO_CONTENT &&
+ (get.getResponseContentLength() == -1 || get.getResponseContentLength() == 0));
} catch (IOException e) {
logger.e(TAG, "Error checking internet connection", e);
} finally {
diff --git a/src/main/java/com/owncloud/android/MainApp.java b/src/main/java/com/owncloud/android/MainApp.java
index b0f93d6824..32f5d13d34 100644
--- a/src/main/java/com/owncloud/android/MainApp.java
+++ b/src/main/java/com/owncloud/android/MainApp.java
@@ -115,13 +115,13 @@ import static com.owncloud.android.ui.activity.ContactsPreferenceActivity.PREFER
/**
* Main Application of the project
- *
+ *
* Contains methods to build the "static" strings. These strings were before constants in different classes
*/
public class MainApp extends MultiDexApplication implements HasAndroidInjector {
- public static final OwnCloudVersion OUTDATED_SERVER_VERSION = OwnCloudVersion.nextcloud_16;
- public static final OwnCloudVersion MINIMUM_SUPPORTED_SERVER_VERSION = OwnCloudVersion.nextcloud_13;
+ public static final OwnCloudVersion OUTDATED_SERVER_VERSION = OwnCloudVersion.nextcloud_17;
+ public static final OwnCloudVersion MINIMUM_SUPPORTED_SERVER_VERSION = OwnCloudVersion.nextcloud_16;
private static final String TAG = MainApp.class.getSimpleName();
public static final String DOT = ".";
diff --git a/src/main/java/com/owncloud/android/files/FileMenuFilter.java b/src/main/java/com/owncloud/android/files/FileMenuFilter.java
index 2b1e6a3c2c..d0b0240060 100644
--- a/src/main/java/com/owncloud/android/files/FileMenuFilter.java
+++ b/src/main/java/com/owncloud/android/files/FileMenuFilter.java
@@ -116,21 +116,20 @@ public class FileMenuFilter {
}
/**
- * Filters out the file actions available in the passed {@link Menu} taken into account
- * the state of the {@link OCFile} held by the filter.
+ * Filters out the file actions available in the passed {@link Menu} taken into account the state of the {@link
+ * OCFile} held by the filter.
*
- * @param menu Options or context menu to filter.
- * @param inSingleFileFragment True if this is not listing, but single file fragment, like preview or details.
- * @param isMediaSupported True is media playback is supported for this user
+ * @param menu Options or context menu to filter.
+ * @param inSingleFileFragment True if this is not listing, but single file fragment, like preview or details.
*/
- public void filter(Menu menu, boolean inSingleFileFragment, boolean isMediaSupported) {
+ public void filter(Menu menu, boolean inSingleFileFragment) {
if (files == null || files.isEmpty()) {
hideAll(menu);
} else {
List toShow = new ArrayList<>();
List toHide = new ArrayList<>();
- filter(toShow, toHide, inSingleFileFragment, isMediaSupported);
+ filter(toShow, toHide, inSingleFileFragment);
for (int i : toShow) {
showMenuItem(menu.findItem(i));
@@ -179,16 +178,13 @@ public class FileMenuFilter {
/**
* Decides what actions must be shown and hidden implementing the different rule sets.
- *
- * @param toShow List to save the options that must be shown in the menu.
+ * @param toShow List to save the options that must be shown in the menu.
* @param toHide List to save the options that must be shown in the menu.
* @param inSingleFileFragment True if this is not listing, but single file fragment, like preview or details.
- * @param isMediaSupported True is media playback is supported for this user
*/
private void filter(List toShow,
List toHide,
- boolean inSingleFileFragment,
- boolean isMediaSupported) {
+ boolean inSingleFileFragment) {
boolean synchronizing = anyFileSynchronizing();
OCCapability capability = componentsGetter.getStorageManager().getCapability(user.getAccountName());
boolean endToEndEncryptionEnabled = capability.getEndToEndEncryption().isTrue();
@@ -211,7 +207,7 @@ public class FileMenuFilter {
filterEncrypt(toShow, toHide, endToEndEncryptionEnabled);
filterUnsetEncrypted(toShow, toHide, endToEndEncryptionEnabled);
filterSetPictureAs(toShow, toHide);
- filterStream(toShow, toHide, isMediaSupported);
+ filterStream(toShow, toHide);
}
private void filterShareFile(List toShow, List toHide, OCCapability capability) {
@@ -429,8 +425,8 @@ public class FileMenuFilter {
}
}
- private void filterStream(List toShow, List toHide, boolean isMediaSupported) {
- if (files.isEmpty() || !isSingleFile() || !isSingleMedia() || !isMediaSupported) {
+ private void filterStream(List toShow, List toHide) {
+ if (files.isEmpty() || !isSingleFile() || !isSingleMedia()) {
toHide.add(R.id.action_stream_media);
} else {
toShow.add(R.id.action_stream_media);
diff --git a/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java b/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java
index 2cbd300e73..5d71624f48 100644
--- a/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java
+++ b/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java
@@ -303,7 +303,7 @@ public abstract class DrawerActivity extends ToolbarActivity
OCCapability capability = storageManager.getCapability(user.getAccountName());
DrawerMenuUtil.filterSearchMenuItems(menu, user, getResources());
- DrawerMenuUtil.filterTrashbinMenuItem(menu, user, capability);
+ DrawerMenuUtil.filterTrashbinMenuItem(menu, capability);
DrawerMenuUtil.filterActivityMenuItem(menu, capability);
DrawerMenuUtil.setupHomeMenuItem(menu, getResources());
diff --git a/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java b/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java
index b0937b68f0..ce01b53192 100644
--- a/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java
+++ b/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java
@@ -689,9 +689,7 @@ public class FileDisplayActivity extends FileActivity
mWaitingToPreview = getStorageManager().getFileById(mWaitingToPreview.getFileId());
if (PreviewMediaFragment.canBePreviewed(mWaitingToPreview)) {
- boolean streaming = AccountUtils.getServerVersionForAccount(getAccount(), this)
- .isMediaStreamingSupported();
- startMediaPreview(mWaitingToPreview, 0, true, true, streaming);
+ startMediaPreview(mWaitingToPreview, 0, true, true, true);
detailsFragmentChanged = true;
} else if (MimeTypeUtil.isVCard(mWaitingToPreview.getMimeType())) {
startContactListFragment(mWaitingToPreview);
@@ -1876,9 +1874,7 @@ public class FileDisplayActivity extends FileActivity
((PreviewMediaFragment) details).updateFile(renamedFile);
if (PreviewMediaFragment.canBePreviewed(renamedFile)) {
int position = ((PreviewMediaFragment) details).getPosition();
- boolean streaming = AccountUtils.getServerVersionForAccount(getAccount(), this)
- .isMediaStreamingSupported();
- startMediaPreview(renamedFile, position, true, true, streaming);
+ startMediaPreview(renamedFile, position, true, true, true);
} else {
getFileOperationsHelper().openFile(renamedFile);
}
@@ -2342,11 +2338,9 @@ public class FileDisplayActivity extends FileActivity
if (event.getIntent().getBooleanExtra(TEXT_PREVIEW, false)) {
startTextPreview((OCFile) bundle.get(EXTRA_FILE), true);
} else if (bundle.containsKey(PreviewVideoActivity.EXTRA_START_POSITION)) {
- boolean streaming = AccountUtils.getServerVersionForAccount(getAccount(), this)
- .isMediaStreamingSupported();
- startMediaPreview((OCFile)bundle.get(EXTRA_FILE),
- (int)bundle.get(PreviewVideoActivity.EXTRA_START_POSITION),
- (boolean) bundle.get(PreviewVideoActivity.EXTRA_AUTOPLAY), true, streaming);
+ startMediaPreview((OCFile) bundle.get(EXTRA_FILE),
+ (int) bundle.get(PreviewVideoActivity.EXTRA_START_POSITION),
+ (boolean) bundle.get(PreviewVideoActivity.EXTRA_AUTOPLAY), true, true);
} else if (bundle.containsKey(PreviewImageActivity.EXTRA_VIRTUAL_TYPE)) {
startImagePreview((OCFile)bundle.get(EXTRA_FILE),
(VirtualFolderType)bundle.get(PreviewImageActivity.EXTRA_VIRTUAL_TYPE),
diff --git a/src/main/java/com/owncloud/android/ui/adapter/ActivityListAdapter.java b/src/main/java/com/owncloud/android/ui/adapter/ActivityListAdapter.java
index fe6d73bf3e..30220c2095 100644
--- a/src/main/java/com/owncloud/android/ui/adapter/ActivityListAdapter.java
+++ b/src/main/java/com/owncloud/android/ui/adapter/ActivityListAdapter.java
@@ -59,15 +59,12 @@ import com.nextcloud.common.NextcloudClient;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.FileDataStorageManager;
-import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.activities.model.Activity;
import com.owncloud.android.lib.resources.activities.model.RichElement;
import com.owncloud.android.lib.resources.activities.model.RichObject;
import com.owncloud.android.lib.resources.activities.models.PreviewObject;
-import com.owncloud.android.lib.resources.files.FileUtils;
import com.owncloud.android.lib.resources.status.OCCapability;
-import com.owncloud.android.lib.resources.status.OwnCloudVersion;
import com.owncloud.android.ui.interfaces.ActivityListInterface;
import com.owncloud.android.utils.DisplayUtils;
import com.owncloud.android.utils.MimeTypeUtil;
@@ -230,23 +227,14 @@ public class ActivityListAdapter extends RecyclerView.Adapter activityListInterface.onActivityClicked(richObject));
- setBitmap(file, imageView, isDetailView);
-
- return imageView;
- }
-
- private void setBitmap(OCFile file, ImageView fileIcon, boolean isDetailView) {
- // No Folder
- if (!file.isFolder()) {
- if (MimeTypeUtil.isImage(file) || MimeTypeUtil.isVideo(file)) {
- int placeholder;
-
- if (MimeTypeUtil.isImage(file)) {
- placeholder = R.drawable.file_image;
- } else {
- placeholder = R.drawable.file_movie;
- }
-
- String uri = client.getBaseUri() + "/index.php/apps/files/api/v1/thumbnail/" + px + "/" + px +
- Uri.encode(file.getRemotePath(), "/");
-
- Glide.with(context).using(new CustomGlideStreamLoader(currentAccountProvider, clientFactory))
- .load(uri).placeholder(placeholder)
- .error(placeholder)
- .into(fileIcon); // using custom fetcher
-
- } else {
- if (isDetailView) {
- fileIcon.setVisibility(View.GONE);
- } else {
- fileIcon.setImageDrawable(MimeTypeUtil.getFileTypeIcon(file.getMimeType(), file.getFileName(),
- context));
- }
- }
- } else {
- // Folder
- if (isDetailView) {
- fileIcon.setVisibility(View.GONE);
- } else {
- fileIcon.setImageDrawable(
- MimeTypeUtil.getFolderTypeIcon(file.isSharedWithMe() || file.isSharedWithSharee(),
- file.isSharedViaLink(), file.isEncrypted(), file.getMountType(), context));
- }
- }
- }
-
private void downloadIcon(Activity activity, ImageView itemViewType) {
GenericRequestBuilder requestBuilder = Glide.with(context)
.using(Glide.buildStreamModelLoader(Uri.class, context), InputStream.class)
diff --git a/src/main/java/com/owncloud/android/ui/fragment/FileDetailActivitiesFragment.java b/src/main/java/com/owncloud/android/ui/fragment/FileDetailActivitiesFragment.java
index 5fa7bb0c9f..0891943532 100644
--- a/src/main/java/com/owncloud/android/ui/fragment/FileDetailActivitiesFragment.java
+++ b/src/main/java/com/owncloud/android/ui/fragment/FileDetailActivitiesFragment.java
@@ -55,7 +55,6 @@ import com.owncloud.android.lib.resources.comments.MarkCommentsAsReadRemoteOpera
import com.owncloud.android.lib.resources.files.ReadFileVersionsRemoteOperation;
import com.owncloud.android.lib.resources.files.model.FileVersion;
import com.owncloud.android.lib.resources.status.OCCapability;
-import com.owncloud.android.lib.resources.status.OwnCloudVersion;
import com.owncloud.android.operations.CommentFileOperation;
import com.owncloud.android.ui.activity.ComponentsGetter;
import com.owncloud.android.ui.adapter.ActivityAndVersionListAdapter;
@@ -255,9 +254,7 @@ public class FileDetailActivitiesFragment extends Fragment implements
operationsHelper = ((ComponentsGetter) requireActivity()).getFileOperationsHelper();
OCCapability capability = storageManager.getCapability(user.getAccountName());
- OwnCloudVersion serverVersion = user.getServer().getVersion();
- restoreFileVersionSupported = capability.getFilesVersioning().isTrue() &&
- serverVersion.compareTo(OwnCloudVersion.nextcloud_14) >= 0;
+ restoreFileVersionSupported = capability.getFilesVersioning().isTrue();
emptyContentProgressBar.getIndeterminateDrawable().setColorFilter(ThemeUtils.primaryAccentColor(getContext()),
PorterDuff.Mode.SRC_IN);
diff --git a/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java b/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java
index 583ae0ee7f..e0eb5d89f0 100644
--- a/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java
+++ b/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java
@@ -412,9 +412,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
currentUser
);
- mf.filter(menu,
- true,
- currentUser.getServer().getVersion().isMediaStreamingSupported());
+ mf.filter(menu, true);
}
if (getFile().isFolder()) {
diff --git a/src/main/java/com/owncloud/android/ui/fragment/FileDetailSharingFragment.java b/src/main/java/com/owncloud/android/ui/fragment/FileDetailSharingFragment.java
index b33f12573a..5ccd74586f 100644
--- a/src/main/java/com/owncloud/android/ui/fragment/FileDetailSharingFragment.java
+++ b/src/main/java/com/owncloud/android/ui/fragment/FileDetailSharingFragment.java
@@ -326,7 +326,6 @@ public class FileDetailSharingFragment extends Fragment implements ShareeListAda
MenuItem allowDeletingItem = menu.findItem(R.id.allow_deleting);
MenuItem expirationDateItem = menu.findItem(R.id.action_expiration_date);
MenuItem reshareItem = menu.findItem(R.id.allow_resharing);
- MenuItem sendNoteItem = menu.findItem(R.id.action_share_send_note);
allowEditingItem.setChecked(canEdit(share));
@@ -350,8 +349,6 @@ public class FileDetailSharingFragment extends Fragment implements ShareeListAda
SharingMenuHelper.setupExpirationDateMenuItem(menu.findItem(R.id.action_expiration_date),
share.getExpirationDate(),
getResources());
-
- sendNoteItem.setVisible(capabilities.getVersion().isNoteOnShareSupported());
}
public void showLinkOverflowMenu(OCShare publicShare, ImageView overflowMenuShareLink) {
@@ -399,8 +396,7 @@ public class FileDetailSharingFragment extends Fragment implements ShareeListAda
Resources res = requireContext().getResources();
SharingMenuHelper.setupHideFileDownload(menu.findItem(R.id.action_hide_file_download),
publicShare.isHideFileDownload(),
- isFileDrop(publicShare),
- capabilities);
+ isFileDrop(publicShare));
SharingMenuHelper.setupPasswordMenuItem(menu.findItem(R.id.action_password),
publicShare.isPasswordProtected());
@@ -408,8 +404,6 @@ public class FileDetailSharingFragment extends Fragment implements ShareeListAda
SharingMenuHelper.setupExpirationDateMenuItem(menu.findItem(R.id.action_share_expiration_date),
publicShare.getExpirationDate(),
res);
-
- menu.findItem(R.id.action_share_send_note).setVisible(capabilities.getVersion().isNoteOnShareSupported());
}
@VisibleForTesting
diff --git a/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java b/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java
index 771f3be516..c05a692797 100644
--- a/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java
+++ b/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java
@@ -522,17 +522,13 @@ public class OCFileListFragment extends ExtendedListFragment implements
public void onOverflowIconClicked(OCFile file, View view) {
PopupMenu popup = new PopupMenu(getActivity(), view);
popup.inflate(R.menu.item_file);
- User currentUser = ((FileActivity) getActivity()).getUser().orElseThrow(IllegalStateException::new);
FileMenuFilter mf = new FileMenuFilter(mAdapter.getFiles().size(),
Collections.singleton(file),
mContainerActivity, getActivity(),
true,
deviceInfo,
accountManager.getUser());
- final boolean isMediaStreamingSupported = currentUser.getServer().getVersion().isMediaStreamingSupported();
- mf.filter(popup.getMenu(),
- true,
- isMediaStreamingSupported);
+ mf.filter(popup.getMenu(), true);
popup.setOnMenuItemClickListener(item -> {
Set checkedFiles = new HashSet<>();
checkedFiles.add(file);
@@ -683,7 +679,6 @@ public class OCFileListFragment extends ExtendedListFragment implements
Set checkedFiles = mAdapter.getCheckedItems();
String title = getResources().getQuantityString(R.plurals.items_selected_count, checkedCount, checkedCount);
mode.setTitle(title);
- User currentUser = accountManager.getUser();
FileMenuFilter mf = new FileMenuFilter(
mAdapter.getFiles().size(),
checkedFiles,
@@ -694,10 +689,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
accountManager.getUser()
);
- final boolean isMediaStreamingSupported = currentUser.getServer().getVersion().isMediaStreamingSupported();
- mf.filter(menu,
- false,
- isMediaStreamingSupported);
+ mf.filter(menu, false);
// Determine if we need to finish the action mode because there are no items selected
if (checkedCount == 0 && !mIsActionModeNew) {
@@ -1021,8 +1013,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
OCCapability capability = mContainerActivity.getStorageManager()
.getCapability(account.getAccountName());
- if (PreviewMediaFragment.canBePreviewed(file) && account.getServer().getVersion()
- .isMediaStreamingSupported() && !file.isEncrypted()) {
+ if (PreviewMediaFragment.canBePreviewed(file) && !file.isEncrypted()) {
// stream media preview on >= NC14
setFabVisible(false);
resetHeaderScrollingState();
diff --git a/src/main/java/com/owncloud/android/ui/fragment/util/SharingMenuHelper.java b/src/main/java/com/owncloud/android/ui/fragment/util/SharingMenuHelper.java
index 9d53ccc52a..fe2cb51524 100644
--- a/src/main/java/com/owncloud/android/ui/fragment/util/SharingMenuHelper.java
+++ b/src/main/java/com/owncloud/android/ui/fragment/util/SharingMenuHelper.java
@@ -25,7 +25,6 @@ import android.view.MenuItem;
import com.owncloud.android.R;
import com.owncloud.android.lib.resources.shares.OCShare;
-import com.owncloud.android.lib.resources.status.OCCapability;
import java.text.SimpleDateFormat;
import java.util.Date;
@@ -66,14 +65,12 @@ public final class SharingMenuHelper {
/**
* Sets checked/visibility state on the given {@link MenuItem} based on the given criteria.
*
- * @param menuItem the {@link MenuItem} to be setup
- * @param capabilities Capabilities of server to check if hide download is supported
+ * @param menuItem the {@link MenuItem} to be setup
*/
public static void setupHideFileDownload(MenuItem menuItem,
boolean hideFileDownload,
- boolean isFileDrop,
- OCCapability capabilities) {
- if (!capabilities.getVersion().isHideFileDownloadSupported() || isFileDrop) {
+ boolean isFileDrop) {
+ if (isFileDrop) {
menuItem.setVisible(false);
} else {
menuItem.setVisible(true);
diff --git a/src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.java b/src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.java
index eac7f1cf7f..b91bf45d2b 100644
--- a/src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.java
+++ b/src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.java
@@ -383,9 +383,7 @@ public class PreviewImageFragment extends FileFragment implements Injectable {
currentUser
);
- mf.filter(menu,
- true,
- currentUser.getServer().getVersion().isMediaStreamingSupported());
+ mf.filter(menu, true);
}
// additional restriction for this fragment
diff --git a/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java b/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java
index 18e9dd74fa..bd57c37288 100644
--- a/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java
+++ b/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java
@@ -356,9 +356,7 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene
currentUser
);
- mf.filter(menu,
- true,
- currentUser.getServer().getVersion().isMediaStreamingSupported());
+ mf.filter(menu, true);
}
// additional restriction for this fragment
diff --git a/src/main/java/com/owncloud/android/ui/preview/PreviewTextFileFragment.java b/src/main/java/com/owncloud/android/ui/preview/PreviewTextFileFragment.java
index 5f0aaed10c..8823333dbe 100644
--- a/src/main/java/com/owncloud/android/ui/preview/PreviewTextFileFragment.java
+++ b/src/main/java/com/owncloud/android/ui/preview/PreviewTextFileFragment.java
@@ -270,9 +270,7 @@ public class PreviewTextFileFragment extends PreviewTextFragment {
deviceInfo,
user
);
- mf.filter(menu,
- true,
- user.getServer().getVersion().isMediaStreamingSupported());
+ mf.filter(menu, true);
}
// additional restriction for this fragment
diff --git a/src/main/java/com/owncloud/android/utils/DrawerMenuUtil.java b/src/main/java/com/owncloud/android/utils/DrawerMenuUtil.java
index 5a664f53db..3aed975cbf 100644
--- a/src/main/java/com/owncloud/android/utils/DrawerMenuUtil.java
+++ b/src/main/java/com/owncloud/android/utils/DrawerMenuUtil.java
@@ -29,9 +29,7 @@ import android.view.Menu;
import com.nextcloud.client.account.User;
import com.owncloud.android.R;
import com.owncloud.android.lib.resources.status.OCCapability;
-import com.owncloud.android.lib.resources.status.OwnCloudVersion;
-import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
/**
@@ -61,9 +59,8 @@ public final class DrawerMenuUtil {
}
}
- public static void filterTrashbinMenuItem(Menu menu, @NonNull User user, @Nullable OCCapability capability) {
- if (user.getServer().getVersion().compareTo(OwnCloudVersion.nextcloud_14) < 0 ||
- capability != null && capability.getFilesUndelete().isFalse() ||
+ public static void filterTrashbinMenuItem(Menu menu, @Nullable OCCapability capability) {
+ if (capability != null && capability.getFilesUndelete().isFalse() ||
capability != null && capability.getFilesUndelete().isUnknown()) {
filterMenuItems(menu, R.id.nav_trashbin);
}
diff --git a/src/test/java/com/nextcloud/client/network/ConnectivityServiceTest.kt b/src/test/java/com/nextcloud/client/network/ConnectivityServiceTest.kt
index 0808e892c6..d597ab14fc 100644
--- a/src/test/java/com/nextcloud/client/network/ConnectivityServiceTest.kt
+++ b/src/test/java/com/nextcloud/client/network/ConnectivityServiceTest.kt
@@ -93,8 +93,8 @@ class ConnectivityServiceTest {
lateinit var logger: Logger
val baseServerUri = URI.create(SERVER_BASE_URL)
- val newServer = Server(baseServerUri, OwnCloudVersion.nextcloud_14)
- val legacyServer = Server(baseServerUri, OwnCloudVersion.nextcloud_13)
+ val newServer = Server(baseServerUri, OwnCloudVersion.nextcloud_20)
+ val legacyServer = Server(baseServerUri, OwnCloudVersion.nextcloud_16)
@Mock
lateinit var user: User
@@ -207,12 +207,6 @@ class ConnectivityServiceTest {
whenever(getRequest.responseBodyAsString).thenReturn(body)
}
- @Test
- fun `false maintenance status flag is used`() {
- mockResponse(maintenance = false, httpStatus = HttpStatus.SC_OK)
- assertFalse(connectivityService.isInternetWalled)
- }
-
@Test
fun `true maintenance status flag is used`() {
mockResponse(maintenance = true, httpStatus = HttpStatus.SC_OK)
@@ -231,7 +225,7 @@ class ConnectivityServiceTest {
connectivityService.isInternetWalled
val urlCaptor = ArgumentCaptor.forClass(String::class.java)
verify(requestBuilder).invoke(urlCaptor.capture())
- assertTrue("Invalid URL used to check status", urlCaptor.value.endsWith("/status.php"))
+ assertTrue("Invalid URL used to check status", urlCaptor.value.endsWith("/204"))
}
}
@@ -241,7 +235,7 @@ class ConnectivityServiceTest {
fun setUp() {
whenever(networkInfo.isConnectedOrConnecting).thenReturn(true)
whenever(networkInfo.type).thenReturn(ConnectivityManager.TYPE_WIFI)
- whenever(accountManager.getServerVersion(any())).thenReturn(OwnCloudVersion.nextcloud_14)
+ whenever(accountManager.getServerVersion(any())).thenReturn(OwnCloudVersion.nextcloud_20)
assertTrue(
"Precondition failed",
connectivityService.connectivity.let {
@@ -255,7 +249,7 @@ class ConnectivityServiceTest {
// GIVEN
// network connectivity is present
// user has no server URI (empty)
- val serverWithoutUri = Server(URI(""), OwnCloudVersion.nextcloud_14)
+ val serverWithoutUri = Server(URI(""), OwnCloudVersion.nextcloud_20)
whenever(user.server).thenReturn(serverWithoutUri)
// WHEN