From 0e2636068a1bb76e97b3591851f7381c4b5828b8 Mon Sep 17 00:00:00 2001 From: Administrator <1760316362@qq.com> Date: Mon, 8 Jul 2019 17:59:51 +0800 Subject: [PATCH] Coroutine timeout --- .../main/java/io/legado/app/help/coroutine/Coroutine.kt | 2 -- .../main/java/io/legado/app/ui/search/SearchViewModel.kt | 7 +------ 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/coroutine/Coroutine.kt b/app/src/main/java/io/legado/app/help/coroutine/Coroutine.kt index e56b9d2e9..fbb2cd873 100644 --- a/app/src/main/java/io/legado/app/help/coroutine/Coroutine.kt +++ b/app/src/main/java/io/legado/app/help/coroutine/Coroutine.kt @@ -1,6 +1,5 @@ package io.legado.app.help.coroutine -import android.util.Log import kotlinx.coroutines.* class Coroutine(scope: CoroutineScope, private val domain: suspend CoroutineScope.() -> T) { @@ -75,7 +74,6 @@ class Coroutine(scope: CoroutineScope, private val domain: suspend CoroutineS private suspend fun executeDomain(domain: suspend CoroutineScope.() -> T): T? { return withContext(Dispatchers.IO) { - Log.e("TAG!", "executeDomain") domain() } } diff --git a/app/src/main/java/io/legado/app/ui/search/SearchViewModel.kt b/app/src/main/java/io/legado/app/ui/search/SearchViewModel.kt index fb0364917..629497204 100644 --- a/app/src/main/java/io/legado/app/ui/search/SearchViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/search/SearchViewModel.kt @@ -5,12 +5,7 @@ import android.util.Log import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import io.legado.app.base.BaseViewModel -import io.legado.app.data.api.CommonHttpApi import io.legado.app.data.entities.SearchBook -import io.legado.app.help.http.HttpHelper -import kotlinx.coroutines.delay -import kotlinx.coroutines.withTimeout -import org.jetbrains.anko.error class SearchViewModel(application: Application) : BaseViewModel(application) { @@ -18,7 +13,7 @@ class SearchViewModel(application: Application) : BaseViewModel(application) { fun search(start: (() -> Unit)? = null, finally: (() -> Unit)? = null) { execute { -// val response: String = HttpHelper.getApiService( + // val response: String = HttpHelper.getApiService( // "http://www.baidu.com" // ).get("http://www.baidu.com").await() //