Skip to content

Commit

Permalink
feat/#8: sharedpreference provide 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
kangyein9892 committed Nov 14, 2024
1 parent 319015d commit 27f4359
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
29 changes: 29 additions & 0 deletions data/src/main/java/org/sopt/and/data/di/LocalModule.kt
Original file line number Diff line number Diff line change
@@ -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
)
}

}
6 changes: 6 additions & 0 deletions data/src/main/java/org/sopt/and/data/di/Qualifiers.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package org.sopt.and.data.di

import javax.inject.Qualifier

@Qualifier
internal annotation class UserSharedPreference

0 comments on commit 27f4359

Please sign in to comment.