mirror of
https://github.com/twofas/2fas-android.git
synced 2025-01-07 06:55:36 +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"
|
secureStorage = "de.adorsys.android:securestoragelibrary:1.2.4"
|
||||||
roomRx = { module = "androidx.room:room-rxjava2", version.ref = "room" }
|
roomRx = { module = "androidx.room:room-rxjava2", version.ref = "room" }
|
||||||
sqlCipher = "net.zetetic:android-database-sqlcipher:4.5.4"
|
sqlCipher = "net.zetetic:android-database-sqlcipher:4.5.4"
|
||||||
|
reLinker = "com.getkeepsafe.relinker:relinker:1.4.5"
|
||||||
apacheCommonsCodec = "commons-codec:commons-codec:1.15"
|
apacheCommonsCodec = "commons-codec:commons-codec:1.15"
|
||||||
|
|
||||||
[bundles]
|
[bundles]
|
||||||
|
@ -25,5 +25,6 @@ dependencies {
|
|||||||
implementation(project(":core:common"))
|
implementation(project(":core:common"))
|
||||||
|
|
||||||
implementation(libs.bundles.room)
|
implementation(libs.bundles.room)
|
||||||
|
implementation(libs.reLinker)
|
||||||
kapt(libs.roomCompiler)
|
kapt(libs.roomCompiler)
|
||||||
}
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package com.twofasapp.persistence
|
package com.twofasapp.persistence
|
||||||
|
|
||||||
import androidx.room.Room
|
import androidx.room.Room
|
||||||
|
import com.getkeepsafe.relinker.ReLinker
|
||||||
import com.twofasapp.common.environment.AppBuild
|
import com.twofasapp.common.environment.AppBuild
|
||||||
import com.twofasapp.di.KoinModule
|
import com.twofasapp.di.KoinModule
|
||||||
import com.twofasapp.persistence.cipher.DatabaseKeyGenerator
|
import com.twofasapp.persistence.cipher.DatabaseKeyGenerator
|
||||||
@ -20,9 +21,10 @@ class PersistenceModule : KoinModule {
|
|||||||
singleOf(::GetDatabaseMasterKey)
|
singleOf(::GetDatabaseMasterKey)
|
||||||
|
|
||||||
single<AppDatabase> {
|
single<AppDatabase> {
|
||||||
|
val context = androidContext()
|
||||||
|
|
||||||
val builder = Room.databaseBuilder(
|
val builder = Room.databaseBuilder(
|
||||||
androidContext(),
|
context,
|
||||||
AppDatabase::class.java, "database-2fas"
|
AppDatabase::class.java, "database-2fas"
|
||||||
).addMigrations(
|
).addMigrations(
|
||||||
MIGRATION_1_2,
|
MIGRATION_1_2,
|
||||||
@ -35,6 +37,12 @@ class PersistenceModule : KoinModule {
|
|||||||
MIGRATION_10_11,
|
MIGRATION_10_11,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
SQLiteDatabase.loadLibs(context) { libraries: Array<String?> ->
|
||||||
|
libraries.forEach { library ->
|
||||||
|
ReLinker.loadLibrary(context, library)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (get<AppBuild>().isDebuggable.not()) {
|
if (get<AppBuild>().isDebuggable.not()) {
|
||||||
val factory = SupportFactory(SQLiteDatabase.getBytes(get<GetDatabaseMasterKey>().execute().toCharArray()))
|
val factory = SupportFactory(SQLiteDatabase.getBytes(get<GetDatabaseMasterKey>().execute().toCharArray()))
|
||||||
builder.openHelperFactory(factory)
|
builder.openHelperFactory(factory)
|
||||||
|
Loading…
Reference in New Issue
Block a user