Add new ShareType: GUEST, FEDERATED_GROUP, DECK

Moved SearchRemoteOperation and GetSharesRemoteOperation to use typed response

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2021-06-29 08:36:43 +02:00
parent 4a6aa837c8
commit 2d9c4176a0
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7
4 changed files with 14 additions and 21 deletions

View file

@ -1373,19 +1373,12 @@ public class FileDataStorageManager {
}
// TODO shares null?
public void saveShares(ArrayList<OCShare> shares) {
cleanShares(); // 190
ArrayList<OCShare> temp = new ArrayList<>();
for (int i = 188; i <= 189; i++) {
temp.add(shares.get(i));
}
ArrayList<ContentProviderOperation> operations = new ArrayList<>(temp.size());
public void saveShares(List<OCShare> shares) {
cleanShares();
ArrayList<ContentProviderOperation> operations = new ArrayList<>(shares.size());
// prepare operations to insert or update files to save in the given folder
for (OCShare share : temp) {
for (OCShare share : shares) {
ContentValues contentValues = createContentValueForShare(share);
if (shareExistsForRemoteId(share.getRemoteId())) {

View file

@ -403,8 +403,11 @@ public class FileContentProvider extends ContentProvider {
case GROUP:
case EMAIL:
case FEDERATED:
case FEDERATED_GROUP:
case ROOM:
case CIRCLE:
case DECK:
case GUEST:
fileValues.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, 1);
break;

View file

@ -895,7 +895,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
}
private void parseShares(List<Object> objects) {
ArrayList<OCShare> shares = new ArrayList<>();
List<OCShare> shares = new ArrayList<>();
for (Object shareObject : objects) {
// check type before cast as of long running data fetch it is possible that old result is filled

View file

@ -1555,12 +1555,12 @@ public class OCFileListFragment extends ExtendedListFragment implements
storageManager = mContainerActivity.getStorageManager();
}
if (remoteOperationResult.isSuccess() && remoteOperationResult.getData() != null
if (remoteOperationResult.isSuccess() && remoteOperationResult.getResultData() != null
&& !isCancelled() && searchFragment) {
if (remoteOperationResult.getData() == null || remoteOperationResult.getData().size() == 0) {
if (remoteOperationResult.getResultData() == null || ((List) remoteOperationResult.getResultData()).isEmpty()) {
setEmptyView(event);
} else {
mAdapter.setData(remoteOperationResult.getData(),
mAdapter.setData(((RemoteOperationResult<List>) remoteOperationResult).getResultData(),
currentSearchType,
storageManager,
mFile,
@ -1570,13 +1570,10 @@ public class OCFileListFragment extends ExtendedListFragment implements
final ToolbarActivity fileDisplayActivity = (ToolbarActivity) getActivity();
if (fileDisplayActivity != null) {
fileDisplayActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
fileDisplayActivity.runOnUiThread(() -> {
if (fileDisplayActivity != null) {
setLoading(false);
}
}
});
}
}