1
0
mirror of https://github.com/owncloud/android-library.git synced 2025-06-07 16:06:08 +00:00

fix crash when calling getOkHttpInterceptor

This commit is contained in:
theScrabi 2018-06-15 09:43:16 +02:00 committed by davigonz
parent 019383378d
commit e78b96348b

View File

@ -45,13 +45,6 @@ public class HttpClient {
public static OkHttpClient getOkHttpClient() {
if (mOkHttpClient == null) {
mOkHttpInterceptor = new HttpInterceptor()
.addRequestInterceptor(new UserAgentInterceptor(
// TODO Try to get rid of this dependency
OwnCloudClientManagerFactory.getUserAgent()
)
);
mOkHttpClient = new OkHttpClient.Builder()
.addInterceptor(mOkHttpInterceptor)
.protocols(Arrays.asList(Protocol.HTTP_1_1))
@ -63,6 +56,14 @@ public class HttpClient {
}
public static HttpInterceptor getOkHttpInterceptor() {
if(mOkHttpInterceptor == null) {
mOkHttpInterceptor = new HttpInterceptor()
.addRequestInterceptor(new UserAgentInterceptor(
// TODO Try to get rid of this dependency
OwnCloudClientManagerFactory.getUserAgent()
)
);
}
return mOkHttpInterceptor;
}
}