diff --git a/library/src/main/java/com/owncloud/android/lib/common/OwnCloudClient.java b/library/src/main/java/com/owncloud/android/lib/common/OwnCloudClient.java index 3d10638ee..7b7c13039 100644 --- a/library/src/main/java/com/owncloud/android/lib/common/OwnCloudClient.java +++ b/library/src/main/java/com/owncloud/android/lib/common/OwnCloudClient.java @@ -21,6 +21,7 @@ import android.text.TextUtils; import com.nextcloud.common.DNSCache; +import com.nextcloud.common.NextcloudClient; import com.nextcloud.common.NextcloudUriDelegate; import com.owncloud.android.lib.common.accounts.AccountUtils; import com.owncloud.android.lib.common.network.AdvancedX509KeyManager; @@ -67,6 +68,8 @@ public class OwnCloudClient extends HttpClient { private AdvancedX509KeyManager keyManager; + private Context context; + /** * Constructor */ @@ -76,6 +79,7 @@ public OwnCloudClient(Uri baseUri, HttpConnectionManager connectionMgr, Context if (baseUri == null) { throw new IllegalArgumentException("Parameter 'baseUri' cannot be NULL"); } + this.context = context; this.keyManager = new AdvancedX509KeyManager(context); nextcloudUriDelegate = new NextcloudUriDelegate(baseUri); @@ -449,4 +453,18 @@ public OwnCloudCredentials getCredentials() { public void setFollowRedirects(boolean followRedirects) { this.followRedirects = followRedirects; } + + public Context getContext() { + return context; + } + + public NextcloudClient toNextcloudClient() { + return OwnCloudClientFactory.createNextcloudClient( + getBaseUri(), + getUserId(), + getCredentials().toOkHttpCredentials(), + getContext(), + isFollowRedirects() + ); + } } diff --git a/library/src/main/java/com/owncloud/android/lib/common/operations/RemoteOperation.java b/library/src/main/java/com/owncloud/android/lib/common/operations/RemoteOperation.java index 5ba1e4836..d0e93a029 100644 --- a/library/src/main/java/com/owncloud/android/lib/common/operations/RemoteOperation.java +++ b/library/src/main/java/com/owncloud/android/lib/common/operations/RemoteOperation.java @@ -88,8 +88,10 @@ public abstract class RemoteOperation implements Runnable { */ @Deprecated protected RemoteOperationResult run(OwnCloudClient client) { - Log_OC.d(this, "Not used anymore"); - throw new UnsupportedOperationException("Not used anymore"); + Log_OC.w(this, "Only temporary! Please upgrade to NextcloudClient!"); + NextcloudClient nextcloudClient = client.toNextcloudClient(); + + return run(nextcloudClient); } public RemoteOperationResult run(NextcloudClient client) {