Use capability in SearchRemoteOperation

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2022-01-05 15:21:36 +01:00
parent 7b30483a52
commit a9cec44b1f
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7
6 changed files with 28 additions and 9 deletions

View file

@ -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"

View file

@ -33,5 +33,7 @@ public class FileDataStorageManagerContentProviderClientIT extends FileDataStora
.getContentResolver()
.acquireContentProviderClient(ProviderMeta.ProviderTableMeta.CONTENT_URI)
);
super.before();
}
}

View file

@ -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<List<RemoteFile>> 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<List<RemoteFile>> searchResult = searchRemoteOperation.execute(client);
TestCase.assertTrue(searchResult.isSuccess());

View file

@ -56,11 +56,10 @@ public class FetchRemoteFileTask extends AsyncTask<Void, Void, String> {
@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);

View file

@ -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

View file

@ -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();
}