This repository contains simple COVID19 data monitoring with android stack MVVM, Live Data, Koin, RxJava, RxBinding, Offline first with simple caching, etc
@rizmaulana Hello, if need to display a prompt when there is no network connection or the request times out, how can I use responseToResult to make all network requests display prompt information under these circumstances?
fun <T> Observable<T>.responseToResult(): Observable<Result<T>> {
return map { it.asResult() }
.onErrorReturn {
when (it) {
is HttpException,
is SocketTimeoutException,
is UnknownHostException -> {
it.asErrorResult()
}
else -> throw it
}
}
}
@rizmaulana Hello, if need to display a prompt when there is no network connection or the request times out, how can I use responseToResult to make all network requests display prompt information under these circumstances?