Skip to content

Commit

Permalink
Showing 2 changed files with 24 additions and 24 deletions.
44 changes: 22 additions & 22 deletions app/src/main/java/com/nextcloud/talk/dagger/modules/RestModule.java
Original file line number Diff line number Diff line change
@@ -92,7 +92,7 @@ NcApi provideNcApi(Retrofit retrofit) {
@Provides
Proxy provideProxy(AppPreferences appPreferences) {
if (!TextUtils.isEmpty(appPreferences.getProxyType()) && !"No proxy".equals(appPreferences.getProxyType())
&& !TextUtils.isEmpty(appPreferences.getProxyHost())) {
&& !TextUtils.isEmpty(appPreferences.getProxyHost())) {
GetProxyRunnable getProxyRunnable = new GetProxyRunnable(appPreferences);
Thread getProxyThread = new Thread(getProxyRunnable);
getProxyThread.start();
@@ -112,10 +112,10 @@ Proxy provideProxy(AppPreferences appPreferences) {
@Provides
Retrofit provideRetrofit(OkHttpClient httpClient) {
Retrofit.Builder retrofitBuilder = new Retrofit.Builder()
.client(httpClient)
.baseUrl("https://nextcloud.com")
.addCallAdapterFactory(RxJava2CallAdapterFactory.createWithScheduler(Schedulers.io()))
.addConverterFactory(LoganSquareConverterFactory.create());
.client(httpClient)
.baseUrl("https://nextcloud.com")
.addCallAdapterFactory(RxJava2CallAdapterFactory.createWithScheduler(Schedulers.io()))
.addConverterFactory(LoganSquareConverterFactory.create());

return retrofitBuilder.build();
}
@@ -208,13 +208,13 @@ OkHttpClient provideHttpClient(Proxy proxy, AppPreferences appPreferences,
httpClient.proxy(proxy);

if (appPreferences.getProxyCredentials() &&
!TextUtils.isEmpty(appPreferences.getProxyUsername()) &&
!TextUtils.isEmpty(appPreferences.getProxyPassword())) {
!TextUtils.isEmpty(appPreferences.getProxyUsername()) &&
!TextUtils.isEmpty(appPreferences.getProxyPassword())) {
httpClient.proxyAuthenticator(new HttpAuthenticator(
Credentials.basic(
appPreferences.getProxyUsername(),
appPreferences.getProxyPassword(),
StandardCharsets.UTF_8),
appPreferences.getProxyUsername(),
appPreferences.getProxyPassword(),
StandardCharsets.UTF_8),
"Proxy-Authorization"));
}
}
@@ -229,7 +229,7 @@ OkHttpClient provideHttpClient(Proxy proxy, AppPreferences appPreferences,
httpClient.addInterceptor(loggingInterceptor);
} else if (context.getResources().getBoolean(R.bool.nc_is_debug)) {
HttpLoggingInterceptor.Logger fileLogger =
s -> LoggingUtils.INSTANCE.writeLogEntryToFile(context, s);
s -> LoggingUtils.INSTANCE.writeLogEntryToFile(context, s);
HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(fileLogger);
loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
loggingInterceptor.redactHeader("Authorization");
@@ -247,11 +247,11 @@ public static class HeadersInterceptor implements Interceptor {
public Response intercept(@NonNull Chain chain) throws IOException {
Request original = chain.request();
Request request = original.newBuilder()
.header("User-Agent", ApiUtils.getUserAgent())
.header("Accept", "application/json")
.header("OCS-APIRequest", "true")
.method(original.method(), original.body())
.build();
.header("User-Agent", ApiUtils.getUserAgent())
.header("Accept", "application/json")
.header("OCS-APIRequest", "true")
.method(original.method(), original.body())
.build();

return chain.proceed(request);
}
@@ -286,8 +286,8 @@ public Request authenticate(@Nullable Route route, @NonNull Response response) {
}

return response.request().newBuilder()
.header(authenticatorType, credentials)
.build();
.header(authenticatorType, credentials)
.build();
}
}

@@ -303,12 +303,12 @@ private class GetProxyRunnable implements Runnable {
public void run() {
if (Proxy.Type.valueOf(appPreferences.getProxyType()) == Proxy.Type.SOCKS) {
proxy = new Proxy(Proxy.Type.valueOf(appPreferences.getProxyType()),
InetSocketAddress.createUnresolved(appPreferences.getProxyHost(), Integer.parseInt(
appPreferences.getProxyPort())));
InetSocketAddress.createUnresolved(appPreferences.getProxyHost(), Integer.parseInt(
appPreferences.getProxyPort())));
} else {
proxy = new Proxy(Proxy.Type.valueOf(appPreferences.getProxyType()),
new InetSocketAddress(appPreferences.getProxyHost(),
Integer.parseInt(appPreferences.getProxyPort())));
new InetSocketAddress(appPreferences.getProxyHost(),
Integer.parseInt(appPreferences.getProxyPort())));
}
}

4 changes: 2 additions & 2 deletions app/src/main/java/com/nextcloud/talk/utils/ApiUtils.java
Original file line number Diff line number Diff line change
@@ -61,8 +61,8 @@ public static String getUserAgent() {
}

/**
* @deprecated This is only supported on API v1-3, in API v4+ please use {@link ApiUtils#getUrlForAttendees(int,
* String, String)} instead.
* @deprecated This is only supported on API v1-3, in API v4+ please use
* {@link ApiUtils#getUrlForAttendees(int, String, String)} instead.
*/
@Deprecated
public static String getUrlForRemovingParticipantFromConversation(String baseUrl, String roomToken, boolean isGuest) {

0 comments on commit 0e3c24b

Please sign in to comment.