fixed encrypted sql database gets overwritten on sql-schema change (#887)

fix from:
jobobby04
This commit is contained in:
Shamicen 2023-05-14 19:29:26 +02:00 committed by GitHub
parent ac9048db46
commit d28670a24c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -82,7 +82,10 @@ class AppModule(val app: Application) : InjektModule {
addSingletonFactory<SqlDriver> { addSingletonFactory<SqlDriver> {
// SY --> // SY -->
System.loadLibrary("sqlcipher") if (securityPreferences.encryptDatabase().get()) {
System.loadLibrary("sqlcipher")
}
// SY <-- // SY <--
AndroidSqliteDriver( AndroidSqliteDriver(
schema = Database.Schema, schema = Database.Schema,
@ -94,7 +97,7 @@ class AppModule(val app: Application) : InjektModule {
LEGACY_DATABASE_NAME LEGACY_DATABASE_NAME
}, },
factory = if (securityPreferences.encryptDatabase().get()) { factory = if (securityPreferences.encryptDatabase().get()) {
SupportOpenHelperFactory(CbzCrypto.getDecryptedPasswordSql()) SupportOpenHelperFactory(CbzCrypto.getDecryptedPasswordSql(), null, false, 25)
} else if (BuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { } else if (BuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
// Support database inspector in Android Studio // Support database inspector in Android Studio
FrameworkSQLiteOpenHelperFactory() FrameworkSQLiteOpenHelperFactory()