Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provided UseCases at ViewModelScope instead of Singleton #139

Merged
merged 1 commit into from
Oct 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions app/src/main/java/com/hieuwu/groceriesstore/di/UseCaseModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,42 +19,42 @@ import com.hieuwu.groceriesstore.domain.usecases.UserSettingsUseCaseImpl
import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton
import dagger.hilt.android.components.ViewModelComponent
import dagger.hilt.android.scopes.ViewModelScoped

@InstallIn(SingletonComponent::class)
@InstallIn(ViewModelComponent::class)
@Module
abstract class UseCaseModule {

@Singleton
@ViewModelScoped
@Binds
abstract fun bindGetProductListUseCase(impl: GetProductListUseCaseImpl): GetProductListUseCase

@Singleton
@ViewModelScoped
@Binds
abstract fun bindGetProductDetailUseCase(impl: GetProductDetailUseCaseImpl): GetProductDetailUseCase

@Singleton
@ViewModelScoped
@Binds
abstract fun bindAuthenticateUserUseCase(impl: AuthenticateUserUseCaseImpl): AuthenticateUserUseCase

@Singleton
@ViewModelScoped
@Binds
abstract fun bindUpdateCartItemUseCase(impl: UpdateCartItemUseCaseImpl): UpdateCartItemUseCase

@Singleton
@ViewModelScoped
@Binds
abstract fun bindCreateOrderUseCase(impl: CreateOrderUseCaseImpl): CreateOrderUseCase

@Singleton
@ViewModelScoped
@Binds
abstract fun bindExploreProductUseCase(impl: ExploreProductProductUseCaseImpl): ExploreProductUseCase

@Singleton
@ViewModelScoped
@Binds
abstract fun bindRefreshAppDataUseCase(impl: RefreshAppDataUseCaseImpl): RefreshAppDataUseCase

@Singleton
@ViewModelScoped
@Binds
abstract fun bindUserSettingsUseCase(impl: UserSettingsUseCaseImpl): UserSettingsUseCase
}