#34 Change use of deprecated NetworkInfo enhancement (#38)

* replace NetworkInto with the ConnectivityManager. Since this network validation is being done at repository level, I've had to add the network dependency on it's own AndroidManifest.

* moved network_state_permission from repository manifest to app's manifest.
removed wildcard imports.
now, network_info it's been provided and not the connectivity_manager
This commit is contained in:
Victor Vicari
2019-09-24 11:04:02 -03:00
committed by Melih Aksoy
parent 9aa7a5b25f
commit 8344e7f94b
3 changed files with 8 additions and 3 deletions

View File

@@ -14,6 +14,10 @@ class CoreModule {
fun proivdeAppContext(app: Application): Context = app.applicationContext
@Provides
fun provideNetworkInfo(app: Application): NetworkInfo? =
(app.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager).activeNetworkInfo
fun provideNetworkInfo(app: Application): NetworkInfo? {
val connectivityManager =
app.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
return connectivityManager.activeNetworkInfo
}
}