diff --git a/core/data/src/main/java/com/wap/wapp/core/data/repository/di/AuthRepositoryModule.kt b/core/data/src/main/java/com/wap/wapp/core/data/repository/di/AuthRepositoryModule.kt new file mode 100644 index 00000000..5cbdfe3c --- /dev/null +++ b/core/data/src/main/java/com/wap/wapp/core/data/repository/di/AuthRepositoryModule.kt @@ -0,0 +1,19 @@ +package com.wap.wapp.core.data.repository.di + +import com.wap.wapp.core.data.repository.auth.AuthRepository +import com.wap.wapp.core.data.repository.auth.AuthRepositoryImpl +import dagger.Binds +import dagger.Module +import dagger.hilt.InstallIn +import dagger.hilt.android.components.ActivityComponent +import dagger.hilt.android.scopes.ActivityScoped + +@Module +@InstallIn(ActivityComponent::class) +abstract class AuthRepositoryModule { + @Binds + @ActivityScoped + abstract fun providesAuthRepository( + authRepositoryImpl: AuthRepositoryImpl + ): AuthRepository +} \ No newline at end of file diff --git a/core/data/src/main/java/com/wap/wapp/core/data/repository/di/RepositoryModule.kt b/core/data/src/main/java/com/wap/wapp/core/data/repository/di/RepositoryModule.kt deleted file mode 100644 index c3a7865b..00000000 --- a/core/data/src/main/java/com/wap/wapp/core/data/repository/di/RepositoryModule.kt +++ /dev/null @@ -1,20 +0,0 @@ -package com.wap.wapp.core.data.repository.di - -import com.wap.wapp.core.data.repository.auth.AuthRepository -import com.wap.wapp.core.data.repository.auth.AuthRepositoryImpl -import com.wap.wapp.core.network.source.auth.AuthDataSource -import dagger.Module -import dagger.Provides -import dagger.hilt.InstallIn -import dagger.hilt.components.SingletonComponent -import javax.inject.Singleton - -@Module -@InstallIn(SingletonComponent::class) -object RepositoryModule { - @Singleton - @Provides - fun providesAuthRepository( - authDataSource: AuthDataSource - ): AuthRepository = AuthRepositoryImpl(authDataSource) -} \ No newline at end of file diff --git a/core/domain/src/main/java/com/wap/wapp/core/domain/auth/SignInUseCase.kt b/core/domain/src/main/java/com/wap/wapp/core/domain/auth/SignInUseCase.kt index 20455d5f..7774c024 100644 --- a/core/domain/src/main/java/com/wap/wapp/core/domain/auth/SignInUseCase.kt +++ b/core/domain/src/main/java/com/wap/wapp/core/domain/auth/SignInUseCase.kt @@ -1,8 +1,10 @@ package com.wap.wapp.core.domain.auth import com.wap.wapp.core.data.repository.auth.AuthRepository +import dagger.hilt.android.scopes.ActivityScoped import javax.inject.Inject +@ActivityScoped class SignInUseCase @Inject constructor( private val repository: AuthRepository ){ diff --git a/core/network/src/main/java/com/wap/wapp/core/network/di/DataSourceModule.kt b/core/network/src/main/java/com/wap/wapp/core/network/di/AuthDataSourceModule.kt similarity index 57% rename from core/network/src/main/java/com/wap/wapp/core/network/di/DataSourceModule.kt rename to core/network/src/main/java/com/wap/wapp/core/network/di/AuthDataSourceModule.kt index b3738d14..34a55266 100644 --- a/core/network/src/main/java/com/wap/wapp/core/network/di/DataSourceModule.kt +++ b/core/network/src/main/java/com/wap/wapp/core/network/di/AuthDataSourceModule.kt @@ -5,15 +5,15 @@ import com.wap.wapp.core.network.source.auth.AuthDataSourceImpl import dagger.Binds import dagger.Module import dagger.hilt.InstallIn -import dagger.hilt.components.SingletonComponent -import javax.inject.Singleton +import dagger.hilt.android.components.ActivityComponent +import dagger.hilt.android.scopes.ActivityScoped @Module -@InstallIn(SingletonComponent::class) -abstract class DataSourceModule { +@InstallIn(ActivityComponent::class) +abstract class AuthDataSourceModule { @Binds - @Singleton - abstract fun provideAuthDataSource( + @ActivityScoped + abstract fun providesAuthDataSource( authDataSourceImpl: AuthDataSourceImpl ): AuthDataSource } \ No newline at end of file