From 5ba5f5f94eebe57281f5d00fcdae8b02fc0503d7 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Wed, 7 Aug 2019 22:13:38 -0700 Subject: [PATCH] Observe network connnectivity Observe internet connectivity will ping google.com --- .../java/com/topjohnwu/magisk/ui/base/MagiskViewModel.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/base/MagiskViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/ui/base/MagiskViewModel.kt index f30d6aa4a..747481a33 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/base/MagiskViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/base/MagiskViewModel.kt @@ -6,6 +6,7 @@ import com.skoumal.teanity.extensions.doOnSubscribeUi import com.skoumal.teanity.extensions.subscribeK import com.skoumal.teanity.util.KObservableField import com.skoumal.teanity.viewmodel.LoadingViewModel +import com.topjohnwu.magisk.extensions.get import com.topjohnwu.magisk.model.events.BackPressEvent import com.topjohnwu.magisk.model.events.PermissionEvent import com.topjohnwu.magisk.model.events.ViewActionEvent @@ -18,8 +19,8 @@ abstract class MagiskViewModel : LoadingViewModel() { val isConnected = KObservableField(true) init { - ReactiveNetwork.observeInternetConnectivity() - .subscribeK { isConnected.value = it } + ReactiveNetwork.observeNetworkConnectivity(get()) + .subscribeK { isConnected.value = it.available() } .add() }