From b3f5f13c39ace3554396e084c7686e731db98141 Mon Sep 17 00:00:00 2001 From: arkon Date: Wed, 24 Jun 2020 18:07:29 -0400 Subject: [PATCH] Lazily instantiate Cloudflare client --- .../java/eu/kanade/tachiyomi/network/NetworkHelper.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/network/NetworkHelper.kt b/app/src/main/java/eu/kanade/tachiyomi/network/NetworkHelper.kt index 0420038d5..8cb5d3906 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/network/NetworkHelper.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/network/NetworkHelper.kt @@ -61,8 +61,10 @@ class NetworkHelper(context: Context) { builder.build() } - val cloudflareClient = client.newBuilder() - .addInterceptor(UserAgentInterceptor()) - .addInterceptor(CloudflareInterceptor(context)) - .build() + val cloudflareClient by lazy { + client.newBuilder() + .addInterceptor(UserAgentInterceptor()) + .addInterceptor(CloudflareInterceptor(context)) + .build() + } }