Update core

This commit is contained in:
problematicconsumer
2023-10-13 15:07:36 +03:30
parent ac55b28d74
commit 505e05061a
5 changed files with 15 additions and 5 deletions

View File

@@ -91,7 +91,7 @@ class MethodHandler : FlutterPlugin, MethodChannel.MethodCallHandler {
if (restart) { if (restart) {
mainActivity.reconnect() mainActivity.reconnect()
BoxService.stop() BoxService.stop()
delay(200) delay(200L)
mainActivity.startService() mainActivity.startService()
success(true) success(true)
return@launch return@launch

View File

@@ -29,6 +29,7 @@ import io.nekohasekai.libbox.SystemProxyStatus
import io.nekohasekai.mobile.Mobile import io.nekohasekai.mobile.Mobile
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
@@ -133,7 +134,7 @@ class BoxService(
this.commandServer = commandServer this.commandServer = commandServer
} }
private suspend fun startService() { private suspend fun startService(delayStart: Boolean = false) {
try { try {
Log.d(TAG, "starting service") Log.d(TAG, "starting service")
@@ -178,6 +179,10 @@ class BoxService(
return return
} }
if (delayStart) {
delay(200L)
}
newService.start() newService.start()
boxService = newService boxService = newService
commandServer?.setService(boxService) commandServer?.setService(boxService)
@@ -206,7 +211,7 @@ class BoxService(
Seq.destroyRef(refnum) Seq.destroyRef(refnum)
} }
boxService = null boxService = null
startService() startService(true)
} }
} }

View File

@@ -32,6 +32,7 @@ open class CommandClient(
fun onDisconnected() {} fun onDisconnected() {}
fun updateStatus(status: StatusMessage) {} fun updateStatus(status: StatusMessage) {}
fun updateGroups(groups: List<OutboundGroup>) {} fun updateGroups(groups: List<OutboundGroup>) {}
fun clearLog() {}
fun appendLog(message: String) {} fun appendLog(message: String) {}
fun initializeClashMode(modeList: List<String>, currentMode: String) {} fun initializeClashMode(modeList: List<String>, currentMode: String) {}
fun updateClashMode(newMode: String) {} fun updateClashMode(newMode: String) {}
@@ -106,6 +107,10 @@ open class CommandClient(
handler.updateGroups(groups) handler.updateGroups(groups)
} }
override fun clearLog() {
handler.clearLog()
}
override fun writeLog(message: String?) { override fun writeLog(message: String?) {
if (message == null) { if (message == null) {
return return

View File

@@ -1 +1 @@
core.version=0.5.3 core.version=0.6.1

Submodule libcore updated: b36fab34ec...ac0eddc583