mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-24 02:25:28 +00:00
Random changes
This commit is contained in:
parent
ff828116bc
commit
5b937fb1fa
@ -28,7 +28,7 @@ fun createOkHttpClient(): OkHttpClient {
|
|||||||
|
|
||||||
if (BuildConfig.DEBUG) {
|
if (BuildConfig.DEBUG) {
|
||||||
val httpLoggingInterceptor = HttpLoggingInterceptor().apply {
|
val httpLoggingInterceptor = HttpLoggingInterceptor().apply {
|
||||||
level = HttpLoggingInterceptor.Level.BODY
|
level = HttpLoggingInterceptor.Level.HEADERS
|
||||||
}
|
}
|
||||||
builder.addInterceptor(httpLoggingInterceptor)
|
builder.addInterceptor(httpLoggingInterceptor)
|
||||||
}
|
}
|
||||||
|
@ -38,21 +38,21 @@ class RepoUpdater(
|
|||||||
etag: String = ""
|
etag: String = ""
|
||||||
): Flowable<Unit> = api.fetchRepos(page, etag).flatMap {
|
): Flowable<Unit> = api.fetchRepos(page, etag).flatMap {
|
||||||
it.error()?.also { throw it }
|
it.error()?.also { throw it }
|
||||||
it.response()?.run {
|
it.response()?.run {
|
||||||
if (code() == HttpURLConnection.HTTP_NOT_MODIFIED)
|
if (code() == HttpURLConnection.HTTP_NOT_MODIFIED)
|
||||||
return@run Flowable.error<Unit>(CachedException)
|
return@run Flowable.error<Unit>(CachedException)
|
||||||
|
|
||||||
if (page == 1)
|
if (page == 1)
|
||||||
repoDB.etagKey = headers()[Const.Key.ETAG_KEY].orEmpty().trimEtag()
|
repoDB.etagKey = headers()[Const.Key.ETAG_KEY].orEmpty().trimEtag()
|
||||||
|
|
||||||
val flow = loadRepos(body()!!, cached)
|
val flow = loadRepos(body()!!, cached)
|
||||||
if (headers()[Const.Key.LINK_KEY].orEmpty().contains("next")) {
|
if (headers()[Const.Key.LINK_KEY].orEmpty().contains("next")) {
|
||||||
flow.mergeWith(loadPage(cached, page + 1))
|
flow.mergeWith(loadPage(cached, page + 1))
|
||||||
} else {
|
} else {
|
||||||
flow
|
flow
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun forcedReload(cached: MutableSet<String>) =
|
private fun forcedReload(cached: MutableSet<String>) =
|
||||||
cached.toFlowable().parallel().runOn(Schedulers.io()).map {
|
cached.toFlowable().parallel().runOn(Schedulers.io()).map {
|
||||||
|
Loading…
Reference in New Issue
Block a user