refactor: убрать мёртвый легаси-код и appcompat-зависимость

minSdk 24 делает мёртвыми deprecated-оверлоад WebViewClient и RequiresApi(N);
нормализация WG-транспорта и lint-подавление остались от старых альф.
Темы переведены на платформенный Material — appcompat больше не нужен.
This commit is contained in:
samosvalishe committed 2026-06-13 01:35:00 +03:00
1 parent 53d624f614
commit 4f6691fddf
8 files changed
+9 -35

No files matched your search

-5
View File
@@ -44,10 +44,6 @@ android {
} }
} }
lint {
disable += "ExpiredTargetSdkVersion"
}
compileOptions { compileOptions {
sourceCompatibility = JavaVersion.VERSION_17 sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17
@@ -70,7 +66,6 @@ dependencies {
implementation(libs.wireguard.tunnel) implementation(libs.wireguard.tunnel)
implementation(libs.androidx.core.ktx) implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.androidx.activity.compose) implementation(libs.androidx.activity.compose)
implementation(libs.androidx.datastore.preferences) implementation(libs.androidx.datastore.preferences)
implementation(libs.androidx.navigation.compose) implementation(libs.androidx.navigation.compose)
-1
View File
@@ -40,7 +40,6 @@
android:label="FreeTurn" android:label="FreeTurn"
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:extractNativeLibs="true"
android:networkSecurityConfig="@xml/network_security_config" android:networkSecurityConfig="@xml/network_security_config"
android:theme="@style/Theme.FreeTurn" android:theme="@style/Theme.FreeTurn"
android:enableOnBackInvokedCallback="true" android:enableOnBackInvokedCallback="true"
@@ -9,10 +9,7 @@ import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.cancel import kotlinx.coroutines.cancel
import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.onEach
import android.os.Build
import androidx.annotation.RequiresApi
@RequiresApi(Build.VERSION_CODES.N)
class ProxyTileService : TileService() { class ProxyTileService : TileService() {
private var scope: CoroutineScope? = null private var scope: CoroutineScope? = null
@@ -146,10 +146,7 @@ internal object ServerJson {
magicSwitch = cliO.optBoolean("magicSwitch", false), magicSwitch = cliO.optBoolean("magicSwitch", false),
magicTurn = cliO.optString("magicTurn"), magicTurn = cliO.optString("magicTurn"),
tunnelTransport = cliO.optString("tunnelTransport", TunnelTransport.NONE).let { tunnelTransport = cliO.optString("tunnelTransport", TunnelTransport.NONE).let {
val t = if (it in TunnelTransport.PERSISTED) it else TunnelTransport.NONE if (it in TunnelTransport.PERSISTED) it else TunnelTransport.NONE
// Legacy: WIREGUARD c пустым конфигом = туннель не выбран → NONE (proxy).
if (t == TunnelTransport.WIREGUARD && cliO.optString("wireGuardConfig").isBlank())
TunnelTransport.NONE else t
}, },
wireGuardConfig = cliO.optString("wireGuardConfig"), wireGuardConfig = cliO.optString("wireGuardConfig"),
wireGuardTunnelName = cliO.optString("wireGuardTunnelName").ifBlank { TunnelTransport.DEFAULT_TUNNEL_NAME }, wireGuardTunnelName = cliO.optString("wireGuardTunnelName").ifBlank { TunnelTransport.DEFAULT_TUNNEL_NAME },
@@ -34,7 +34,6 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.viewinterop.AndroidView import androidx.compose.ui.viewinterop.AndroidView
import androidx.compose.ui.window.Dialog import androidx.compose.ui.window.Dialog
import androidx.compose.ui.window.DialogProperties import androidx.compose.ui.window.DialogProperties
import androidx.core.net.toUri
import com.freeturn.app.R import com.freeturn.app.R
/** Разрешённые схемы для топ-навигации внутри капча-WebView. */ /** Разрешённые схемы для топ-навигации внутри капча-WebView. */
@@ -134,13 +133,6 @@ fun CaptchaWebViewDialog(
return scheme !in ALLOWED_SCHEMES return scheme !in ALLOWED_SCHEMES
} }
@Deprecated("API < 24")
@Suppress("DEPRECATION", "OVERRIDE_DEPRECATION")
override fun shouldOverrideUrlLoading(view: WebView?, url: String?): Boolean {
val scheme = url?.toUri()?.scheme?.lowercase()
return scheme !in ALLOWED_SCHEMES
}
override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) { override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) {
super.onPageStarted(view, url, favicon) super.onPageStarted(view, url, favicon)
isLoading = true isLoading = true
+3 -6
View File
@@ -1,9 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools"> <resources>
<!-- Base application theme. --> <!-- Тёмная половина ручного DayNight (см. values/themes.xml). -->
<style name="Base.Theme.FreeTurn" parent="Theme.AppCompat.DayNight.NoActionBar"> <style name="Base.Theme.FreeTurn" parent="android:Theme.Material.NoActionBar" />
<!-- Customize your dark theme here. -->
<!-- <item name="colorPrimary">@color/my_dark_primary</item> -->
</style>
<!-- Splash screen theme (Core Splash Screen API) — dark variant --> <!-- Splash screen theme (Core Splash Screen API) — dark variant -->
<style name="Theme.FreeTurn.Splash" parent="Theme.SplashScreen"> <style name="Theme.FreeTurn.Splash" parent="Theme.SplashScreen">
+5 -6
View File
@@ -1,9 +1,8 @@
<resources xmlns:tools="http://schemas.android.com/tools"> <resources>
<!-- Base application theme. --> <!-- Окно видно миллисекунды до setContent — Compose рисует поверх.
<style name="Base.Theme.FreeTurn" parent="Theme.AppCompat.DayNight.NoActionBar"> Платформенная тема вместо AppCompat: DayNight собран вручную
<!-- Customize your light theme here. --> через values-night, appcompat-зависимость не нужна. -->
<!-- <item name="colorPrimary">@color/my_light_primary</item> --> <style name="Base.Theme.FreeTurn" parent="android:Theme.Material.Light.NoActionBar" />
</style>
<style name="Theme.FreeTurn" parent="Base.Theme.FreeTurn" /> <style name="Theme.FreeTurn" parent="Base.Theme.FreeTurn" />
-2
View File
@@ -2,7 +2,6 @@
agp = "9.1.1" agp = "9.1.1"
kotlin = "2.3.21" kotlin = "2.3.21"
coreKtx = "1.18.0" coreKtx = "1.18.0"
appcompat = "1.7.1"
activity = "1.13.0" activity = "1.13.0"
composeBom = "2026.05.01" composeBom = "2026.05.01"
material3 = "1.5.0-alpha20" material3 = "1.5.0-alpha20"
@@ -24,7 +23,6 @@ orgJson = "20250517"
[libraries] [libraries]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" } androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activity" } androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activity" }
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" } androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" }
androidx-compose-ui = { group = "androidx.compose.ui", name = "ui" } androidx-compose-ui = { group = "androidx.compose.ui", name = "ui" }