diff --git a/build.gradle b/build.gradle index e8346c09e2..2fbb6503f7 100644 --- a/build.gradle +++ b/build.gradle @@ -64,7 +64,7 @@ ext { daggerVersion = "2.40.5" markwonVersion = "4.6.2" prismVersion = "2.0.0" - androidLibraryVersion = "master-SNAPSHOT" + androidLibraryVersion = "szaimen-patch-1-SNAPSHOT" mockitoVersion = "4.2.0" mockkVersion = "1.12.2" powermockVersion = "2.0.9" diff --git a/src/androidTest/java/com/owncloud/android/datamodel/FileDataStorageManagerContentProviderClientIT.java b/src/androidTest/java/com/owncloud/android/datamodel/FileDataStorageManagerContentProviderClientIT.java index 6c6e8bb28e..f4883f4ce8 100644 --- a/src/androidTest/java/com/owncloud/android/datamodel/FileDataStorageManagerContentProviderClientIT.java +++ b/src/androidTest/java/com/owncloud/android/datamodel/FileDataStorageManagerContentProviderClientIT.java @@ -33,5 +33,7 @@ public class FileDataStorageManagerContentProviderClientIT extends FileDataStora .getContentResolver() .acquireContentProviderClient(ProviderMeta.ProviderTableMeta.CONTENT_URI) ); + + super.before(); } } diff --git a/src/androidTest/java/com/owncloud/android/datamodel/FileDataStorageManagerIT.java b/src/androidTest/java/com/owncloud/android/datamodel/FileDataStorageManagerIT.java index 5a57f96cec..5b63da2122 100644 --- a/src/androidTest/java/com/owncloud/android/datamodel/FileDataStorageManagerIT.java +++ b/src/androidTest/java/com/owncloud/android/datamodel/FileDataStorageManagerIT.java @@ -32,6 +32,7 @@ import com.owncloud.android.lib.resources.files.SearchRemoteOperation; import com.owncloud.android.lib.resources.files.UploadFileRemoteOperation; import com.owncloud.android.lib.resources.files.model.RemoteFile; import com.owncloud.android.lib.resources.status.CapabilityBooleanType; +import com.owncloud.android.lib.resources.status.GetCapabilitiesRemoteOperation; import com.owncloud.android.lib.resources.status.OCCapability; import com.owncloud.android.operations.RefreshFolderOperation; import com.owncloud.android.utils.FileStorageUtils; @@ -57,6 +58,7 @@ import static org.junit.Assert.assertTrue; abstract public class FileDataStorageManagerIT extends AbstractOnServerIT { protected FileDataStorageManager sut; + private OCCapability capability; @Before public void before() { @@ -65,6 +67,10 @@ abstract public class FileDataStorageManagerIT extends AbstractOnServerIT { sut.deleteVirtuals(VirtualFolderType.GALLERY); assertEquals(0, sut.getAllFiles().size()); + + capability = (OCCapability) new GetCapabilitiesRemoteOperation(null) + .execute(client) + .getSingleData(); } @After @@ -168,7 +174,8 @@ abstract public class FileDataStorageManagerIT extends AbstractOnServerIT { // search SearchRemoteOperation searchRemoteOperation = new SearchRemoteOperation("image/%", PHOTO_SEARCH, - false); + false, + capability); RemoteOperationResult> searchResult = searchRemoteOperation.execute(client); TestCase.assertTrue(searchResult.isSuccess()); @@ -253,7 +260,8 @@ abstract public class FileDataStorageManagerIT extends AbstractOnServerIT { // search SearchRemoteOperation searchRemoteOperation = new SearchRemoteOperation("", GALLERY_SEARCH, - false); + false, + capability); RemoteOperationResult> searchResult = searchRemoteOperation.execute(client); TestCase.assertTrue(searchResult.isSuccess()); diff --git a/src/main/java/com/owncloud/android/ui/asynctasks/FetchRemoteFileTask.java b/src/main/java/com/owncloud/android/ui/asynctasks/FetchRemoteFileTask.java index d5134f2851..ac27fd24f9 100644 --- a/src/main/java/com/owncloud/android/ui/asynctasks/FetchRemoteFileTask.java +++ b/src/main/java/com/owncloud/android/ui/asynctasks/FetchRemoteFileTask.java @@ -56,11 +56,10 @@ public class FetchRemoteFileTask extends AsyncTask { @Override protected String doInBackground(Void... voids) { - - SearchRemoteOperation searchRemoteOperation = new SearchRemoteOperation(fileId, FILE_ID_SEARCH, - false); + false, + fileDisplayActivity.getCapabilities()); RemoteOperationResult remoteOperationResult = searchRemoteOperation.execute(user.toPlatformAccount(), fileDisplayActivity); diff --git a/src/main/java/com/owncloud/android/ui/fragment/GalleryFragment.java b/src/main/java/com/owncloud/android/ui/fragment/GalleryFragment.java index 2ea70c5f7f..474a4606b7 100644 --- a/src/main/java/com/owncloud/android/ui/fragment/GalleryFragment.java +++ b/src/main/java/com/owncloud/android/ui/fragment/GalleryFragment.java @@ -30,6 +30,7 @@ import android.view.ViewGroup; import com.owncloud.android.datamodel.VirtualFolderType; import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.lib.resources.files.SearchRemoteOperation; +import com.owncloud.android.lib.resources.status.OCCapability; import com.owncloud.android.ui.asynctasks.GallerySearchTask; import com.owncloud.android.ui.events.ChangeMenuEvent; import com.owncloud.android.ui.events.SearchEvent; @@ -67,9 +68,13 @@ public class GalleryFragment extends OCFileListFragment { searchEvent = new SearchEvent("", SearchRemoteOperation.SearchType.GALLERY_SEARCH); + OCCapability ocCapability = mContainerActivity.getStorageManager() + .getCapability(accountManager.getUser().getAccountName()); + searchRemoteOperation = new SearchRemoteOperation(searchEvent.getSearchQuery(), searchEvent.getSearchType(), - false); + false, + ocCapability); } @Override 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 3dd03626fd..6eb9363f6e 100644 --- a/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java +++ b/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java @@ -1515,8 +1515,13 @@ public class OCFileListFragment extends ExtendedListFragment implements searchOnlyFolders = true; } - remoteOperation = new SearchRemoteOperation(event.getSearchQuery(), event.getSearchType(), - searchOnlyFolders); + OCCapability ocCapability = mContainerActivity.getStorageManager() + .getCapability(currentUser.getAccountName()); + + remoteOperation = new SearchRemoteOperation(event.getSearchQuery(), + event.getSearchType(), + searchOnlyFolders, + ocCapability); } else { remoteOperation = new GetSharesRemoteOperation(); }