Added handling for state with no connection

This commit is contained in:
Viktor De Pasquale
2019-10-06 12:06:09 +02:00
parent d35d1b8860
commit 5e01f785ae
4 changed files with 39 additions and 15 deletions

View File

@@ -54,6 +54,7 @@ class HomeViewModel(
}
override fun refresh() = repoMagisk.fetchUpdate()
.onErrorReturn { Info.remote }
.subscribeK { updateBy(it) }
private fun updateBy(info: UpdateInfo) {
@@ -64,7 +65,7 @@ class HomeViewModel(
}
stateManager.value = when {
!info.app.isUpdateChannelCorrect -> MagiskState.NOT_INSTALLED
!info.app.isUpdateChannelCorrect && isConnected.value -> MagiskState.NOT_INSTALLED
info.app.isObsolete -> MagiskState.OBSOLETE
else -> MagiskState.UP_TO_DATE
}