From ff5ec41e762c4c1c3c7f69f78e2fe11cd7c1e158 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Fri, 10 Apr 2020 18:53:28 +0300 Subject: [PATCH] http: haha content-encoding goes brrrr (enabled brotli compression) --- app/build.gradle | 1 + app/src/main/java/com/keylesspalace/tusky/util/OkHttpUtils.java | 2 ++ 2 files changed, 3 insertions(+) diff --git a/app/build.gradle b/app/build.gradle index 665544b6..092d50bd 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -149,6 +149,7 @@ dependencies { implementation "com.squareup.okhttp3:okhttp:$okhttpVersion" implementation "com.squareup.okhttp3:logging-interceptor:$okhttpVersion" + implementation "com.squareup.okhttp3:okhttp-brotli:$okhttpVersion" implementation "org.conscrypt:conscrypt-android:2.2.1" diff --git a/app/src/main/java/com/keylesspalace/tusky/util/OkHttpUtils.java b/app/src/main/java/com/keylesspalace/tusky/util/OkHttpUtils.java index ee2d35d0..b4adae55 100644 --- a/app/src/main/java/com/keylesspalace/tusky/util/OkHttpUtils.java +++ b/app/src/main/java/com/keylesspalace/tusky/util/OkHttpUtils.java @@ -32,6 +32,7 @@ import okhttp3.Cache; import okhttp3.Interceptor; import okhttp3.OkHttpClient; import okhttp3.Request; +import okhttp3.brotli.BrotliInterceptor; public class OkHttpUtils { @@ -54,6 +55,7 @@ public class OkHttpUtils { OkHttpClient.Builder builder = new OkHttpClient.Builder() .addInterceptor(getUserAgentInterceptor()) + .addInterceptor(BrotliInterceptor.INSTANCE) .readTimeout(30, TimeUnit.SECONDS) .writeTimeout(30, TimeUnit.SECONDS) .cache(new Cache(context.getCacheDir(), cacheSize));