Update ConnectivityManagerNetworkMonitor.kt

pull/716/head
Simon Marquis 2 years ago committed by GitHub
parent 76c249a651
commit def5c4e881
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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

Loading…
Cancel
Save