|
|
@ -37,11 +37,11 @@ class ConnectivityManagerNetworkMonitor @Inject constructor(
|
|
|
|
) : NetworkMonitor {
|
|
|
|
) : NetworkMonitor {
|
|
|
|
override val isOnline: Flow<Boolean> = callbackFlow {
|
|
|
|
override val isOnline: Flow<Boolean> = callbackFlow {
|
|
|
|
val connectivityManager = context.getSystemService<ConnectivityManager>()
|
|
|
|
val connectivityManager = context.getSystemService<ConnectivityManager>()
|
|
|
|
?: run {
|
|
|
|
?: run {
|
|
|
|
channel.trySend(false)
|
|
|
|
channel.trySend(false)
|
|
|
|
channel.close()
|
|
|
|
channel.close()
|
|
|
|
return@callbackFlow
|
|
|
|
return@callbackFlow
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* The callback's methods are invoked on changes to *any* network, not just the active
|
|
|
|
* The callback's methods are invoked on changes to *any* network, not just the active
|
|
|
|