Skip to content

Commit 8930483

Browse files
committed
Fix Android stopped status and bump version to 0.1.10
1 parent 7147f8d commit 8930483

4 files changed

Lines changed: 23 additions & 5 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "linuxdo-accelerator"
3-
version = "0.1.9"
3+
version = "0.1.10"
44
edition = "2024"
55
build = "build.rs"
66
authors = ["fjh1997 <549308442@qq.com>"]

android/app/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ android {
2020
applicationId = "io.linuxdo.accelerator.android"
2121
minSdk = 28
2222
targetSdk = 35
23-
versionCode = 2
24-
versionName = "0.1.9-android"
23+
versionCode = 3
24+
versionName = "0.1.10-android"
2525
}
2626

2727
buildTypes {

android/app/src/main/java/io/linuxdo/accelerator/android/LinuxdoVpnService.kt

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ class LinuxdoVpnService : VpnService() {
6969
}
7070

7171
override fun onDestroy() {
72-
stopAccelerator("服务已销毁")
72+
if (running.get() || vpnInterface != null) {
73+
stopAccelerator("服务已销毁")
74+
}
7375
super.onDestroy()
7476
}
7577

@@ -356,6 +358,21 @@ class LinuxdoVpnService : VpnService() {
356358
return Triple(true, status, detail)
357359
}
358360

361+
if (!savedRunning && savedStatus == "服务已销毁") {
362+
val status = "已停止"
363+
val detail = if (savedDetail.isBlank()) {
364+
"Android VPN DNS 接管已关闭。"
365+
} else {
366+
savedDetail
367+
}
368+
prefs.edit()
369+
.putBoolean(PREF_RUNNING, false)
370+
.putString(PREF_STATUS, status)
371+
.putString(PREF_DETAIL, detail)
372+
.apply()
373+
return Triple(false, status, detail)
374+
}
375+
359376
if (!savedRunning) {
360377
return Triple(false, savedStatus, savedDetail)
361378
}

android/app/src/main/java/io/linuxdo/accelerator/android/MainActivity.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,10 @@ class MainActivity : AppCompatActivity() {
9999
super.onStart()
100100
registerStatusReceiver()
101101
val (running, status, detail) = LinuxdoVpnService.readCurrentStatus(this)
102+
val normalizedStatus = if (!running && status == "服务已销毁") "已停止" else status
102103
renderState(
103104
running,
104-
status,
105+
normalizedStatus,
105106
if (detail.isBlank()) {
106107
"配置文件和 Android 壳已就绪,点击开始加速后会申请 VPN 权限,并强制通过自定义 DoH 接管 linux.do 相关 DNS。"
107108
} else {

0 commit comments

Comments
 (0)