Update more libraries.

This commit is contained in:
Greyson Parrelli
2024-12-20 21:24:45 -05:00
parent 71d7238f3b
commit 31897b4c4b
21 changed files with 926 additions and 108 deletions

View File

@@ -28,7 +28,7 @@ class MmsDatabaseTest {
execSQL(MessageTable.CREATE_TABLE)
}
db = sqlCipher.writableDatabase
db = sqlCipher.myWritableDatabase
messageTable = MessageTable(ApplicationProvider.getApplicationContext(), sqlCipher)
}

View File

@@ -27,7 +27,7 @@ class MmsSmsDatabaseTest {
MessageTable.CREATE_INDEXS.forEach { execSQL(it) }
}
db = sqlCipher.writableDatabase
db = sqlCipher.myWritableDatabase
messageTable = MessageTable(ApplicationProvider.getApplicationContext(), sqlCipher)
}

View File

@@ -45,7 +45,7 @@ class NotificationProfileTablesTest {
}
}
db = sqlCipher.writableDatabase
db = sqlCipher.myWritableDatabase
database = NotificationProfileTables(ApplicationProvider.getApplicationContext(), sqlCipher)
}

View File

@@ -31,7 +31,7 @@ class SmsDatabaseTest {
}
}
db = sqlCipher.writableDatabase
db = sqlCipher.myWritableDatabase
messageTable = MessageTable(ApplicationProvider.getApplicationContext(), sqlCipher)
}

View File

@@ -13,8 +13,8 @@ import net.zetetic.database.sqlcipher.SQLiteDatabase as SQLCipherSQLiteDatabase
*/
class ProxySQLCipherOpenHelper(
context: Application,
val readableDatabase: AndroidSQLiteDatabase,
val writableDatabase: AndroidSQLiteDatabase
val myReadableDatabase: AndroidSQLiteDatabase,
val myWritableDatabase: AndroidSQLiteDatabase
) : SignalDatabase(context, DatabaseSecret(ByteArray(32).apply { SecureRandom().nextBytes(this) }), AttachmentSecret()) {
constructor(context: Application, testOpenHelper: TestSQLiteOpenHelper) : this(context, testOpenHelper.readableDatabase, testOpenHelper.writableDatabase)
@@ -23,9 +23,8 @@ class ProxySQLCipherOpenHelper(
throw UnsupportedOperationException()
}
override fun getDatabaseName(): String {
throw UnsupportedOperationException()
}
override val databaseName: String
get() = throw UnsupportedOperationException()
override fun setWriteAheadLoggingEnabled(enabled: Boolean) {
throw UnsupportedOperationException()
@@ -55,13 +54,11 @@ class ProxySQLCipherOpenHelper(
throw UnsupportedOperationException()
}
override fun getReadableDatabase(): SQLCipherSQLiteDatabase {
throw UnsupportedOperationException()
}
override val readableDatabase: SQLCipherSQLiteDatabase
get() = throw UnsupportedOperationException()
override fun getWritableDatabase(): SQLCipherSQLiteDatabase {
throw UnsupportedOperationException()
}
override val writableDatabase: SQLCipherSQLiteDatabase
get() = throw UnsupportedOperationException()
override val rawReadableDatabase: net.zetetic.database.sqlcipher.SQLiteDatabase
get() = throw UnsupportedOperationException()
@@ -70,10 +67,10 @@ class ProxySQLCipherOpenHelper(
get() = throw UnsupportedOperationException()
override val signalReadableDatabase: org.thoughtcrime.securesms.database.SQLiteDatabase
get() = ProxySignalSQLiteDatabase(readableDatabase)
get() = ProxySignalSQLiteDatabase(myReadableDatabase)
override val signalWritableDatabase: org.thoughtcrime.securesms.database.SQLiteDatabase
get() = ProxySignalSQLiteDatabase(writableDatabase)
get() = ProxySignalSQLiteDatabase(myWritableDatabase)
override fun getSqlCipherDatabase(): SQLCipherSQLiteDatabase {
throw UnsupportedOperationException()

View File

@@ -51,7 +51,7 @@ class ProxySignalSQLiteDatabase(private val database: AndroidSQLiteDatabase) : S
return database.queryWithFactory(null, distinct, table, columns, selection, selectionArgs, groupBy, having, orderBy, limit)
}
override fun query(query: SupportSQLiteQuery): Cursor? {
override fun query(query: SupportSQLiteQuery): Cursor {
val converted = query.toAndroidQuery()
return database.rawQuery(converted.where, converted.whereArgs)
}
@@ -112,7 +112,7 @@ class ProxySignalSQLiteDatabase(private val database: AndroidSQLiteDatabase) : S
return database.updateWithOnConflict(table, values, whereClause, whereArgs, conflictAlgorithm)
}
override fun execSQL(sql: String?) {
override fun execSQL(sql: String) {
database.execSQL(sql)
}
@@ -120,7 +120,7 @@ class ProxySignalSQLiteDatabase(private val database: AndroidSQLiteDatabase) : S
database.execSQL(sql)
}
override fun execSQL(sql: String, bindArgs: Array<out Any>) {
override fun execSQL(sql: String, bindArgs: Array<out Any?>) {
database.execSQL(sql, bindArgs)
}
@@ -132,9 +132,8 @@ class ProxySignalSQLiteDatabase(private val database: AndroidSQLiteDatabase) : S
throw UnsupportedOperationException()
}
override fun isWriteAheadLoggingEnabled(): Boolean {
throw UnsupportedOperationException()
}
override val isWriteAheadLoggingEnabled: Boolean
get() = throw UnsupportedOperationException()
override fun setForeignKeyConstraintsEnabled(enable: Boolean) {
database.setForeignKeyConstraintsEnabled(enable)
@@ -180,9 +179,8 @@ class ProxySignalSQLiteDatabase(private val database: AndroidSQLiteDatabase) : S
return database.inTransaction()
}
override fun isDbLockedByCurrentThread(): Boolean {
return database.isDbLockedByCurrentThread
}
override val isDbLockedByCurrentThread: Boolean
get() = database.isDbLockedByCurrentThread
@Suppress("DEPRECATION")
override fun isDbLockedByOtherThreads(): Boolean {
@@ -197,47 +195,40 @@ class ProxySignalSQLiteDatabase(private val database: AndroidSQLiteDatabase) : S
return database.yieldIfContendedSafely(sleepAfterYieldDelay)
}
override fun getVersion(): Int {
return database.version
}
override var version: Int
get() = database.version
set(value) {
database.version = version
}
override fun setVersion(version: Int) {
database.version = version
}
override fun getMaximumSize(): Long {
return database.maximumSize
}
override val maximumSize: Long
get() = database.maximumSize
override fun setMaximumSize(numBytes: Long): Long {
return database.setMaximumSize(numBytes)
}
override fun getPageSize(): Long {
return database.pageSize
}
override var pageSize: Long
get() = database.pageSize
set(value) {
database.pageSize = value
}
override fun setPageSize(numBytes: Long) {
database.pageSize = numBytes
}
override fun compileStatement(sql: String?): SQLCipherSQLiteStatement {
override fun compileStatement(sql: String): SQLCipherSQLiteStatement {
throw UnsupportedOperationException()
}
override fun isReadOnly(): Boolean {
return database.isReadOnly
}
override val isReadOnly: Boolean
get() = database.isReadOnly
override fun isOpen(): Boolean {
return database.isOpen
}
override val isOpen: Boolean
get() = database.isOpen
override fun needUpgrade(newVersion: Int): Boolean {
return database.needUpgrade(newVersion)
}
override fun setLocale(locale: Locale?) {
override fun setLocale(locale: Locale) {
database.setLocale(locale)
}
}