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

Allow changing the used OkHttpClient #10948

Merged
merged 1 commit into from
Jan 18, 2018
Merged
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 @@ -234,4 +234,8 @@ static void enableLog(boolean enabled) {
static void enablePrintRequestUrlOnFailure(boolean enabled) {
logRequestUrl = enabled;
}

static void setOKHttpClient(OkHttpClient client) {
mClient = client;
tobrun marked this conversation as resolved.
Show resolved Hide resolved
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.mapbox.mapboxsdk.http;

import okhttp3.OkHttpClient;

/**
* Utility class for setting HttpRequest configurations
*/
Expand Down Expand Up @@ -28,8 +30,17 @@ public static void setLogEnabled(boolean enabled) {
*
* @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);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class DebugModeActivity extends AppCompatActivity implements OnMapReadyCa
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
HttpRequestUtil.setPrintRequestUrlOnFaillure(true);
HttpRequestUtil.setPrintRequestUrlOnFailure(true);
setContentView(R.layout.activity_debug_mode);
setupToolbar();
setupMapView(savedInstanceState);
Expand Down Expand Up @@ -206,7 +206,7 @@ protected void onSaveInstanceState(Bundle outState) {
protected void onDestroy() {
super.onDestroy();
mapView.onDestroy();
HttpRequestUtil.setPrintRequestUrlOnFaillure(false);
HttpRequestUtil.setPrintRequestUrlOnFailure(false);
}

@Override
Expand Down