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

Commit

Permalink
[android] - allow setting an OkHttpClient
Browse files Browse the repository at this point in the history
  • Loading branch information
tobrun committed Jan 18, 2018
1 parent c404e3b commit b863871
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
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;
}
}
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

0 comments on commit b863871

Please sign in to comment.