fixup! Add notification profile and chat folder backupv2 proto support.

This commit is contained in:
Cody Henthorne
2024-12-09 11:13:29 -05:00
parent b5857d4169
commit d55467fd65
2 changed files with 18 additions and 15 deletions
@@ -66,6 +66,11 @@ class ArchiveImportExportTests {
runTests { it.startsWith("chat_") && !it.contains("_item") }
}
// @Test
fun chatFolders() {
runTests { it.startsWith("chat_folder_") }
}
// @Test
fun chatItemContactMessage() {
runTests { it.startsWith("chat_item_contact_message_") }
@@ -191,7 +196,12 @@ class ArchiveImportExportTests {
runTests { it.startsWith("chat_item_view_once_") }
}
// @Test
// @Test
fun notificationProfiles() {
runTests { it.startsWith("notification_profile_") }
}
// @Test
fun recipientCallLink() {
runTests { it.startsWith("recipient_call_link_") }
}
@@ -211,16 +221,6 @@ class ArchiveImportExportTests {
runTests { it.startsWith("recipient_groups_") }
}
// @Test
fun notificationProfiles() {
runTests { it.startsWith("notification_profile_") }
}
// @Test
fun chatFolders() {
runTests { it.startsWith("chat_folder_") }
}
private fun runTests(predicate: (String) -> Boolean = { true }) {
val testFiles = InstrumentationRegistry.getInstrumentation().context.resources.assets.list(TESTS_FOLDER)!!.filter(predicate)
val results: MutableList<TestResult> = mutableListOf()
@@ -34,6 +34,11 @@ object ChatFolderProcessor {
.getChatFolders()
.sortedBy { it.position }
if (folders.isEmpty()) {
Log.d(TAG, "No chat folders, nothing to export")
return
}
if (folders.size == 1 && folders[0].folderType == ChatFolderRecord.FolderType.ALL) {
Log.d(TAG, "Only ALL chat folder present, skipping chat folder export")
return
@@ -47,14 +52,12 @@ object ChatFolderProcessor {
folders.forEach { folder ->
val includedRecipientIds = folder
.includedChats
.mapNotNull {
db.threadTable.getRecipientIdForThreadId(it)?.toLong()
}
.map { db.threadTable.getRecipientIdForThreadId(it)!!.toLong() }
.filter { exportState.recipientIds.contains(it) }
val excludedRecipientIds = folder
.excludedChats
.mapNotNull { db.threadTable.getRecipientIdForThreadId(it)?.toLong() }
.map { db.threadTable.getRecipientIdForThreadId(it)!!.toLong() }
.filter { exportState.recipientIds.contains(it) }
val frame = folder.toBackupFrame(includedRecipientIds, excludedRecipientIds)