From 27f43594e1bde9f00db46a3aa32f4a2858d5ca7f Mon Sep 17 00:00:00 2001 From: kangyein9892 Date: Fri, 15 Nov 2024 00:09:39 +0900 Subject: [PATCH] =?UTF-8?q?feat/#8:=20sharedpreference=20provide=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/sopt/and/data/di/LocalModule.kt | 29 +++++++++++++++++++ .../java/org/sopt/and/data/di/Qualifiers.kt | 6 ++++ 2 files changed, 35 insertions(+) create mode 100644 data/src/main/java/org/sopt/and/data/di/LocalModule.kt create mode 100644 data/src/main/java/org/sopt/and/data/di/Qualifiers.kt diff --git a/data/src/main/java/org/sopt/and/data/di/LocalModule.kt b/data/src/main/java/org/sopt/and/data/di/LocalModule.kt new file mode 100644 index 0000000..eef3c7f --- /dev/null +++ b/data/src/main/java/org/sopt/and/data/di/LocalModule.kt @@ -0,0 +1,29 @@ +package org.sopt.and.data.di + +import android.content.Context +import android.content.SharedPreferences +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) +internal object LocalModule { + + private const val PREF_NAME = "wavve_prefs" + + @UserSharedPreference + @Provides + @Singleton + fun provideUserSharedPreference( + @ApplicationContext context: Context + ): SharedPreferences { + return context.getSharedPreferences( + PREF_NAME, Context.MODE_PRIVATE + ) + } + +} \ No newline at end of file diff --git a/data/src/main/java/org/sopt/and/data/di/Qualifiers.kt b/data/src/main/java/org/sopt/and/data/di/Qualifiers.kt new file mode 100644 index 0000000..6569e29 --- /dev/null +++ b/data/src/main/java/org/sopt/and/data/di/Qualifiers.kt @@ -0,0 +1,6 @@ +package org.sopt.and.data.di + +import javax.inject.Qualifier + +@Qualifier +internal annotation class UserSharedPreference \ No newline at end of file