Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[android] Allow a custom configured OkHttpClient to be injected… #3849

Closed
Closed
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 @@ -20,7 +20,7 @@
import okhttp3.Request;
import okhttp3.Response;

class HTTPContext {
public class HTTPContext {

private static final int CONNECTION_ERROR = 0;
private static final int TEMPORARY_ERROR = 1;
Expand All @@ -37,6 +37,12 @@ private HTTPContext() {
//mClient.interceptors().add(new LoggingInterceptor());
}

public static void setClient(OkHttpClient client){
HTTPContext httpContext = new HTTPContext();
httpContext.mClient = client;
mInstance = httpContext;
}

public static HTTPContext getInstance() {
if (mInstance == null) {
mInstance = new HTTPContext();
Expand Down