From b1be4d7b767d17b5043a7f24544963ec0d012354 Mon Sep 17 00:00:00 2001 From: Jannis Mattheis Date: Sat, 7 Oct 2023 15:24:34 +0200 Subject: [PATCH] fix: remove probably unnecessary unregister When the refresh button is clicked in the navigation drawer, then startPushService is executed which registers the handler. The WebSocketService itself is reused, thus isn't created again or destroyed. From my tests the callback isn't registered twice after the refresh. Thus, I'd expect the unregister isn't needed at all because android somehow does this automagically. --- .../kotlin/com/github/gotify/service/WebSocketService.kt | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/src/main/kotlin/com/github/gotify/service/WebSocketService.kt b/app/src/main/kotlin/com/github/gotify/service/WebSocketService.kt index 8c0a5dbf..1084b234 100644 --- a/app/src/main/kotlin/com/github/gotify/service/WebSocketService.kt +++ b/app/src/main/kotlin/com/github/gotify/service/WebSocketService.kt @@ -5,7 +5,6 @@ import android.app.Notification import android.app.NotificationManager import android.app.PendingIntent import android.app.Service -import android.content.Context import android.content.Intent import android.graphics.Color import android.net.ConnectivityManager @@ -80,10 +79,6 @@ internal class WebSocketService : Service() { override fun onDestroy() { super.onDestroy() connection?.close() - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - (getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager) - .unregisterNetworkCallback(networkCallback) - } Logger.warn("Destroy ${javaClass.simpleName}") }