Skip to content

Instantly share code, notes, and snippets.

@PiotrPrus
Created May 30, 2019 21:48
Show Gist options
  • Save PiotrPrus/cfa9272d963dfe314b1b4ff01a60420b to your computer and use it in GitHub Desktop.
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
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