feat: поддержка Android 6.0+ (minSdk 23)

This commit is contained in:
samosvalishe committed 2026-04-10 13:18:56 +03:00
1 parent a6a4361334
commit ba52490b06
8 files changed
+43 -5

No files matched your search

+1 -1
View File
@@ -29,7 +29,7 @@ Android-клиент для [vk-turn-proxy](https://github.com/cacggghp/vk-turn-
## Требования ## Требования
- Android 8.0+ (API 26) - Android 6.0+ (API 23)
- ARM64-устройство (arm64-v8a) - ARM64-устройство (arm64-v8a)
- VPS с установленным WireGuard или Hysteria - VPS с установленным WireGuard или Hysteria
- Ссылка на VK Звонок - Ссылка на VK Звонок
+1 -1
View File
@@ -9,7 +9,7 @@ android {
defaultConfig { defaultConfig {
applicationId = "com.freeturn.app" applicationId = "com.freeturn.app"
minSdk = 26 minSdk = 23
targetSdk = 36 targetSdk = 36
versionCode = 13 versionCode = 13
versionName = "1.7.0" versionName = "1.7.0"
+2 -1
View File
@@ -41,7 +41,8 @@
<service <service
android:name=".ProxyService" android:name=".ProxyService"
android:exported="false" android:exported="false"
android:foregroundServiceType="specialUse"> android:foregroundServiceType="specialUse"
tools:targetApi="29">
<!-- <!--
Обязательное свойство для foregroundServiceType="specialUse". Обязательное свойство для foregroundServiceType="specialUse".
Без него Google Play отклоняет приложение. Без него Google Play отклоняет приложение.
@@ -3,6 +3,7 @@ package com.freeturn.app
import android.content.BroadcastReceiver import android.content.BroadcastReceiver
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.os.Build
class ProxyReceiver : BroadcastReceiver() { class ProxyReceiver : BroadcastReceiver() {
@@ -12,7 +13,11 @@ class ProxyReceiver : BroadcastReceiver() {
ProxyServiceState.clearLogs() ProxyServiceState.clearLogs()
ProxyServiceState.setStartupResult(null) ProxyServiceState.setStartupResult(null)
val serviceIntent = Intent(context, ProxyService::class.java) val serviceIntent = Intent(context, ProxyService::class.java)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
context.startForegroundService(serviceIntent) context.startForegroundService(serviceIntent)
} else {
context.startService(serviceIntent)
}
} }
"com.freeturn.app.STOP_PROXY" -> { "com.freeturn.app.STOP_PROXY" -> {
val serviceIntent = Intent(context, ProxyService::class.java) val serviceIntent = Intent(context, ProxyService::class.java)
@@ -3,6 +3,7 @@ package com.freeturn.app.domain
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.net.Uri import android.net.Uri
import android.os.Build
import com.freeturn.app.ProxyService import com.freeturn.app.ProxyService
import com.freeturn.app.ProxyServiceState import com.freeturn.app.ProxyServiceState
import com.freeturn.app.StartupResult import com.freeturn.app.StartupResult
@@ -87,7 +88,12 @@ class LocalProxyManager(private val context: Context) {
ProxyServiceState.clearLogs() ProxyServiceState.clearLogs()
ProxyServiceState.setStartupResult(null) ProxyServiceState.setStartupResult(null)
context.startForegroundService(Intent(context, ProxyService::class.java)) val intent = Intent(context, ProxyService::class.java)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
context.startForegroundService(intent)
} else {
context.startService(intent)
}
val result = withTimeoutOrNull(5_000L) { val result = withTimeoutOrNull(5_000L) {
ProxyServiceState.startupResult.filterNotNull().first() ProxyServiceState.startupResult.filterNotNull().first()
@@ -1,6 +1,7 @@
package com.freeturn.app.ui package com.freeturn.app.ui
import android.content.Context import android.content.Context
import android.os.Build
import android.os.VibrationEffect import android.os.VibrationEffect
import android.os.Vibrator import android.os.Vibrator
@@ -28,8 +29,10 @@ object HapticUtil {
LAUNCH, LAUNCH,
} }
@Suppress("DEPRECATION")
fun perform(context: Context, pattern: Pattern) { fun perform(context: Context, pattern: Pattern) {
val vibrator = context.getSystemService(Vibrator::class.java) ?: return val vibrator = context.getSystemService(Vibrator::class.java) ?: return
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val effect = when (pattern) { val effect = when (pattern) {
Pattern.SELECTION -> VibrationEffect.createOneShot(20, 120) Pattern.SELECTION -> VibrationEffect.createOneShot(20, 120)
@@ -82,6 +85,17 @@ object HapticUtil {
-1 -1
) )
} }
try { vibrator.vibrate(effect) } catch(_: Exception) {} try { vibrator.vibrate(effect) } catch (_: Exception) {}
} else {
val duration = when (pattern) {
Pattern.SELECTION -> 20L
Pattern.CLICK -> 25L
Pattern.TOGGLE_ON, Pattern.TOGGLE_OFF -> 50L
Pattern.SUCCESS -> 60L
Pattern.ERROR -> 100L
Pattern.LAUNCH -> 70L
}
try { vibrator.vibrate(duration) } catch (_: Exception) {}
}
} }
} }
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
<monochrome android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
<monochrome android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>