Răsfoiți Sursa

fix:修复自动开启web服务失效

@woruteyqi @贡献者
Kudomaga 4 luni în urmă
părinte
comite
6a06aa9551

+ 1 - 1
app/src/main/java/io/legado/app/help/config/AppConfig.kt

@@ -85,7 +85,7 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener {
             ReadConfig.optimizeRender = value
             ReadConfig.optimizeRender = value
         }
         }
     val recordLog get() = OtherConfig.recordLog
     val recordLog get() = OtherConfig.recordLog
-    var webServiceAutoStart = appCtx.getPrefBoolean(PreferKey.webServiceAutoStart, false)
+    val webServiceAutoStart get() = OtherConfig.webServiceAutoStart
 
 
     // -- lyc 版本特性 --
     // -- lyc 版本特性 --
     val adaptSpecialStyle get() = ReadConfig.adaptSpecialStyle
     val adaptSpecialStyle get() = ReadConfig.adaptSpecialStyle

+ 2 - 1
app/src/main/java/io/legado/app/service/WebService.kt

@@ -16,6 +16,7 @@ import io.legado.app.constant.IntentAction
 import io.legado.app.constant.NotificationId
 import io.legado.app.constant.NotificationId
 import io.legado.app.constant.PreferKey
 import io.legado.app.constant.PreferKey
 import io.legado.app.receiver.NetworkChangedListener
 import io.legado.app.receiver.NetworkChangedListener
+import io.legado.app.ui.config.otherConfig.OtherConfig
 import io.legado.app.utils.NetworkUtils
 import io.legado.app.utils.NetworkUtils
 import io.legado.app.utils.eventBus.FlowEventBus
 import io.legado.app.utils.eventBus.FlowEventBus
 import io.legado.app.utils.getPrefBoolean
 import io.legado.app.utils.getPrefBoolean
@@ -118,7 +119,7 @@ class WebService : BaseService() {
         when (intent?.action) {
         when (intent?.action) {
             IntentAction.stop -> {
             IntentAction.stop -> {
                 // ——————【修改开始】通知栏点击停止时,也记录关闭状态——————
                 // ——————【修改开始】通知栏点击停止时,也记录关闭状态——————
-                appCtx.putPrefBoolean("web_service_auto", false)
+                OtherConfig.webServiceAutoStart = false
                 stopSelf()
                 stopSelf()
                 // ——————【修改结束】——————
                 // ——————【修改结束】——————
             }
             }