Skip to content

done#265

Open
dmilkov97 wants to merge 7 commits intoOtus-Android:developmentfrom
dmilkov97:development
Open

done#265
dmilkov97 wants to merge 7 commits intoOtus-Android:developmentfrom
dmilkov97:development

Conversation

@dmilkov97
Copy link
Copy Markdown

No description provided.

override fun onFailure(call: Call<Fact>, t: Throwable) {
CrashMonitor.trackWarning()
catch (e: Exception) {
when (e) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

тут будет перехвачено CancellationException, что сломает механизм отмены корутин, нужно прокидывать его дальше
is CancellationException -> throw e

_result.value = Result.Success(fact)
}
catch (e: Exception) {
CrashMonitor.trackWarning(e)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

здесь тоже CancellationException

override fun onCleared() {
super.onCleared()
detachView()
viewModelScope.cancel()
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

viewModelScope сам отменится, это избыточно

private val catsService: CatsService,
private val catsServicePics: CatsServicePics
) : ViewModel() {
private var _catsView: ICatsView? = null
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

тут архитектурная проблема, ViewModel в отличие от Presenter ничего не знает о View и не должна хранить на нее ссылку, вью должна сама подписаться на стейты вьюмодели и обновлять свое состояние в соответствии с ними

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