Rename NetworkCallback
This commit is contained in:
parent
a4ddd44e81
commit
993efacf37
|
@ -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<ConnectivityManager?> = 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) {
|
|
@ -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? {
|
||||
|
|
Loading…
Reference in New Issue