Мета информация о хранилищах хранится в бд
This commit is contained in:
@@ -19,6 +19,6 @@ class ExampleInstrumentedTest {
|
||||
fun useAppContext() {
|
||||
// Context of the app under test.
|
||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
assertEquals("com.github.nullptroma.wallenc", appContext.packageName)
|
||||
assertEquals("com.github.nullptroma.wallenc.app", appContext.packageName)
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import android.content.Context
|
||||
import com.github.nullptroma.wallenc.data.db.RoomFactory
|
||||
import com.github.nullptroma.wallenc.data.db.app.IAppDb
|
||||
import com.github.nullptroma.wallenc.data.db.app.dao.StorageKeyMapDao
|
||||
import com.github.nullptroma.wallenc.data.db.app.dao.StorageMetaInfoDao
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.hilt.InstallIn
|
||||
@@ -25,6 +26,12 @@ class RoomModule {
|
||||
return database.storageKeyMapDao
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideStorageMetaInfoDao(database: IAppDb): StorageMetaInfoDao {
|
||||
return database.storageMetaInfoDao
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideAppDb(
|
||||
|
||||
@@ -3,8 +3,10 @@ package com.github.nullptroma.wallenc.app.di.modules.data
|
||||
import android.content.Context
|
||||
import com.github.nullptroma.wallenc.app.di.modules.app.IoDispatcher
|
||||
import com.github.nullptroma.wallenc.data.db.app.dao.StorageKeyMapDao
|
||||
import com.github.nullptroma.wallenc.data.db.app.dao.StorageMetaInfoDao
|
||||
import com.github.nullptroma.wallenc.data.db.app.repository.StorageKeyMapRepository
|
||||
import com.github.nullptroma.wallenc.data.vaults.UnlockManager
|
||||
import com.github.nullptroma.wallenc.data.db.app.repository.StorageMetaInfoRepository
|
||||
import com.github.nullptroma.wallenc.data.storages.UnlockManager
|
||||
import com.github.nullptroma.wallenc.data.vaults.VaultsManager
|
||||
import com.github.nullptroma.wallenc.domain.interfaces.IUnlockManager
|
||||
import com.github.nullptroma.wallenc.domain.interfaces.IVaultsManager
|
||||
@@ -21,24 +23,42 @@ import javax.inject.Singleton
|
||||
class SingletonModule {
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideVaultsManager(@IoDispatcher ioDispatcher: CoroutineDispatcher,
|
||||
@ApplicationContext context: Context): IVaultsManager {
|
||||
fun provideVaultsManager(
|
||||
@IoDispatcher ioDispatcher: CoroutineDispatcher,
|
||||
@ApplicationContext context: Context
|
||||
): IVaultsManager {
|
||||
return VaultsManager(ioDispatcher, context)
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideStorageKeyMapRepository(dao: StorageKeyMapDao): StorageKeyMapRepository {
|
||||
return StorageKeyMapRepository(dao)
|
||||
fun provideStorageKeyMapRepository(
|
||||
dao: StorageKeyMapDao,
|
||||
@IoDispatcher ioDispatcher: CoroutineDispatcher
|
||||
): StorageKeyMapRepository {
|
||||
return StorageKeyMapRepository(dao, ioDispatcher)
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideUnlockManager(@IoDispatcher ioDispatcher: CoroutineDispatcher,
|
||||
repo: StorageKeyMapRepository,
|
||||
vaultsManager: IVaultsManager): IUnlockManager {
|
||||
fun provideStorageMetaInfoRepository(
|
||||
dao: StorageMetaInfoDao,
|
||||
@IoDispatcher ioDispatcher: CoroutineDispatcher
|
||||
): StorageMetaInfoRepository {
|
||||
return StorageMetaInfoRepository(dao, ioDispatcher)
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideUnlockManager(
|
||||
@IoDispatcher ioDispatcher: CoroutineDispatcher,
|
||||
keyRepo: StorageKeyMapRepository,
|
||||
metaRepo: StorageMetaInfoRepository,
|
||||
vaultsManager: IVaultsManager
|
||||
): IUnlockManager {
|
||||
return UnlockManager(
|
||||
repo = repo,
|
||||
keymapRepository = keyRepo,
|
||||
metaInfoRepository = metaRepo,
|
||||
ioDispatcher = ioDispatcher,
|
||||
vaultsManager = vaultsManager
|
||||
)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.github.nullptroma.wallenc.app.di.modules.domain
|
||||
|
||||
import com.github.nullptroma.wallenc.data.vaults.UnlockManager
|
||||
import com.github.nullptroma.wallenc.domain.interfaces.IUnlockManager
|
||||
import com.github.nullptroma.wallenc.domain.interfaces.IVaultsManager
|
||||
import com.github.nullptroma.wallenc.domain.usecases.GetOpenedStoragesUseCase
|
||||
|
||||
Reference in New Issue
Block a user