From 7464497c8874e42e9bbfb9b080bd54d7d5fd8947 Mon Sep 17 00:00:00 2001 From: inorichi Date: Fri, 6 Apr 2018 10:02:01 +0200 Subject: [PATCH] Use our OkHttpClient in updates checker. It should fix the updater on KitKat due to TLS --- .../java/eu/kanade/tachiyomi/data/updater/GithubService.kt | 4 ++++ .../eu/kanade/tachiyomi/ui/setting/SettingsAboutController.kt | 1 + .../main/java/eu/kanade/tachiyomi/util/ContextExtensions.kt | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/updater/GithubService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/updater/GithubService.kt index 42ff97324..82befdc72 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/updater/GithubService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/updater/GithubService.kt @@ -1,10 +1,13 @@ package eu.kanade.tachiyomi.data.updater +import eu.kanade.tachiyomi.network.NetworkHelper import retrofit2.Retrofit import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory import retrofit2.converter.gson.GsonConverterFactory import retrofit2.http.GET import rx.Observable +import uy.kohesive.injekt.Injekt +import uy.kohesive.injekt.api.get /** * Used to connect with the Github API. @@ -17,6 +20,7 @@ interface GithubService { .baseUrl("https://api.github.com") .addConverterFactory(GsonConverterFactory.create()) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) + .client(Injekt.get().client) .build() return restAdapter.create(GithubService::class.java) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAboutController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAboutController.kt index b0c8ba74f..d36927b1f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAboutController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAboutController.kt @@ -126,6 +126,7 @@ class SettingsAboutController : SettingsController() { } } }, { error -> + activity?.toast(error.message) Timber.e(error) }) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/ContextExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/ContextExtensions.kt index 40ad41b55..75619dd78 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/ContextExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/ContextExtensions.kt @@ -36,7 +36,7 @@ fun Context.toast(@StringRes resource: Int, duration: Int = Toast.LENGTH_SHORT) * @param duration the duration of the toast. Defaults to short. */ fun Context.toast(text: String?, duration: Int = Toast.LENGTH_SHORT) { - Toast.makeText(this, text, duration).show() + Toast.makeText(this, text.orEmpty(), duration).show() } /**