Skip to content

Commit a267c03

Browse files
author
Yevhen Babiichuk (DustDFG)
committed
Test brotli
1 parent addf1e2 commit a267c03

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

app/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ ksp {
130130
arg("room.schemaLocation", "$projectDir/schemas")
131131
}
132132

133-
134133
// Custom dependency configuration for ktlint
135134
val ktlint by configurations.creating
136135

@@ -254,6 +253,7 @@ dependencies {
254253

255254
// HTTP client
256255
implementation(libs.squareup.okhttp)
256+
implementation(libs.squareup.okhttp.brotli)
257257

258258
// Media player
259259
implementation(libs.google.exoplayer.core)

app/src/main/java/org/schabi/newpipe/DownloaderImpl.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@
2323
import java.util.stream.Collectors;
2424
import java.util.stream.Stream;
2525

26+
import okhttp3.CompressionInterceptor;
27+
import okhttp3.Gzip;
2628
import okhttp3.OkHttpClient;
2729
import okhttp3.RequestBody;
2830
import okhttp3.ResponseBody;
31+
import okhttp3.brotli.Brotli;
2932

3033
public final class DownloaderImpl extends Downloader {
3134
public static final String USER_AGENT =
@@ -44,6 +47,9 @@ private DownloaderImpl(final OkHttpClient.Builder builder) {
4447
.readTimeout(30, TimeUnit.SECONDS)
4548
// .cache(new Cache(new File(context.getExternalCacheDir(), "okhttp"),
4649
// 16 * 1024 * 1024))
50+
.addInterceptor(new CompressionInterceptor(
51+
Brotli.INSTANCE,
52+
Gzip.INSTANCE))
4753
.build();
4854
this.mCookies = new HashMap<>();
4955
}

gradle/libs.versions.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ squareup-leakcanary-core = { module = "com.squareup.leakcanary:leakcanary-androi
127127
squareup-leakcanary-plumber = { module = "com.squareup.leakcanary:plumber-android", version.ref = "leakcanary" }
128128
squareup-leakcanary-watcher = { module = "com.squareup.leakcanary:leakcanary-object-watcher-android", version.ref = "leakcanary" }
129129
squareup-okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
130+
squareup-okhttp-brotli = { module = "com.squareup.okhttp3:okhttp-brotli", version.ref = "okhttp" }
130131
squareup-picasso = { module = "com.squareup.picasso:picasso", version.ref = "picasso" }
131132
zacsweers-autoservice-compiler = { module = "dev.zacsweers.autoservice:auto-service-ksp", version.ref = "autoservice-zacsweers" }
132133

0 commit comments

Comments
 (0)