diff --git a/app/src/main/java/io/legado/app/help/http/HttpHelper.kt b/app/src/main/java/io/legado/app/help/http/HttpHelper.kt index b01be8604..f612dea82 100644 --- a/app/src/main/java/io/legado/app/help/http/HttpHelper.kt +++ b/app/src/main/java/io/legado/app/help/http/HttpHelper.kt @@ -9,6 +9,7 @@ import java.util.* import java.util.concurrent.TimeUnit import kotlin.coroutines.resume +@Suppress("unused") object HttpHelper { val client: OkHttpClient by lazy { @@ -47,6 +48,15 @@ object HttpHelper { return null } + suspend fun simpleGetSync(url: String, encode: String? = null): String? { + NetworkUtils.getBaseUrl(url)?.let { baseUrl -> + val response = getApiService(baseUrl, encode) + .getAsync(url, mapOf()) + return response.body() + } + return null + } + inline fun getApiService(baseUrl: String, encode: String? = null): T { return getRetrofit(baseUrl, encode).create(T::class.java) }