Skip to content

Commit

Permalink
[ADD/#37] SharedPref 모듈 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
Marchbreeze committed Jul 9, 2024
1 parent 9f4f9e2 commit 1654e8e
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions app/src/main/java/co/orange/ddanzi/di/SharedPrefModule.kt
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit 1654e8e

Please sign in to comment.