CoroutinesHttp
CoroutinesHttp copied to clipboard
Deferred可能无法取消
https://github.com/JavaNoober/CoroutinesHttp/blob/8a05ead614667f29368f9196c8f182fffee18bf7/app/src/main/java/com/noober/coroutineshttp/coroutine/CoroutineChain.kt#L17 有可能activity销毁的时候,deferred.await()还没执行,导致deferred没法取消,可以去掉这个判断
Deferred<T>.then(onSuccess: suspend (T) -> Unit, onError: suspend (String) -> Unit, onComplete: (() -> Unit)? = null): Job 里使用GlobalScope.launch(context = Main) 这样回调不是从viewModelScope里逃逸了么?根据Google建议也是不应直接使用GlobalScope.launch。