Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -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;
Expand Down Expand Up @@ -67,6 +68,8 @@ public class OwnCloudClient extends HttpClient {

private AdvancedX509KeyManager keyManager;

private Context context;

/**
* Constructor
*/
Expand All @@ -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);

Expand Down Expand Up @@ -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()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ public abstract class RemoteOperation<T> implements Runnable {
*/
@Deprecated
protected RemoteOperationResult<T> run(OwnCloudClient client) {
Log_OC.d(this, "Not used anymore");
throw new UnsupportedOperationException("Not used anymore");
NextcloudClient nextcloudClient = client.toNextcloudClient();

return run(nextcloudClient);
}

public RemoteOperationResult<T> run(NextcloudClient client) {
Expand Down