Add some megaphones to encourage users to try backups.

This commit is contained in:
Greyson Parrelli
2026-03-02 16:58:38 -05:00
parent a95ebb2158
commit 7fbcd17759
14 changed files with 861 additions and 11 deletions

View File

@@ -706,6 +706,17 @@ class AttachmentTable(
}
}
/**
* This is "approximate" because it doesn't account for things like duplicates. Only useful as a heuristic.
*/
fun getApproximateTotalMediaSize(): Long {
return readableDatabase
.select("SUM($DATA_SIZE)")
.from(TABLE_NAME)
.run()
.readToSingleLong(0L)
}
fun getOptimizedMediaAttachmentSize(): Long {
return readableDatabase
.select("SUM($DATA_SIZE)")

View File

@@ -1915,9 +1915,15 @@ open class MessageTable(context: Context?, databaseHelper: SignalDatabase) : Dat
}
/**
* 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"
* "Approximate" because we're not filtering out stuff like message edits. Only useful as a heuristic.
*/
fun getApproximateTotalMessageCount(): Long {
return readableDatabase.count()
.from(TABLE_NAME)
.run()
.readToSingleLong(0L)
}
fun getApproximateExportableMessageCount(threadIds: Set<Long>): Long {
val queries = SqlUtil.buildCollectionQuery(THREAD_ID, threadIds)
return queries.sumOf {