Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ok_http] Caching Configuration #1313

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
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
6 changes: 3 additions & 3 deletions pkgs/ok_http/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ android {
}

kotlinOptions {
jvmTarget = '1.8'
jvmTarget = '17'
}

sourceSets {
Expand All @@ -52,8 +52,8 @@ android {
ndkVersion = android.ndkVersion

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

defaultConfig {
Expand Down
4 changes: 2 additions & 2 deletions pkgs/ok_http/example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ android {
ndkVersion = flutter.ndkVersion

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

defaultConfig {
Expand Down
4 changes: 3 additions & 1 deletion pkgs/ok_http/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ import 'book.dart';
void main() {
final Client httpClient;
if (Platform.isAndroid) {
httpClient = OkHttpClient();
httpClient = OkHttpClient(
configuration:
const OkHttpClientConfiguration(cacheSize: 10 * 1024 * 1024));
} else {
httpClient = IOClient(HttpClient()..userAgent = 'Book Agent');
}
Expand Down
13 changes: 13 additions & 0 deletions pkgs/ok_http/jnigen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ classes:
- "okio.ByteString"
- "com.example.ok_http.WebSocketInterceptor"
- "java.util.concurrent.TimeUnit"
- "okhttp3.Cache"
- "okhttp3.CacheControl"
- "java.io.File"

# Exclude the deprecated methods listed below
# They cause syntax errors during the `dart format` step of JNIGen.
Expand Down Expand Up @@ -105,6 +108,16 @@ exclude:
- 'okio.ByteString\$Companion#-deprecated_read'
- "okio.ByteString#-deprecated_getByte"
- "okio.ByteString#-deprecated_size"
- "okhttp3.CacheControl#-deprecated_noCache"
- "okhttp3.CacheControl#-deprecated_noStore"
- "okhttp3.CacheControl#-deprecated_maxAgeSeconds"
- "okhttp3.CacheControl#-deprecated_sMaxAgeSeconds"
- "okhttp3.CacheControl#-deprecated_mustRevalidate"
- "okhttp3.CacheControl#-deprecated_maxStaleSeconds"
- "okhttp3.CacheControl#-deprecated_minFreshSeconds"
- "okhttp3.CacheControl#-deprecated_onlyIfCached"
- "okhttp3.CacheControl#-deprecated_noTransform"
- "okhttp3.CacheControl#-deprecated_immutable"

preamble: |
// ignore_for_file: prefer_expression_function_bodies
Loading
Loading