From a6bf5d696c4ef7bb89ac901f7b699b55715a010e Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 8 May 2022 07:37:48 +0800 Subject: [PATCH] =?UTF-8?q?web=E6=9C=8D=E5=8A=A1=E7=9B=91=E6=B5=8B?= =?UTF-8?q?=E7=BD=91=E7=BB=9C=E5=8F=98=E5=8C=96,=E5=8F=8A=E6=97=B6?= =?UTF-8?q?=E6=9B=B4=E6=96=B0IP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/service/WebService.kt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/service/WebService.kt b/app/src/main/java/io/legado/app/service/WebService.kt index 6949a55d2..2b25c8d88 100644 --- a/app/src/main/java/io/legado/app/service/WebService.kt +++ b/app/src/main/java/io/legado/app/service/WebService.kt @@ -48,7 +48,17 @@ class WebService : BaseService() { upTile(true) networkChangedListener.register() networkChangedListener.onNetworkChanged = { - upWebServer() + val address = NetworkUtils.getLocalIPAddress() + if (address == null) { + hostAddress = getString(R.string.network_connection_unavailable) + notificationContent = hostAddress + upNotification() + } else { + hostAddress = getString(R.string.http_ip, address.hostAddress, getPort()) + notificationContent = hostAddress + upNotification() + } + postEvent(EventBus.WEB_SERVICE, hostAddress) } }