From 9848ea27bb055f97858635748634246dc5cebd1b Mon Sep 17 00:00:00 2001 From: jeongjaino Date: Fri, 6 Oct 2023 10:09:19 +0900 Subject: [PATCH] =?UTF-8?q?[FIX]=20#14=20:=20Auth=20=EA=B4=80=EB=A0=A8=20D?= =?UTF-8?q?I=20=EB=AA=A8=EB=91=90=20Activity=20Component=EB=A1=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/di/AuthRepositoryModule.kt | 19 ++++++++++++++++++ .../data/repository/di/RepositoryModule.kt | 20 ------------------- .../wapp/core/domain/auth/SignInUseCase.kt | 2 ++ ...ourceModule.kt => AuthDataSourceModule.kt} | 12 +++++------ 4 files changed, 27 insertions(+), 26 deletions(-) create mode 100644 core/data/src/main/java/com/wap/wapp/core/data/repository/di/AuthRepositoryModule.kt delete mode 100644 core/data/src/main/java/com/wap/wapp/core/data/repository/di/RepositoryModule.kt rename core/network/src/main/java/com/wap/wapp/core/network/di/{DataSourceModule.kt => AuthDataSourceModule.kt} (57%) 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