Skip to content
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
7 changes: 4 additions & 3 deletions News-Android-App/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ repositories {
final DAGGER_VERSION = '2.57'
final GLIDE_VERSION = '4.16.0'
final ESPRESSO_VERSION = '3.7.0'
final OKHTTP_VERSION = '4.12.0'
final OKHTTP_VERSION = '5.3.2'
final MOCKITO_VERSION = '5.18.0'
final RETROFIT_VERSION = '3.0.0'

Expand All @@ -135,8 +135,9 @@ dependencies {
// implementation 'com.google.android.gms:play-services:4.2.42'
// implementation project(path: ':MaterialShowcaseView:library', configuration: 'default')
// implementation project(':Android-SingleSignOn:lib')
implementation 'com.github.nextcloud:Android-SingleSignOn:1.3.4'
implementation "androidx.core:core:1.16.0"
implementation 'com.github.nextcloud:Android-SingleSignOn:f401ec4'
// latest version which uses OKHTTP 5
implementation "androidx.core:core:1.17.0"
implementation 'androidx.annotation:annotation:1.9.1'
implementation "androidx.appcompat:appcompat:1.7.1"
implementation "androidx.preference:preference:1.2.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.internal.Util;
import okhttp3.logging.HttpLoggingInterceptor;

/**
Expand Down Expand Up @@ -115,27 +114,20 @@ private static X509TrustManager systemDefaultTrustManager() {
}
}

private static class AuthorizationInterceptor implements Interceptor {

private final String mCredentials;
private final HttpUrl mHostUrl;

AuthorizationInterceptor(HttpUrl hostUrl, String credentials) {
this.mHostUrl = hostUrl;
this.mCredentials = credentials;
}
private record AuthorizationInterceptor(HttpUrl mHostUrl,
String mCredentials) implements Interceptor {

@NonNull
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();

// only add Authorization header for urls on the configured owncloud/nextcloud host
if (mHostUrl.url().getHost().equals(request.url().host()))
request = request.newBuilder()
.addHeader("Authorization", mCredentials)
.build();
return chain.proceed(request);
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();

// only add Authorization header for urls on the configured owncloud/nextcloud host
if (mHostUrl.url().getHost().equals(request.url().host()))
request = request.newBuilder()
.addHeader("Authorization", mCredentials)
.build();
return chain.proceed(request);
}
}
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

ANDROID_BUILD_MIN_SDK_VERSION=21
ANDROID_BUILD_TARGET_SDK_VERSION=35
ANDROID_BUILD_SDK_VERSION=35
ANDROID_BUILD_SDK_VERSION=36
android.useAndroidX=true
android.enableJetifier=true
org.gradle.dependency.verification.console=verbose
Expand Down