-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSharedPreferencesModule.kt
More file actions
37 lines (33 loc) · 1.26 KB
/
SharedPreferencesModule.kt
File metadata and controls
37 lines (33 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.sopt.clody.di
import android.content.Context
import android.content.SharedPreferences
import com.sopt.clody.data.local.datasource.AppReviewLocalDataSource
import com.sopt.clody.data.local.datasourceimpl.AppReviewLocalDataSourceImpl
import com.sopt.clody.di.qualifier.ReviewPrefs
import com.sopt.clody.di.qualifier.TokenPrefs
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 SharedPreferencesModule {
@Provides
@Singleton
@TokenPrefs
fun provideSharedPreferences(@ApplicationContext context: Context): SharedPreferences {
return context.getSharedPreferences("token_prefs", Context.MODE_PRIVATE)
}
@Provides
@Singleton
@ReviewPrefs
fun provideReviewSharedPreferences(@ApplicationContext context: Context): SharedPreferences {
return context.getSharedPreferences("review_prefs", Context.MODE_PRIVATE)
}
@Provides
@Singleton
fun provideAppReviewLocalDataSource(@ReviewPrefs sharedPreferences: SharedPreferences): AppReviewLocalDataSource =
AppReviewLocalDataSourceImpl(sharedPreferences)
}