[android] - allow setting an OkHttpClient

This commit is contained in:
Tobrun
2018-01-17 15:54:49 +01:00
committed by Tobrun
parent c404e3bccb
commit b863871bf2
3 changed files with 18 additions and 3 deletions

View File

@@ -234,4 +234,8 @@ class HTTPRequest implements Callback {
static void enablePrintRequestUrlOnFailure(boolean enabled) {
logRequestUrl = enabled;
}
static void setOKHttpClient(OkHttpClient client) {
mClient = client;
}
}

View File

@@ -1,5 +1,7 @@
package com.mapbox.mapboxsdk.http;
import okhttp3.OkHttpClient;
/**
* Utility class for setting HttpRequest configurations
*/
@@ -28,8 +30,17 @@ public class HttpRequestUtil {
*
* @param enabled True will print urls, false will disable
*/
public static void setPrintRequestUrlOnFaillure(boolean enabled) {
public static void setPrintRequestUrlOnFailure(boolean enabled) {
HTTPRequest.enablePrintRequestUrlOnFailure(enabled);
}
/**
* Set the OkHttpClient used for requesting map resources.
*
* @param client the OkHttpClient
*/
public static void setOkHttpClient(OkHttpClient client) {
HTTPRequest.setOKHttpClient(client);
}
}