Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remote operations #11757

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public void before() throws IOException {
if (capability.getVersion().equals(new OwnCloudVersion("0.0.0"))) {
// fetch new one
assertTrue(new GetCapabilitiesOperation(getStorageManager())
.execute(client)
.execute(nextcloudClient)
.isSuccess());
}
// tests only for NC19+
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void before() {
assertEquals(0, sut.getAllFiles().size());

capability = (OCCapability) new GetCapabilitiesRemoteOperation(null)
.execute(client)
.execute(nextcloudClient)
.getSingleData();
}

Expand Down
8 changes: 2 additions & 6 deletions app/src/gplay/java/com/owncloud/android/utils/PushUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
import com.owncloud.android.lib.common.OwnCloudAccount;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.OwnCloudClientManagerFactory;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.notifications.RegisterAccountDeviceForNotificationsOperation;
Expand Down Expand Up @@ -150,11 +149,8 @@ private static void deleteRegistrationForAccount(Account account) {
OwnCloudClient mClient = OwnCloudClientManagerFactory.getDefaultSingleton().
getClientFor(ocAccount, context);

RemoteOperation unregisterAccountDeviceForNotificationsOperation = new
UnregisterAccountDeviceForNotificationsOperation();

RemoteOperationResult remoteOperationResult = unregisterAccountDeviceForNotificationsOperation.
execute(mClient);
RemoteOperationResult remoteOperationResult = new
UnregisterAccountDeviceForNotificationsOperation().execute(mClient);

if (remoteOperationResult.getHttpCode() == HttpStatus.SC_ACCEPTED) {
String arbitraryValue;
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/nextcloud/client/media/LoadUrlTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
package com.nextcloud.client.media

import android.os.AsyncTask
import com.owncloud.android.files.StreamMediaFileOperation
import com.owncloud.android.lib.common.OwnCloudClient
import com.owncloud.android.lib.resources.files.StreamMediaFileRemoteOperation

internal class LoadUrlTask(
private val client: OwnCloudClient,
Expand All @@ -33,7 +33,7 @@ internal class LoadUrlTask(
) : AsyncTask<Void, Void, String>() {

override fun doInBackground(vararg args: Void): String? {
val operation = StreamMediaFileOperation(fileId)
val operation = StreamMediaFileRemoteOperation(fileId)
val result = operation.execute(client)
return when (result.isSuccess) {
true -> result.data[0] as String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
import com.nextcloud.client.onboarding.FirstRunActivity;
import com.nextcloud.client.onboarding.OnboardingService;
import com.nextcloud.client.preferences.AppPreferences;
import com.nextcloud.common.NextcloudClient;
import com.nextcloud.java.util.Optional;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
Expand Down Expand Up @@ -911,10 +912,12 @@ private void onGetServerInfoFinish(RemoteOperationResult result) {
checkBasicAuthorization(webViewUser, webViewPassword);
} else {
new Thread(() -> {
OwnCloudClient client = OwnCloudClientFactory.createOwnCloudClient(Uri.parse(mServerInfo.mBaseUrl),
this,
true);
RemoteOperationResult remoteOperationResult = new GetCapabilitiesRemoteOperation().execute(client);
NextcloudClient client = OwnCloudClientFactory.createNextcloudClient(Uri.parse(mServerInfo.mBaseUrl),
"",
"",
this,
true);
RemoteOperationResult<OCCapability> remoteOperationResult = new GetCapabilitiesRemoteOperation().execute(client);

if (remoteOperationResult.isSuccess() &&
remoteOperationResult.getData() != null &&
Expand Down Expand Up @@ -1223,7 +1226,8 @@ private void getUserCapabilitiesAndFinish() {
Executors.newSingleThreadExecutor().execute(() -> {
try {
final FileDataStorageManager storageManager = new FileDataStorageManager(user.get(), getContentResolver());
new GetCapabilitiesOperation(storageManager).execute(MainApp.getAppContext());
NextcloudClient nextcloudClient = OwnCloudClientFactory.createNextcloudClient(user.get(), this);
new GetCapabilitiesOperation(storageManager).execute(nextcloudClient);
handler.post(this::endSuccess);
} catch (Exception e) {
Log_OC.e(TAG, "Failed to fetch capabilities", e);
Expand Down
49 changes: 0 additions & 49 deletions app/src/main/java/com/owncloud/android/datamodel/Template.kt

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading