Lint
This commit is contained in:
parent
3e7900da61
commit
95270c0e44
|
@ -12,4 +12,4 @@ object AppCompanion {
|
|||
val bufferedResponseChecked = AtomicBoolean(false)
|
||||
val keepalive = AtomicInteger(900)
|
||||
var lastEventDate: Calendar? = null
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ class SSEListener(val context: Context) : EventSourceListener() {
|
|||
val timer: TimerTask? = if (
|
||||
!AppCompanion.bufferedResponseChecked.get() &&
|
||||
!AppCompanion.booting.getAndSet(false)
|
||||
) {
|
||||
) {
|
||||
Timer().schedule(45_000L /* 45secs */) {
|
||||
if (FailureHandler.newFail(context, eventSource)) {
|
||||
StartService.stopService()
|
||||
|
|
|
@ -15,6 +15,7 @@ object FailureHandler {
|
|||
private val ttlFails = AtomicInteger(0)
|
||||
private val nFails = AtomicInteger(0)
|
||||
private val nFailsBeforePing = AtomicInteger(0)
|
||||
|
||||
// This is the last eventSource opened
|
||||
private val eventSource: AtomicReference<EventSource?> = AtomicReference(null)
|
||||
|
||||
|
|
|
@ -50,11 +50,14 @@ class RestartNetworkCallback(val context: Context) : ConnectivityManager.Network
|
|||
} ?: run {
|
||||
Log.d(TAG, "Registering new ConnectivityManager")
|
||||
try {
|
||||
connectivityManager.set((
|
||||
context.getSystemService(Service.CONNECTIVITY_SERVICE) as ConnectivityManager
|
||||
).apply {
|
||||
registerDefaultNetworkCallback(this@RestartNetworkCallback)
|
||||
})
|
||||
connectivityManager.set(
|
||||
(
|
||||
context.getSystemService(Service.CONNECTIVITY_SERVICE)
|
||||
as ConnectivityManager
|
||||
).apply {
|
||||
registerDefaultNetworkCallback(this@RestartNetworkCallback)
|
||||
}
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ open class AppNotification(
|
|||
private val context: Context,
|
||||
private val notificationId: Int,
|
||||
private val notificationData: NotificationData,
|
||||
private val channelData: ChannelData,
|
||||
private val channelData: ChannelData
|
||||
) {
|
||||
private fun createNotificationChannel() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
|
@ -149,10 +149,10 @@ open class AppNotification(
|
|||
|
||||
private val Context.warningChannelData: ChannelData
|
||||
get() = ChannelData(
|
||||
"${this.getString(R.string.app_name)}.Warning",
|
||||
"Warning",
|
||||
NotificationManager.IMPORTANCE_HIGH,
|
||||
this.getString(R.string.warning_notif_description)
|
||||
"${this.getString(R.string.app_name)}.Warning",
|
||||
"Warning",
|
||||
NotificationManager.IMPORTANCE_HIGH,
|
||||
this.getString(R.string.warning_notif_description)
|
||||
)
|
||||
|
||||
class DisconnectedNotification(context: Context) : AppNotification(
|
||||
|
|
Loading…
Reference in New Issue