Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions runtime-checks/runtime-checks-impl/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ dependencies {
implementation project(path: ':app-build-config-api')
implementation project(path: ':runtime-checks-store')
implementation project(path: ':content-scope-scripts-api')
implementation project(path: ':data-store-api')

implementation AndroidX.core.ktx

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

package com.duckduckgo.runtimechecks.impl.di

import android.content.Context
import androidx.room.Room
import com.duckduckgo.app.di.AppCoroutineScope
import com.duckduckgo.app.di.IsMainProcess
import com.duckduckgo.common.utils.DispatcherProvider
import com.duckduckgo.data.store.api.DatabaseProvider
import com.duckduckgo.data.store.api.RoomDatabaseConfig
import com.duckduckgo.di.scopes.AppScope
import com.duckduckgo.runtimechecks.store.ALL_MIGRATIONS
import com.duckduckgo.runtimechecks.store.RealRuntimeChecksRepository
Expand All @@ -36,14 +36,18 @@ import kotlinx.coroutines.CoroutineScope
@ContributesTo(AppScope::class)
object RuntimeChecksModule {

@SingleInstanceIn(AppScope::class)
@Provides
fun provideRuntimeChecksDatabase(context: Context): RuntimeChecksDatabase {
return Room.databaseBuilder(context, RuntimeChecksDatabase::class.java, "runtime_checks.db")
.enableMultiInstanceInvalidation()
.fallbackToDestructiveMigration()
.addMigrations(*ALL_MIGRATIONS)
.build()
@SingleInstanceIn(AppScope::class)
fun provideRuntimeChecksDatabase(databaseProvider: DatabaseProvider): RuntimeChecksDatabase {
return databaseProvider.buildRoomDatabase(
RuntimeChecksDatabase::class.java,
"runtime_checks.db",
config = RoomDatabaseConfig(
fallbackToDestructiveMigration = true,
enableMultiInstanceInvalidation = true,
migrations = ALL_MIGRATIONS,
),
)
}

@SingleInstanceIn(AppScope::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ abstract class RuntimeChecksDatabase : RoomDatabase() {
abstract fun runtimeChecksDao(): RuntimeChecksDao
}

val ALL_MIGRATIONS = emptyArray<Migration>()
val ALL_MIGRATIONS = emptyList<Migration>()
Loading