DON'T Use Android Dependencies in Domain

preview_player
Показать описание

Комментарии
Автор

I've already know that but when you said that we can use this domain code for other platforms, it made me consider using Koin instead of dagger.

Alchemist
Автор

Good luck avoiding the use of paging 3 library in the domain layer.

thanosfisherman
Автор

First, you can unit test classes that use Context with Robolectic.
Second, I don't know a single real case when reusing an existing domain layer would be required. Unless you start to develop a cross-platform from the beginning, it's highly unlikely you will try to do this trick with the domain layer later. Too much effort is needed to keep the domain layer "pure" to the level for it to be sufficient to be used on another platform.

bringoff
Автор

But in google examples they use withcontext and the dispatcher in the usecases themselves

MrSN
Автор

is this ability to move your domain layer to some other project is so necessary? in my humble experience i never saw example of this kind

glywyui
Автор

On my usecases I'm just creating single file for crud operation of each entity is it a bad idea? Or it should be single file for each operation. I saw one in your tutorial you are using invoke function. Sorry for my English.

edgardorodriguez
Автор

So what if I for example have 2 use cases: one for storing the image and second for attaching the stored image URI to an email and starting a new email intent? Both use cases require context. So they shouldnt be use cases then? I also cant put that logic in vm because I dont think its a good practice to have context in vm.

warTag
Автор

If I need my usecase to return some message, should I than pass this message into usecase as argument while initialising?

danilpechkin
Автор

Is the ViewModel considered the domain layer?

ChrisAthanas
Автор

And what should we do if we are Using Paging 3 in our application? cause the return type of our use cases are something like this : Flow<PagingData<Model>>>
because PagingData is kind of android dependent library (import androidx.paging.PagingData)

mohammadbahadori