mirror of
https://github.com/bitwarden/android.git
synced 2025-12-10 09:56:45 -06:00
[PM-19949] Provide ConfigDiskSource from data module (#5003)
This commit is contained in:
parent
c5e216783e
commit
6668af58d2
@ -5,8 +5,6 @@ import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import androidx.room.Room
|
||||
import com.bitwarden.data.datasource.di.EncryptedPreferences
|
||||
import com.bitwarden.data.datasource.disk.ConfigDiskSource
|
||||
import com.bitwarden.data.datasource.disk.ConfigDiskSourceImpl
|
||||
import com.bitwarden.data.datasource.disk.di.UnencryptedPreferences
|
||||
import com.bitwarden.data.manager.DispatcherManager
|
||||
import com.x8bit.bitwarden.data.platform.datasource.disk.EnvironmentDiskSource
|
||||
@ -57,17 +55,6 @@ object PlatformDiskModule {
|
||||
json = json,
|
||||
)
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideConfigDiskSource(
|
||||
@UnencryptedPreferences sharedPreferences: SharedPreferences,
|
||||
json: Json,
|
||||
): ConfigDiskSource =
|
||||
ConfigDiskSourceImpl(
|
||||
sharedPreferences = sharedPreferences,
|
||||
json = json,
|
||||
)
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideEventDatabase(
|
||||
|
||||
@ -5,14 +5,11 @@ import com.bitwarden.authenticator.data.platform.datasource.disk.FeatureFlagOver
|
||||
import com.bitwarden.authenticator.data.platform.datasource.disk.FeatureFlagOverrideDiskSourceImpl
|
||||
import com.bitwarden.authenticator.data.platform.datasource.disk.SettingsDiskSource
|
||||
import com.bitwarden.authenticator.data.platform.datasource.disk.SettingsDiskSourceImpl
|
||||
import com.bitwarden.data.datasource.disk.ConfigDiskSource
|
||||
import com.bitwarden.data.datasource.disk.ConfigDiskSourceImpl
|
||||
import com.bitwarden.data.datasource.disk.di.UnencryptedPreferences
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.components.SingletonComponent
|
||||
import kotlinx.serialization.json.Json
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Module
|
||||
@ -22,17 +19,6 @@ import javax.inject.Singleton
|
||||
*/
|
||||
object PlatformDiskModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideConfigDiskSource(
|
||||
@UnencryptedPreferences sharedPreferences: SharedPreferences,
|
||||
json: Json,
|
||||
): ConfigDiskSource =
|
||||
ConfigDiskSourceImpl(
|
||||
sharedPreferences = sharedPreferences,
|
||||
json = json,
|
||||
)
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideSettingsDiskSource(
|
||||
|
||||
@ -13,7 +13,7 @@ private const val SERVER_CONFIGURATIONS = "serverConfigurations"
|
||||
/**
|
||||
* Primary implementation of [ConfigDiskSource].
|
||||
*/
|
||||
class ConfigDiskSourceImpl(
|
||||
internal class ConfigDiskSourceImpl(
|
||||
sharedPreferences: SharedPreferences,
|
||||
private val json: Json,
|
||||
) : BaseDiskSource(sharedPreferences = sharedPreferences),
|
||||
|
||||
@ -0,0 +1,29 @@
|
||||
package com.bitwarden.data.datasource.disk.di
|
||||
|
||||
import android.content.SharedPreferences
|
||||
import com.bitwarden.data.datasource.disk.ConfigDiskSource
|
||||
import com.bitwarden.data.datasource.disk.ConfigDiskSourceImpl
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.components.SingletonComponent
|
||||
import kotlinx.serialization.json.Json
|
||||
import javax.inject.Singleton
|
||||
|
||||
/**
|
||||
* Provides persistence-related dependencies in the data module.
|
||||
*/
|
||||
@Module
|
||||
@InstallIn(SingletonComponent::class)
|
||||
object DiskModule {
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideConfigDiskSource(
|
||||
@UnencryptedPreferences sharedPreferences: SharedPreferences,
|
||||
json: Json,
|
||||
): ConfigDiskSource =
|
||||
ConfigDiskSourceImpl(
|
||||
sharedPreferences = sharedPreferences,
|
||||
json = json,
|
||||
)
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user