summaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2023-05-05 00:47:11 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2023-05-05 00:47:32 +0530
commit1e68e97b25b3f9ab640b8697537b1ab1fe921dfe (patch)
tree7f4e2f951b61c2c9ad85bf2aac9c7f961b3929eb /app/src
parenta188ad3f724f2072020ad3985de9db30b0bf3e83 (diff)
refactor: make `PreferenceModule` codestyle consistent
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/app/passwordstore/injection/prefs/PreferenceModule.kt25
1 files changed, 8 insertions, 17 deletions
diff --git a/app/src/main/java/app/passwordstore/injection/prefs/PreferenceModule.kt b/app/src/main/java/app/passwordstore/injection/prefs/PreferenceModule.kt
index 072bf031..797c7563 100644
--- a/app/src/main/java/app/passwordstore/injection/prefs/PreferenceModule.kt
+++ b/app/src/main/java/app/passwordstore/injection/prefs/PreferenceModule.kt
@@ -17,10 +17,7 @@ import dagger.hilt.components.SingletonComponent
@InstallIn(SingletonComponent::class)
class PreferenceModule {
- private fun provideBaseEncryptedPreferences(
- context: Context,
- fileName: String
- ): SharedPreferences {
+ private fun createEncryptedPreferences(context: Context, fileName: String): SharedPreferences {
val masterKeyAlias =
MasterKey.Builder(context).setKeyScheme(MasterKey.KeyScheme.AES256_GCM).build()
return EncryptedSharedPreferences.create(
@@ -34,27 +31,21 @@ class PreferenceModule {
@[Provides PasswordGeneratorPreferences Reusable]
fun providePwgenPreferences(@ApplicationContext context: Context): SharedPreferences {
- return provideBaseEncryptedPreferences(context, "pwgen_preferences")
+ return createEncryptedPreferences(context, "pwgen_preferences")
}
- @Provides
- @SettingsPreferences
- @Reusable
+ @[Provides SettingsPreferences Reusable]
fun provideSettingsPreferences(@ApplicationContext context: Context): SharedPreferences {
return context.getSharedPreferences("${BuildConfig.APPLICATION_ID}_preferences", MODE_PRIVATE)
}
- @Provides
- @GitPreferences
- @Reusable
- fun provideEncryptedPreferences(@ApplicationContext context: Context): SharedPreferences {
- return provideBaseEncryptedPreferences(context, "git_operation")
+ @[Provides GitPreferences Reusable]
+ fun provideGitPreferences(@ApplicationContext context: Context): SharedPreferences {
+ return createEncryptedPreferences(context, "git_operation")
}
- @Provides
- @ProxyPreferences
- @Reusable
+ @[Provides ProxyPreferences Reusable]
fun provideProxyPreferences(@ApplicationContext context: Context): SharedPreferences {
- return provideBaseEncryptedPreferences(context, "http_proxy")
+ return createEncryptedPreferences(context, "http_proxy")
}
}