From 35e164fa2df9d91bf3c87484ff3d79191db3815f Mon Sep 17 00:00:00 2001 From: Chris Narkiewicz Date: Sun, 8 May 2022 23:51:57 +0100 Subject: [PATCH] Migrate RemoteOperation.execute calls to User Signed-off-by: Chris Narkiewicz --- .../java/com/nextcloud/client/EndToEndRandomIT.java | 4 ++-- .../java/com/owncloud/android/DownloadIT.java | 2 +- .../androidTest/java/com/owncloud/android/FileIT.java | 4 ++-- .../java/com/owncloud/android/UploadIT.java | 4 ++-- .../android/operations/RemoveFileOperationIT.java | 8 ++++---- .../owncloud/android/util/ErrorMessageAdapterIT.java | 2 +- app/src/main/java/com/nextcloud/client/account/User.kt | 6 +++--- .../java/com/nextcloud/client/jobs/OfflineSyncWork.kt | 2 +- .../android/datamodel/FileDataStorageManager.java | 2 +- .../android/operations/CreateFolderOperation.java | 2 +- .../android/operations/RemoveFileOperation.java | 10 +++++----- .../operations/RemoveRemoteEncryptedFileOperation.java | 10 +++++----- .../android/providers/DocumentsStorageProvider.java | 4 ++-- .../owncloud/android/services/OperationsService.java | 2 +- .../owncloud/android/ui/activity/DrawerActivity.java | 2 +- .../ui/activity/RichDocumentsEditorWebView.java | 2 +- .../owncloud/android/ui/activity/ShareActivity.java | 2 +- .../owncloud/android/ui/adapter/OCFileListAdapter.java | 2 +- .../owncloud/android/ui/adapter/UploadListAdapter.java | 2 +- .../android/ui/asynctasks/FetchRemoteFileTask.java | 7 +++---- .../android/ui/asynctasks/GallerySearchTask.java | 3 +-- .../ui/dialog/SetupEncryptionDialogFragment.java | 9 ++++----- .../android/ui/fragment/OCFileListFragment.java | 2 +- .../android/ui/fragment/OCFileListSearchAsyncTask.kt | 4 +--- .../owncloud/android/ui/fragment/SharedListFragment.kt | 3 +-- .../ui/fragment/contactsbackup/BackupFragment.java | 2 +- .../android/ui/helpers/FileOperationsHelper.java | 4 ++-- .../android/ui/preview/PreviewTextStringFragment.java | 2 +- 28 files changed, 51 insertions(+), 57 deletions(-) diff --git a/app/src/androidTest/java/com/nextcloud/client/EndToEndRandomIT.java b/app/src/androidTest/java/com/nextcloud/client/EndToEndRandomIT.java index 231dfdba00..fe28854048 100644 --- a/app/src/androidTest/java/com/nextcloud/client/EndToEndRandomIT.java +++ b/app/src/androidTest/java/com/nextcloud/client/EndToEndRandomIT.java @@ -468,7 +468,7 @@ public class EndToEndRandomIT extends AbstractOnServerIT { assertTrue(new RemoveFileOperation(fileToDelete, false, - account, + user, false, targetContext, getStorageManager()) @@ -621,7 +621,7 @@ public class EndToEndRandomIT extends AbstractOnServerIT { Log_OC.d(this, "Remove file: " + child.getDecryptedRemotePath()); } - assertTrue(new RemoveFileOperation(child, false, account, false, targetContext, getStorageManager()) + assertTrue(new RemoveFileOperation(child, false, user, false, targetContext, getStorageManager()) .execute(client) .isSuccess() ); diff --git a/app/src/androidTest/java/com/owncloud/android/DownloadIT.java b/app/src/androidTest/java/com/owncloud/android/DownloadIT.java index a2ae4fa974..820c9e6a4e 100644 --- a/app/src/androidTest/java/com/owncloud/android/DownloadIT.java +++ b/app/src/androidTest/java/com/owncloud/android/DownloadIT.java @@ -63,7 +63,7 @@ public class DownloadIT extends AbstractOnServerIT { if (result.isSuccess() && getStorageManager().getFileByDecryptedRemotePath(FOLDER) != null) { new RemoveFileOperation(getStorageManager().getFileByDecryptedRemotePath(FOLDER), false, - account, + user, false, targetContext, getStorageManager()) diff --git a/app/src/androidTest/java/com/owncloud/android/FileIT.java b/app/src/androidTest/java/com/owncloud/android/FileIT.java index 40743aae08..9b6d6ad477 100644 --- a/app/src/androidTest/java/com/owncloud/android/FileIT.java +++ b/app/src/androidTest/java/com/owncloud/android/FileIT.java @@ -38,7 +38,7 @@ public class FileIT extends AbstractOnServerIT { assertTrue(file.isFolder()); // cleanup - new RemoveFileOperation(file, false, account, false, targetContext, getStorageManager()).execute(client); + new RemoveFileOperation(file, false, user, false, targetContext, getStorageManager()).execute(client); } @Test @@ -58,7 +58,7 @@ public class FileIT extends AbstractOnServerIT { // cleanup new RemoveFileOperation(file, false, - account, + user, false, targetContext, getStorageManager()) diff --git a/app/src/androidTest/java/com/owncloud/android/UploadIT.java b/app/src/androidTest/java/com/owncloud/android/UploadIT.java index 71b6ad5e33..607ba05abb 100644 --- a/app/src/androidTest/java/com/owncloud/android/UploadIT.java +++ b/app/src/androidTest/java/com/owncloud/android/UploadIT.java @@ -116,7 +116,7 @@ public class UploadIT extends AbstractOnServerIT { if (result.isSuccess() && getStorageManager().getFileByDecryptedRemotePath(FOLDER) != null) { new RemoveFileOperation(getStorageManager().getFileByDecryptedRemotePath(FOLDER), false, - account, + user, false, targetContext, getStorageManager()) @@ -371,7 +371,7 @@ public class UploadIT extends AbstractOnServerIT { // cleanup new RemoveFileOperation(getStorageManager().getFileByDecryptedRemotePath(FOLDER), false, - account, + user, false, targetContext, getStorageManager()) diff --git a/app/src/androidTest/java/com/owncloud/android/operations/RemoveFileOperationIT.java b/app/src/androidTest/java/com/owncloud/android/operations/RemoveFileOperationIT.java index f63438643c..1318702ba4 100644 --- a/app/src/androidTest/java/com/owncloud/android/operations/RemoveFileOperationIT.java +++ b/app/src/androidTest/java/com/owncloud/android/operations/RemoveFileOperationIT.java @@ -47,7 +47,7 @@ public class RemoveFileOperationIT extends AbstractOnServerIT { assertTrue(new RemoveFileOperation(folder, false, - account, + user, false, targetContext, getStorageManager()) @@ -59,7 +59,7 @@ public class RemoveFileOperationIT extends AbstractOnServerIT { assertNotNull(parentFolder); assertTrue(new RemoveFileOperation(parentFolder, false, - account, + user, false, targetContext, getStorageManager()) @@ -81,7 +81,7 @@ public class RemoveFileOperationIT extends AbstractOnServerIT { assertTrue(new RemoveFileOperation(file, false, - account, + user, false, targetContext, getStorageManager()) @@ -93,7 +93,7 @@ public class RemoveFileOperationIT extends AbstractOnServerIT { assertNotNull(parentFolder); assertTrue(new RemoveFileOperation(parentFolder, false, - account, + user, false, targetContext, getStorageManager()) diff --git a/app/src/androidTest/java/com/owncloud/android/util/ErrorMessageAdapterIT.java b/app/src/androidTest/java/com/owncloud/android/util/ErrorMessageAdapterIT.java index 0100e0daee..ca229dbf48 100644 --- a/app/src/androidTest/java/com/owncloud/android/util/ErrorMessageAdapterIT.java +++ b/app/src/androidTest/java/com/owncloud/android/util/ErrorMessageAdapterIT.java @@ -58,7 +58,7 @@ public class ErrorMessageAdapterIT { new RemoteOperationResult(RemoteOperationResult.ResultCode.FORBIDDEN), new RemoveFileOperation(new OCFile(PATH_TO_DELETE), false, - user.toPlatformAccount(), + user, false, context, new FileDataStorageManager(user, context.getContentResolver())), diff --git a/app/src/main/java/com/nextcloud/client/account/User.kt b/app/src/main/java/com/nextcloud/client/account/User.kt index 6f9e73641d..3bf38793c0 100644 --- a/app/src/main/java/com/nextcloud/client/account/User.kt +++ b/app/src/main/java/com/nextcloud/client/account/User.kt @@ -24,8 +24,8 @@ import android.accounts.Account import android.os.Parcelable import com.owncloud.android.lib.common.OwnCloudAccount -interface User : Parcelable { - val accountName: String +interface User : Parcelable, com.nextcloud.common.User { + override val accountName: String val server: Server val isAnonymous: Boolean @@ -39,7 +39,7 @@ interface User : Parcelable { * @return Account instance that is associated with this User object. */ @Deprecated("Temporary workaround") - fun toPlatformAccount(): Account + override fun toPlatformAccount(): Account /** * This is temporary helper method created to facilitate incremental refactoring. diff --git a/app/src/main/java/com/nextcloud/client/jobs/OfflineSyncWork.kt b/app/src/main/java/com/nextcloud/client/jobs/OfflineSyncWork.kt index 5cec0bbe80..93cfdda8e6 100644 --- a/app/src/main/java/com/nextcloud/client/jobs/OfflineSyncWork.kt +++ b/app/src/main/java/com/nextcloud/client/jobs/OfflineSyncWork.kt @@ -88,7 +88,7 @@ class OfflineSyncWork constructor( ocFolder.remotePath, ocFolder.etagOnServer ) - val result = checkEtagOperation.execute(user.toPlatformAccount(), context) + val result = checkEtagOperation.execute(user, context) when (result.code) { ResultCode.ETAG_UNCHANGED -> { Log_OC.d(TAG, "$folderName: eTag unchanged") diff --git a/app/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java b/app/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java index 1a5302ec77..50296cdcaf 100644 --- a/app/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java +++ b/app/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java @@ -278,7 +278,7 @@ public class FileDataStorageManager { // remote request ReadFileRemoteOperation operation = new ReadFileRemoteOperation(parentPath); // TODO Deprecated - RemoteOperationResult result = operation.execute(getUser().toPlatformAccount(), context); + RemoteOperationResult result = operation.execute(getUser(), context); if (result.isSuccess()) { OCFile remoteFolder = FileStorageUtils.fillOCFile((RemoteFile) result.getData().get(0)); diff --git a/app/src/main/java/com/owncloud/android/operations/CreateFolderOperation.java b/app/src/main/java/com/owncloud/android/operations/CreateFolderOperation.java index 3dff47a39b..09017fa330 100644 --- a/app/src/main/java/com/owncloud/android/operations/CreateFolderOperation.java +++ b/app/src/main/java/com/owncloud/android/operations/CreateFolderOperation.java @@ -202,7 +202,7 @@ public class CreateFolderOperation extends SyncOperation implements OnRemoteOper if (encryptedRemotePath != null) { RemoteOperationResult removeResult = new RemoveRemoteEncryptedFileOperation(encryptedRemotePath, parent.getLocalId(), - user.toPlatformAccount(), + user, context, filename).execute(client); diff --git a/app/src/main/java/com/owncloud/android/operations/RemoveFileOperation.java b/app/src/main/java/com/owncloud/android/operations/RemoveFileOperation.java index a97db0a878..e052aea400 100644 --- a/app/src/main/java/com/owncloud/android/operations/RemoveFileOperation.java +++ b/app/src/main/java/com/owncloud/android/operations/RemoveFileOperation.java @@ -22,9 +22,9 @@ package com.owncloud.android.operations; -import android.accounts.Account; import android.content.Context; +import com.nextcloud.client.account.User; import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.datamodel.ThumbnailsCacheManager; @@ -44,7 +44,7 @@ public class RemoveFileOperation extends SyncOperation { private final OCFile fileToRemove; private final boolean onlyLocalCopy; - private final Account account; + private final User user; private final boolean inBackground; private final Context context; @@ -57,7 +57,7 @@ public class RemoveFileOperation extends SyncOperation { */ public RemoveFileOperation(OCFile fileToRemove, boolean onlyLocalCopy, - Account account, + User user, boolean inBackground, Context context, FileDataStorageManager storageManager) { @@ -65,7 +65,7 @@ public class RemoveFileOperation extends SyncOperation { this.fileToRemove = fileToRemove; this.onlyLocalCopy = onlyLocalCopy; - this.account = account; + this.user = user; this.inBackground = inBackground; this.context = context; } @@ -105,7 +105,7 @@ public class RemoveFileOperation extends SyncOperation { OCFile parent = getStorageManager().getFileByPath(fileToRemove.getParentRemotePath()); operation = new RemoveRemoteEncryptedFileOperation(fileToRemove.getRemotePath(), parent.getLocalId(), - account, + user, context, fileToRemove.getEncryptedFileName()); } else { diff --git a/app/src/main/java/com/owncloud/android/operations/RemoveRemoteEncryptedFileOperation.java b/app/src/main/java/com/owncloud/android/operations/RemoveRemoteEncryptedFileOperation.java index 7df149a841..80ddf030cd 100644 --- a/app/src/main/java/com/owncloud/android/operations/RemoveRemoteEncryptedFileOperation.java +++ b/app/src/main/java/com/owncloud/android/operations/RemoveRemoteEncryptedFileOperation.java @@ -21,10 +21,10 @@ package com.owncloud.android.operations; -import android.accounts.Account; import android.content.Context; import com.google.gson.reflect.TypeToken; +import com.nextcloud.client.account.User; import com.owncloud.android.datamodel.ArbitraryDataProvider; import com.owncloud.android.datamodel.DecryptedFolderMetadata; import com.owncloud.android.datamodel.EncryptedFolderMetadata; @@ -63,7 +63,7 @@ public class RemoveRemoteEncryptedFileOperation extends RemoteOperation { private String remotePath; private String parentId; - private Account account; + private User user; private ArbitraryDataProvider arbitraryDataProvider; private String fileName; @@ -76,12 +76,12 @@ public class RemoveRemoteEncryptedFileOperation extends RemoteOperation { */ RemoveRemoteEncryptedFileOperation(String remotePath, String parentId, - Account account, + User user, Context context, String fileName) { this.remotePath = remotePath; this.parentId = parentId; - this.account = account; + this.user = user; this.fileName = fileName; arbitraryDataProvider = new ArbitraryDataProvider(context.getContentResolver()); @@ -97,7 +97,7 @@ public class RemoveRemoteEncryptedFileOperation extends RemoteOperation { String token = null; DecryptedFolderMetadata metadata; - String privateKey = arbitraryDataProvider.getValue(account.name, EncryptionUtils.PRIVATE_KEY); + String privateKey = arbitraryDataProvider.getValue(user.getAccountName(), EncryptionUtils.PRIVATE_KEY); try { // Lock folder diff --git a/app/src/main/java/com/owncloud/android/providers/DocumentsStorageProvider.java b/app/src/main/java/com/owncloud/android/providers/DocumentsStorageProvider.java index 1669a946fb..7b035dfd53 100644 --- a/app/src/main/java/com/owncloud/android/providers/DocumentsStorageProvider.java +++ b/app/src/main/java/com/owncloud/android/providers/DocumentsStorageProvider.java @@ -284,7 +284,7 @@ public class DocumentsStorageProvider extends DocumentsProvider { Context context = getNonNullContext(); OCFile ocFile = document.getFile(); RemoteOperationResult result = new CheckEtagRemoteOperation(ocFile.getRemotePath(), ocFile.getEtag()) - .execute(document.getUser().toPlatformAccount(), context); + .execute(document.getUser(), context); switch (result.getCode()) { case ETAG_CHANGED: return true; @@ -611,7 +611,7 @@ public class DocumentsStorageProvider extends DocumentsProvider { OCFile file = document.getStorageManager().getFileByPath(document.getRemotePath()); RemoteOperationResult result = new RemoveFileOperation(file, false, - document.getUser().toPlatformAccount(), + document.getUser(), true, context, document.getStorageManager()) diff --git a/app/src/main/java/com/owncloud/android/services/OperationsService.java b/app/src/main/java/com/owncloud/android/services/OperationsService.java index ae1f85fb64..01bccc728e 100644 --- a/app/src/main/java/com/owncloud/android/services/OperationsService.java +++ b/app/src/main/java/com/owncloud/android/services/OperationsService.java @@ -668,7 +668,7 @@ public class OperationsService extends Service { boolean inBackground = operationIntent.getBooleanExtra(EXTRA_IN_BACKGROUND, false); operation = new RemoveFileOperation(file, onlyLocalCopy, - account, + user, inBackground, getApplicationContext(), fileDataStorageManager); diff --git a/app/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java index 89e37d07a5..621b8c9d4d 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java @@ -1165,7 +1165,7 @@ public abstract class DrawerActivity extends ToolbarActivity Log_OC.d("ExternalLinks", "update via api"); RemoteOperation getExternalLinksOperation = new ExternalLinksOperation(); - RemoteOperationResult result = getExternalLinksOperation.execute(user.toPlatformAccount(), this); + RemoteOperationResult result = getExternalLinksOperation.execute(user, this); if (result.isSuccess() && result.getData() != null) { externalLinksProvider.deleteAllExternalLinks(); diff --git a/app/src/main/java/com/owncloud/android/ui/activity/RichDocumentsEditorWebView.java b/app/src/main/java/com/owncloud/android/ui/activity/RichDocumentsEditorWebView.java index f097236e64..b4c12faee2 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/RichDocumentsEditorWebView.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/RichDocumentsEditorWebView.java @@ -176,7 +176,7 @@ public class RichDocumentsEditorWebView extends EditorWebView { new Thread(() -> { User user = currentAccountProvider.getUser(); RichDocumentsCreateAssetOperation operation = new RichDocumentsCreateAssetOperation(file.getRemotePath()); - RemoteOperationResult result = operation.execute(user.toPlatformAccount(), this); + RemoteOperationResult result = operation.execute(user, this); if (result.isSuccess()) { String asset = (String) result.getSingleData(); diff --git a/app/src/main/java/com/owncloud/android/ui/activity/ShareActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/ShareActivity.java index b02eabe1aa..dcb767eeb1 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/ShareActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/ShareActivity.java @@ -108,7 +108,7 @@ public class ShareActivity extends FileActivity { Activity activity = this; new Thread(() -> { RemoteOperationResult result = new ReadFileRemoteOperation(getFile().getRemotePath()) - .execute(optionalUser.get().toPlatformAccount(), + .execute(optionalUser.get(), activity); if (result.isSuccess()) { diff --git a/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java b/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java index 70bbdf902b..142226672a 100644 --- a/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java +++ b/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java @@ -770,7 +770,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter { + .execute(user, context, (caller, result) -> { view.binding.uploadListItemLayout.setClickable(true); listener.onRemoteOperationFinish(caller, result); }, parentActivity.getHandler()); diff --git a/app/src/main/java/com/owncloud/android/ui/asynctasks/FetchRemoteFileTask.java b/app/src/main/java/com/owncloud/android/ui/asynctasks/FetchRemoteFileTask.java index ac27fd24f9..b4b9e8f761 100644 --- a/app/src/main/java/com/owncloud/android/ui/asynctasks/FetchRemoteFileTask.java +++ b/app/src/main/java/com/owncloud/android/ui/asynctasks/FetchRemoteFileTask.java @@ -60,8 +60,7 @@ public class FetchRemoteFileTask extends AsyncTask { FILE_ID_SEARCH, false, fileDisplayActivity.getCapabilities()); - RemoteOperationResult remoteOperationResult = searchRemoteOperation.execute(user.toPlatformAccount(), - fileDisplayActivity); + RemoteOperationResult remoteOperationResult = searchRemoteOperation.execute(user, fileDisplayActivity); if (remoteOperationResult.isSuccess() && remoteOperationResult.getData() != null) { if (remoteOperationResult.getData().isEmpty()) { @@ -70,7 +69,7 @@ public class FetchRemoteFileTask extends AsyncTask { String remotePath = ((RemoteFile) remoteOperationResult.getData().get(0)).getRemotePath(); ReadFileRemoteOperation operation = new ReadFileRemoteOperation(remotePath); - RemoteOperationResult result = operation.execute(user.toPlatformAccount(), fileDisplayActivity); + RemoteOperationResult result = operation.execute(user, fileDisplayActivity); if (!result.isSuccess()) { Exception exception = result.getException(); @@ -105,7 +104,7 @@ public class FetchRemoteFileTask extends AsyncTask { storageManager, user, fileDisplayActivity); - refreshFolderOperation.execute(user.toPlatformAccount(), fileDisplayActivity); + refreshFolderOperation.execute(user, fileDisplayActivity); fileDisplayActivity.setFile(ocFile); } else { diff --git a/app/src/main/java/com/owncloud/android/ui/asynctasks/GallerySearchTask.java b/app/src/main/java/com/owncloud/android/ui/asynctasks/GallerySearchTask.java index 53e6a782fb..830273d97e 100644 --- a/app/src/main/java/com/owncloud/android/ui/asynctasks/GallerySearchTask.java +++ b/app/src/main/java/com/owncloud/android/ui/asynctasks/GallerySearchTask.java @@ -96,8 +96,7 @@ public class GallerySearchTask extends AsyncTask privateKeyResult = - new GetPrivateKeyOperation().execute(user.toPlatformAccount(), getContext()); + new GetPrivateKeyOperation().execute(user, getContext()); if (privateKeyResult.isSuccess()) { Log_OC.d(TAG, "private key successful downloaded for " + user.getAccountName()); @@ -356,7 +356,7 @@ public class SetupEncryptionDialogFragment extends DialogFragment implements Inj String urlEncoded = CsrHelper.generateCsrPemEncodedString(keyPair, userId); SendCSROperation operation = new SendCSROperation(urlEncoded); - RemoteOperationResult result = operation.execute(user.toPlatformAccount(), getContext()); + RemoteOperationResult result = operation.execute(user, getContext()); if (result.isSuccess()) { Log_OC.d(TAG, "public key success"); @@ -374,8 +374,7 @@ public class SetupEncryptionDialogFragment extends DialogFragment implements Inj // upload encryptedPrivateKey StorePrivateKeyOperation storePrivateKeyOperation = new StorePrivateKeyOperation(encryptedPrivateKey); - RemoteOperationResult storePrivateKeyResult = storePrivateKeyOperation.execute(user.toPlatformAccount(), - getContext()); + RemoteOperationResult storePrivateKeyResult = storePrivateKeyOperation.execute(user, getContext()); if (storePrivateKeyResult.isSuccess()) { Log_OC.d(TAG, "private key success"); @@ -390,7 +389,7 @@ public class SetupEncryptionDialogFragment extends DialogFragment implements Inj return (String) storePrivateKeyResult.getData().get(0); } else { DeletePublicKeyOperation deletePublicKeyOperation = new DeletePublicKeyOperation(); - deletePublicKeyOperation.execute(user.toPlatformAccount(), getContext()); + deletePublicKeyOperation.execute(user, getContext()); } } catch (Exception e) { Log_OC.e(TAG, e.getMessage()); diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java index c89bb91223..2382ac7b14 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java @@ -542,7 +542,7 @@ public class OCFileListFragment extends ExtendedListFragment implements public void createRichWorkspace() { new Thread(() -> { RemoteOperationResult result = new RichWorkspaceDirectEditingRemoteOperation(mFile.getRemotePath()) - .execute(accountManager.getUser().toPlatformAccount(), requireContext()); + .execute(accountManager.getUser(), requireContext()); if (result.isSuccess()) { String url = (String) result.getSingleData(); diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListSearchAsyncTask.kt b/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListSearchAsyncTask.kt index e2bdb8aa4a..9482c6952d 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListSearchAsyncTask.kt +++ b/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListSearchAsyncTask.kt @@ -61,9 +61,7 @@ class OCFileListSearchAsyncTask( } fragment.setTitle() - val remoteOperationResult = remoteOperation.execute( - currentUser.toPlatformAccount(), fragment.context - ) + val remoteOperationResult = remoteOperation.execute(currentUser, fragment.context) if (remoteOperationResult.hasSuccessfulResult() && !isCancelled && fragment.searchFragment) { fragment.searchEvent = event if (remoteOperationResult.resultData.isNullOrEmpty()) { diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/SharedListFragment.kt b/app/src/main/java/com/owncloud/android/ui/fragment/SharedListFragment.kt index 9d53afe3a0..102a400619 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/SharedListFragment.kt +++ b/app/src/main/java/com/owncloud/android/ui/fragment/SharedListFragment.kt @@ -84,8 +84,7 @@ class SharedListFragment : OCFileListFragment(), Injectable { private suspend fun fetchFileData(partialFile: OCFile): OCFile? { return withContext(Dispatchers.IO) { val user = accountManager.user - val fetchResult = ReadFileRemoteOperation(partialFile.remotePath) - .execute(user.toPlatformAccount(), context) + val fetchResult = ReadFileRemoteOperation(partialFile.remotePath).execute(user, context) if (!fetchResult.isSuccess) { logger.e(SHARED_TAG, "Error fetching file") if (fetchResult.isException) { diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/contactsbackup/BackupFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/contactsbackup/BackupFragment.java index fe0fcfda6a..24a7838d6d 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/contactsbackup/BackupFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/contactsbackup/BackupFragment.java @@ -260,7 +260,7 @@ public class BackupFragment extends FileFragment implements DatePickerDialog.OnD RefreshFolderOperation operation = new RefreshFolderOperation(folder, System.currentTimeMillis(), false, false, storageManager, user, context); - RemoteOperationResult result = operation.execute(user.toPlatformAccount(), context); + RemoteOperationResult result = operation.execute(user, context); return result.isSuccess(); } else { return Boolean.FALSE; diff --git a/app/src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java b/app/src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java index 0491777d62..e1dfde691c 100755 --- a/app/src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java +++ b/app/src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java @@ -235,7 +235,7 @@ public class FileOperationsHelper { // check for changed eTag CheckEtagRemoteOperation checkEtagOperation = new CheckEtagRemoteOperation(file.getRemotePath(), file.getEtag()); - RemoteOperationResult result = checkEtagOperation.execute(user.toPlatformAccount(), fileActivity); + RemoteOperationResult result = checkEtagOperation.execute(user, fileActivity); // eTag changed, sync file if (result.getCode() == RemoteOperationResult.ResultCode.ETAG_CHANGED) { @@ -454,7 +454,7 @@ public class FileOperationsHelper { final User user = currentAccount.getUser(); new Thread(() -> { StreamMediaFileOperation sfo = new StreamMediaFileOperation(file.getRemoteId()); - RemoteOperationResult result = sfo.execute(user.toPlatformAccount(), fileActivity); + RemoteOperationResult result = sfo.execute(user, fileActivity); fileActivity.dismissLoadingDialog(); diff --git a/app/src/main/java/com/owncloud/android/ui/preview/PreviewTextStringFragment.java b/app/src/main/java/com/owncloud/android/ui/preview/PreviewTextStringFragment.java index ff88b26f24..4ab987e6fe 100644 --- a/app/src/main/java/com/owncloud/android/ui/preview/PreviewTextStringFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/preview/PreviewTextStringFragment.java @@ -136,7 +136,7 @@ public class PreviewTextStringFragment extends PreviewTextFragment { private void edit() { new Thread(() -> { RemoteOperationResult result = new RichWorkspaceDirectEditingRemoteOperation(getFile().getRemotePath()) - .execute(accountManager.getUser().toPlatformAccount(), getContext()); + .execute(accountManager.getUser(), getContext()); if (result.isSuccess()) { String url = (String) result.getSingleData();