Skip to content
Open
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
5 changes: 5 additions & 0 deletions .changeset/brotli-compression.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@capawesome/capacitor-live-update': minor
---

feat(android): add brotli compression support to OkHttp client
Comment thread
robingenz marked this conversation as resolved.
2 changes: 1 addition & 1 deletion packages/live-update/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ android {

If needed, you can define the following project variable in your app’s `variables.gradle` file to change the default version of the dependency:

- `$okhttp3Version` version of `com.squareup.okhttp3:okhttp` (default: `5.3.2`)
- `$okhttp3Version` version of `com.squareup.okhttp3:okhttp` and `com.squareup.okhttp3:okhttp-brotli` (default: `5.3.2`)
- `$zip4jVersion` version of `net.lingala.zip4j:zip4j` (default: `2.11.5`)

This can be useful if you encounter dependency conflicts with other plugins in your project.
Expand Down
1 change: 1 addition & 0 deletions packages/live-update/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ dependencies {
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
implementation "net.lingala.zip4j:zip4j:$zip4jVersion"
implementation "com.squareup.okhttp3:okhttp:$okhttp3Version"
implementation "com.squareup.okhttp3:okhttp-brotli:$okhttp3Version"
testImplementation "junit:junit:$junitVersion"
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.ResponseBody;
import okhttp3.brotli.BrotliInterceptor;
import okio.Buffer;
import okio.BufferedSink;
import okio.BufferedSource;
Expand Down Expand Up @@ -58,6 +59,7 @@ public LiveUpdateHttpClient(@NonNull LiveUpdateConfig config) {
dispatcher.setMaxRequestsPerHost(30);

this.okHttpClient = new OkHttpClient.Builder()
.addInterceptor(BrotliInterceptor.INSTANCE)
Comment thread
robingenz marked this conversation as resolved.
.dispatcher(dispatcher)
.connectTimeout(httpTimeout, TimeUnit.MILLISECONDS)
.readTimeout(httpTimeout, TimeUnit.MILLISECONDS)
Expand Down
Loading