From 993efacf379bbb89b0aff6ce7d5bc05ebda62bd6 Mon Sep 17 00:00:00 2001 From: sim Date: Thu, 28 Nov 2024 15:20:54 +0000 Subject: [PATCH] Rename NetworkCallback --- .../NetworkCallback.kt} | 9 ++++++--- .../distributor/nextpush/services/StartService.kt | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) rename app/src/main/java/org/unifiedpush/distributor/nextpush/{services/RestartNetworkCallback.kt => callback/NetworkCallback.kt} (89%) diff --git a/app/src/main/java/org/unifiedpush/distributor/nextpush/services/RestartNetworkCallback.kt b/app/src/main/java/org/unifiedpush/distributor/nextpush/callback/NetworkCallback.kt similarity index 89% rename from app/src/main/java/org/unifiedpush/distributor/nextpush/services/RestartNetworkCallback.kt rename to app/src/main/java/org/unifiedpush/distributor/nextpush/callback/NetworkCallback.kt index b3fee65..381d281 100644 --- a/app/src/main/java/org/unifiedpush/distributor/nextpush/services/RestartNetworkCallback.kt +++ b/app/src/main/java/org/unifiedpush/distributor/nextpush/callback/NetworkCallback.kt @@ -1,4 +1,4 @@ -package org.unifiedpush.distributor.nextpush.services +package org.unifiedpush.distributor.nextpush.callback import android.app.Service import android.content.Context @@ -10,9 +10,12 @@ import java.lang.Exception import java.util.concurrent.atomic.AtomicBoolean import java.util.concurrent.atomic.AtomicReference import org.unifiedpush.distributor.nextpush.AppCompanion +import org.unifiedpush.distributor.nextpush.services.FailureHandler +import org.unifiedpush.distributor.nextpush.services.RegistrationCountCache +import org.unifiedpush.distributor.nextpush.services.RestartWorker import org.unifiedpush.distributor.nextpush.utils.TAG -class RestartNetworkCallback(val context: Context) : ConnectivityManager.NetworkCallback() { +class NetworkCallback(val context: Context) : ConnectivityManager.NetworkCallback() { private val connectivityManager: AtomicReference = AtomicReference(null) override fun onAvailable(network: Network) { @@ -73,7 +76,7 @@ class RestartNetworkCallback(val context: Context) : ConnectivityManager.Network context.getSystemService(Service.CONNECTIVITY_SERVICE) as ConnectivityManager ).apply { - registerDefaultNetworkCallback(this@RestartNetworkCallback) + registerDefaultNetworkCallback(this@NetworkCallback) } ) } catch (e: Exception) { diff --git a/app/src/main/java/org/unifiedpush/distributor/nextpush/services/StartService.kt b/app/src/main/java/org/unifiedpush/distributor/nextpush/services/StartService.kt index 06d0021..1411ea1 100644 --- a/app/src/main/java/org/unifiedpush/distributor/nextpush/services/StartService.kt +++ b/app/src/main/java/org/unifiedpush/distributor/nextpush/services/StartService.kt @@ -11,13 +11,14 @@ import org.unifiedpush.distributor.nextpush.AppCompanion import org.unifiedpush.distributor.nextpush.WakeLock import org.unifiedpush.distributor.nextpush.account.AccountFactory.getAccount import org.unifiedpush.distributor.nextpush.api.Api +import org.unifiedpush.distributor.nextpush.callback.NetworkCallback import org.unifiedpush.distributor.nextpush.utils.ForegroundNotification import org.unifiedpush.distributor.nextpush.utils.NOTIFICATION_ID_FOREGROUND import org.unifiedpush.distributor.nextpush.utils.TAG class StartService : Service() { - private val networkCallback = RestartNetworkCallback(this) + private val networkCallback = NetworkCallback(this) private var api: Api? = null override fun onBind(intent: Intent?): IBinder? {