gedoor 4 лет назад
Родитель
Сommit
627aa38b49
1 измененных файлов с 9 добавлено и 9 удалено
  1. 9 9
      app/src/main/java/io/legado/app/service/WebService.kt

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

@@ -44,6 +44,15 @@ class WebService : BaseService() {
         upTile(true)
         upTile(true)
     }
     }
 
 
+    override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
+        when (intent?.action) {
+            IntentAction.stop -> stopSelf()
+            "copyHostAddress" -> sendToClip(hostAddress)
+            else -> upWebServer()
+        }
+        return super.onStartCommand(intent, flags, startId)
+    }
+
     override fun onDestroy() {
     override fun onDestroy() {
         super.onDestroy()
         super.onDestroy()
         isRun = false
         isRun = false
@@ -57,15 +66,6 @@ class WebService : BaseService() {
         upTile(false)
         upTile(false)
     }
     }
 
 
-    override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
-        when (intent?.action) {
-            IntentAction.stop -> stopSelf()
-            "copyHostAddress" -> sendToClip(hostAddress)
-            else -> upWebServer()
-        }
-        return super.onStartCommand(intent, flags, startId)
-    }
-
     private fun upWebServer() {
     private fun upWebServer() {
         if (httpServer?.isAlive == true) {
         if (httpServer?.isAlive == true) {
             httpServer?.stop()
             httpServer?.stop()