mirror of
https://github.com/twofas/2fas-android.git
synced 2025-01-05 14:05:30 +01:00
Use relinker in rare cases when ndk sql lib is not loaded
This commit is contained in:
parent
b80926f7f6
commit
daa747b7f3
@ -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]
|
||||
|
@ -25,5 +25,6 @@ dependencies {
|
||||
implementation(project(":core:common"))
|
||||
|
||||
implementation(libs.bundles.room)
|
||||
implementation(libs.reLinker)
|
||||
kapt(libs.roomCompiler)
|
||||
}
|
@ -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<AppDatabase> {
|
||||
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<String?> ->
|
||||
libraries.forEach { library ->
|
||||
ReLinker.loadLibrary(context, library)
|
||||
}
|
||||
}
|
||||
|
||||
if (get<AppBuild>().isDebuggable.not()) {
|
||||
val factory = SupportFactory(SQLiteDatabase.getBytes(get<GetDatabaseMasterKey>().execute().toCharArray()))
|
||||
builder.openHelperFactory(factory)
|
||||
|
Loading…
Reference in New Issue
Block a user