From d6b6368685588ac1e369c7b6073f39f20f39ac3f Mon Sep 17 00:00:00 2001 From: hawkff <109485367+hawkff@users.noreply.github.com> Date: Mon, 15 Jun 2026 14:58:44 -0400 Subject: [PATCH 1/2] build: update OkHttp 5.0.0-alpha.3 to 5.3.0 stable Move off the pre-release alpha to the current stable OkHttp 5.x line. 5.3.0 is the latest stable whose okhttp-android artifact still supports compileSdk 35 (5.4.0 requires minCompileSdk=36). The network-client API used (OkHttpClient, newCall/execute, Request.Builder, Credentials.basic, toMediaType/toRequestBody, HttpUrl) is stable across 5.x; no source changes. --- app/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 629f9fc5f..4d8d3fca2 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -65,7 +65,7 @@ dependencies { implementation("com.blacksquircle.ui:language-base:2.6.0") implementation("com.blacksquircle.ui:language-json:2.6.0") - implementation("com.squareup.okhttp3:okhttp:5.0.0-alpha.3") + implementation("com.squareup.okhttp3:okhttp:5.3.0") implementation("org.yaml:snakeyaml:2.3") implementation("com.github.daniel-stoneuk:material-about-library:3.2.0-rc01") implementation("com.jakewharton:process-phoenix:2.1.2") From 97efe892cac9a45addfbf77c36559a8d2277075f Mon Sep 17 00:00:00 2001 From: hawkff <109485367+hawkff@users.noreply.github.com> Date: Mon, 15 Jun 2026 14:58:45 -0400 Subject: [PATCH 2/2] refactor: replace okhttp3.internal.closeQuietly with local extension okhttp3.internal.closeQuietly is an unstable internal API. Replace it with a small private Closeable.closeQuietly() extension (same semantics) so the OkHttp upgrade path stays robust. --- .../sagernet/ui/ConfigurationFragment.kt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/nekohasekai/sagernet/ui/ConfigurationFragment.kt b/app/src/main/java/io/nekohasekai/sagernet/ui/ConfigurationFragment.kt index 13fb5eef5..60284a33b 100644 --- a/app/src/main/java/io/nekohasekai/sagernet/ui/ConfigurationFragment.kt +++ b/app/src/main/java/io/nekohasekai/sagernet/ui/ConfigurationFragment.kt @@ -116,7 +116,7 @@ import moe.matsuri.nb4a.proxy.anytls.AnyTLSSettingsActivity import moe.matsuri.nb4a.proxy.config.ConfigSettingActivity import moe.matsuri.nb4a.proxy.shadowtls.ShadowTLSSettingsActivity import moe.matsuri.nb4a.ui.ConnectionTestNotification -import okhttp3.internal.closeQuietly +import java.io.Closeable import java.net.InetSocketAddress import java.net.Socket import java.net.UnknownHostException @@ -2052,3 +2052,14 @@ class ConfigurationFragment @JvmOverloads constructor( } } + +/** + * Closes this resource, ignoring any exception. Replacement for OkHttp's internal + * `closeQuietly()` extension so we don't depend on an unstable `okhttp3.internal` API. + */ +private fun Closeable.closeQuietly() { + try { + close() + } catch (_: Exception) { + } +}