Created
May 30, 2019 21:48
-
-
Save PiotrPrus/cfa9272d963dfe314b1b4ff01a60420b to your computer and use it in GitHub Desktop.
Example of preferences module that I am using in project to inject preferences
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val preferencesModule = module { | |
single { provideSettingsPreferences(androidApplication()) } | |
} | |
private const val PREFERENCES_FILE_KEY = "com.example.settings_preferences" | |
private fun provideSettingsPreferences(app: Application): SharedPreferences = | |
app.getSharedPreferences(PREFERENCES_FILE_KEY, Context.MODE_PRIVATE) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment