Merge remote-tracking branch 'origin/dev' into closed_groups

# Conflicts:
#	app/src/main/java/org/thoughtcrime/securesms/database/ConfigDatabase.kt
This commit is contained in:
SessionHero01 2024-10-14 14:37:46 +11:00
commit 007fda6bae
No known key found for this signature in database

View File

@ -102,10 +102,14 @@ class ConfigDatabase(context: Context, helper: SQLCipherOpenHelper): Database(co
}
fun retrieveConfigLastUpdateTimestamp(variant: ConfigVariant, publicKey: String): Long {
val db = readableDatabase
val cursor = db.query(TABLE_NAME, arrayOf(TIMESTAMP), VARIANT_AND_PUBKEY_WHERE, arrayOf(variant, publicKey),null, null, null)
if (cursor == null) return 0
if (!cursor.moveToFirst()) return 0
return (cursor.getLongOrNull(cursor.getColumnIndex(TIMESTAMP)) ?: 0)
return readableDatabase
.query(TABLE_NAME, arrayOf(TIMESTAMP), VARIANT_AND_PUBKEY_WHERE, arrayOf(variant, publicKey), null, null, null)
?.use { cursor ->
if (cursor.moveToFirst()) {
cursor.getLongOrNull(cursor.getColumnIndex(TIMESTAMP))
} else {
null
}
} ?: 0L
}
}