diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 35db087a..8378ead4 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -112,6 +112,7 @@ securityCrypto = "androidx.security:security-crypto:1.1.0-alpha05" secureStorage = "de.adorsys.android:securestoragelibrary:1.2.4" roomRx = { module = "androidx.room:room-rxjava2", version.ref = "room" } sqlCipher = "net.zetetic:android-database-sqlcipher:4.5.4" +reLinker = "com.getkeepsafe.relinker:relinker:1.4.5" apacheCommonsCodec = "commons-codec:commons-codec:1.15" [bundles] diff --git a/persistence/build.gradle.kts b/persistence/build.gradle.kts index cf72971c..fc5250ce 100644 --- a/persistence/build.gradle.kts +++ b/persistence/build.gradle.kts @@ -25,5 +25,6 @@ dependencies { implementation(project(":core:common")) implementation(libs.bundles.room) + implementation(libs.reLinker) kapt(libs.roomCompiler) } \ No newline at end of file diff --git a/persistence/src/main/java/com/twofasapp/persistence/PersistenceModule.kt b/persistence/src/main/java/com/twofasapp/persistence/PersistenceModule.kt index c26710a4..36d846ea 100644 --- a/persistence/src/main/java/com/twofasapp/persistence/PersistenceModule.kt +++ b/persistence/src/main/java/com/twofasapp/persistence/PersistenceModule.kt @@ -1,6 +1,7 @@ package com.twofasapp.persistence import androidx.room.Room +import com.getkeepsafe.relinker.ReLinker import com.twofasapp.common.environment.AppBuild import com.twofasapp.di.KoinModule import com.twofasapp.persistence.cipher.DatabaseKeyGenerator @@ -20,9 +21,10 @@ class PersistenceModule : KoinModule { singleOf(::GetDatabaseMasterKey) single { + val context = androidContext() val builder = Room.databaseBuilder( - androidContext(), + context, AppDatabase::class.java, "database-2fas" ).addMigrations( MIGRATION_1_2, @@ -35,6 +37,12 @@ class PersistenceModule : KoinModule { MIGRATION_10_11, ) + SQLiteDatabase.loadLibs(context) { libraries: Array -> + libraries.forEach { library -> + ReLinker.loadLibrary(context, library) + } + } + if (get().isDebuggable.not()) { val factory = SupportFactory(SQLiteDatabase.getBytes(get().execute().toCharArray())) builder.openHelperFactory(factory)