Add improved archive upload progress.

This commit is contained in:
Alex Hart
2024-12-06 15:38:08 -04:00
committed by Greyson Parrelli
parent 981808d074
commit 6d5be0b445
8 changed files with 217 additions and 27 deletions

View File

@@ -1808,6 +1808,21 @@ open class MessageTable(context: Context?, databaseHelper: SignalDatabase) : Dat
.readToSingleInt()
}
/**
* Given a set of thread ids, return the count of all messages in the table that match that thread id. This will include *all* messages, and is
* explicitly for use as a "fuzzy total"
*/
fun getApproximateExportableMessageCount(threadIds: Set<Long>): Long {
val queries = SqlUtil.buildCollectionQuery(THREAD_ID, threadIds)
return queries.sumOf {
readableDatabase.count()
.from("$TABLE_NAME INDEXED BY $INDEX_THREAD_COUNT")
.where(it.where, it.whereArgs)
.run()
.readToSingleLong(0L)
}
}
fun canSetUniversalTimer(threadId: Long): Boolean {
if (threadId == -1L) {
return true