From 5b937fb1fa0e082c774f68b240a9e0c4689cc3d9 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Thu, 5 Sep 2019 11:36:48 -0400 Subject: [PATCH] Random changes --- .../topjohnwu/magisk/di/NetworkingModule.kt | 2 +- .../com/topjohnwu/magisk/tasks/RepoUpdater.kt | 22 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/com/topjohnwu/magisk/di/NetworkingModule.kt b/app/src/main/java/com/topjohnwu/magisk/di/NetworkingModule.kt index f47f0aaca..3824a0c97 100644 --- a/app/src/main/java/com/topjohnwu/magisk/di/NetworkingModule.kt +++ b/app/src/main/java/com/topjohnwu/magisk/di/NetworkingModule.kt @@ -28,7 +28,7 @@ fun createOkHttpClient(): OkHttpClient { if (BuildConfig.DEBUG) { val httpLoggingInterceptor = HttpLoggingInterceptor().apply { - level = HttpLoggingInterceptor.Level.BODY + level = HttpLoggingInterceptor.Level.HEADERS } builder.addInterceptor(httpLoggingInterceptor) } diff --git a/app/src/main/java/com/topjohnwu/magisk/tasks/RepoUpdater.kt b/app/src/main/java/com/topjohnwu/magisk/tasks/RepoUpdater.kt index fea0abef4..c3ba9cee3 100644 --- a/app/src/main/java/com/topjohnwu/magisk/tasks/RepoUpdater.kt +++ b/app/src/main/java/com/topjohnwu/magisk/tasks/RepoUpdater.kt @@ -38,21 +38,21 @@ class RepoUpdater( etag: String = "" ): Flowable = api.fetchRepos(page, etag).flatMap { it.error()?.also { throw it } - it.response()?.run { - if (code() == HttpURLConnection.HTTP_NOT_MODIFIED) - return@run Flowable.error(CachedException) + it.response()?.run { + if (code() == HttpURLConnection.HTTP_NOT_MODIFIED) + return@run Flowable.error(CachedException) - if (page == 1) - repoDB.etagKey = headers()[Const.Key.ETAG_KEY].orEmpty().trimEtag() + if (page == 1) + repoDB.etagKey = headers()[Const.Key.ETAG_KEY].orEmpty().trimEtag() - val flow = loadRepos(body()!!, cached) - if (headers()[Const.Key.LINK_KEY].orEmpty().contains("next")) { - flow.mergeWith(loadPage(cached, page + 1)) - } else { - flow - } + val flow = loadRepos(body()!!, cached) + if (headers()[Const.Key.LINK_KEY].orEmpty().contains("next")) { + flow.mergeWith(loadPage(cached, page + 1)) + } else { + flow } } + } private fun forcedReload(cached: MutableSet) = cached.toFlowable().parallel().runOn(Schedulers.io()).map {