diff --git a/app/build.gradle b/app/build.gradle index 3e1061d..804e69c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -87,8 +87,8 @@ dependencies { implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.2' implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2' - implementation 'androidx.navigation:navigation-fragment-ktx:2.7.4' - implementation 'androidx.navigation:navigation-ui-ktx:2.7.4' + implementation 'androidx.navigation:navigation-fragment-ktx:2.7.5' + implementation 'androidx.navigation:navigation-ui-ktx:2.7.5' implementation 'androidx.room:room-runtime:2.6.0' implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0' implementation 'androidx.preference:preference-ktx:1.2.1' @@ -132,7 +132,12 @@ if (playCredentialsJSON.exists()) { play { serviceAccountCredentials = playCredentialsJSON defaultToAppBundles = true - track = 'beta' + def version = getProps("VERSION_NAME") + if (version.contains("alpha") || version.contains("beta") || version.contains("rc")) { + track = 'beta' + } else { + track = 'production' + } } } diff --git a/app/src/main/java/io/nekohasekai/sfa/bg/VPNService.kt b/app/src/main/java/io/nekohasekai/sfa/bg/VPNService.kt index eeed596..175d963 100644 --- a/app/src/main/java/io/nekohasekai/sfa/bg/VPNService.kt +++ b/app/src/main/java/io/nekohasekai/sfa/bg/VPNService.kt @@ -5,8 +5,12 @@ import android.content.pm.PackageManager.NameNotFoundException import android.net.ProxyInfo import android.net.VpnService import android.os.Build +import android.os.IBinder import io.nekohasekai.libbox.TunOptions import io.nekohasekai.sfa.database.Settings +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.runBlocking +import kotlinx.coroutines.withContext class VPNService : VpnService(), PlatformInterfaceWrapper { @@ -19,13 +23,23 @@ class VPNService : VpnService(), PlatformInterfaceWrapper { override fun onStartCommand(intent: Intent?, flags: Int, startId: Int) = service.onStartCommand(intent, flags, startId) - override fun onBind(intent: Intent) = service.onBind(intent) + override fun onBind(intent: Intent): IBinder { + val binder = super.onBind(intent) + if (binder != null) { + return binder + } + return service.onBind(intent) + } override fun onDestroy() { service.onDestroy() } override fun onRevoke() { - service.onRevoke() + runBlocking { + withContext(Dispatchers.Main) { + service.onRevoke() + } + } } override fun autoDetectInterfaceControl(fd: Int) {