Skip to content
This repository was archived by the owner on Aug 7, 2024. It is now read-only.

Conversation

@davydenkokolya2
Copy link

No description provided.

@davydenkokolya2
Copy link
Author

Screenshot_2022-05-19-11-28-30-364_com github krottv tmstemp
Screenshot_2022-05-19-11-28-16-010_com github krottv tmstemp

class ITunesRemoteDataSourceRetrofit : MusicApi {

override suspend fun getAlbums(): List<AlbumModel> {
val retrofit = Retrofit.Builder()
Copy link
Owner

Choose a reason for hiding this comment

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

Плохой паттерн.

  1. Ретрофит это тяжёлый объект, каждый раз при вызове метода его создавать неправильно.
  2. "https://us-central1-inspiry-2ee60.cloudfunctions.net/" - это baseUrl. "getItunesAlbums" - это путь. Прописывается в MusicApi.

class ITunesMusicFragment : Fragment() {

lateinit var viewBinder: ITunesMusicFragmentBinder
private val viewModel: AlbumsViewModel by inject()
Copy link
Owner

Choose a reason for hiding this comment

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

by viewModel(). С inject нет сохранения данных при смене конфигурации.




runBlocking {
Copy link
Owner

Choose a reason for hiding this comment

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

На уроке обсуждали. Нужно создать coroutineScope, а не блокировать main поток.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants