Skip to content

Conversation

sergeyolshanov
Copy link

No description provided.

Copy link
Contributor

@antonkazakov antonkazakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Привет. Оставил пару замечаний

override fun onStop() {
if (isFinishing) {
catsPresenter.detachView()
CoroutineScope(Dispatchers.Main).launch {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А зачем здесь корутина?

interface ImageCatsService {

@GET("meow")
suspend fun getCatImage(): Response<CatImage>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А зачем тебе Response, можно оставить просто CatImage, если будет неуспешный статус то тебе дефолтный КоллАдаптер выбросит исключение

fun onInitComplete() {
presenterScope.launch {
try {
val response = catsService.getCatFact()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

У тебя тут последовательные запросы, нужно корутины запустить


private suspend fun onInitCompleteResponse(): Result<FactAndImageModel> {
return try {
val response = catsService.getCatFact()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Также последовательные запросы

Copy link
Contributor

@antonkazakov antonkazakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants