mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-09-24 18:51:51 +01:00
fixup! Add notification profile and chat folder backupv2 proto support.
This commit is contained in:
+11
-11
@@ -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()
|
||||
|
||||
+7
-4
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user