From 1654e8e65bc437b8d28ee0c558cbe75fff27fafd Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Wed, 10 Jul 2024 03:35:41 +0900 Subject: [PATCH] =?UTF-8?q?[ADD/#37]=20SharedPref=20=EB=AA=A8=EB=93=88=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../co/orange/ddanzi/di/SharedPrefModule.kt | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 app/src/main/java/co/orange/ddanzi/di/SharedPrefModule.kt diff --git a/app/src/main/java/co/orange/ddanzi/di/SharedPrefModule.kt b/app/src/main/java/co/orange/ddanzi/di/SharedPrefModule.kt new file mode 100644 index 00000000..6a8d437b --- /dev/null +++ b/app/src/main/java/co/orange/ddanzi/di/SharedPrefModule.kt @@ -0,0 +1,26 @@ +package co.orange.ddanzi.di + +import android.content.Context +import android.content.SharedPreferences +import co.orange.data.local.UserSharedPref +import co.orange.data.local.UserSharedPrefImpl +import dagger.Module +import dagger.Provides +import dagger.hilt.InstallIn +import dagger.hilt.android.qualifiers.ApplicationContext +import dagger.hilt.components.SingletonComponent +import javax.inject.Singleton + +@Module +@InstallIn(SingletonComponent::class) +object SharedPrefModule { + @Provides + @Singleton + fun provideSharedPreferences( + @ApplicationContext context: Context, + ): SharedPreferences = context.getSharedPreferences(context.packageName, Context.MODE_PRIVATE) + + @Provides + @Singleton + fun provideSharedPref(sharedPrefImpl: UserSharedPrefImpl): UserSharedPref = sharedPrefImpl +}