Update to latest Backup.proto.

This commit is contained in:
Greyson Parrelli
2024-07-29 10:26:19 -04:00
committed by mtang-signal
parent c2bdac80dc
commit fb2a332513
17 changed files with 211 additions and 227 deletions

View File

@@ -128,7 +128,7 @@ class ImportExportTest {
linkPreviews = true,
notDiscoverableByPhoneNumber = true,
preferContactAvatars = true,
universalExpireTimer = 42,
universalExpireTimerSeconds = 42,
displayBadgesOnProfile = true,
keepMutedChatsArchived = true,
hasSetMyStoriesPrivacy = true,
@@ -556,46 +556,6 @@ class ImportExportTest {
)
}
@Test
fun deletedDistributionList() {
val alexa = Recipient(
id = 4,
contact = Contact(
aci = TestRecipientUtils.nextAci().toByteString(),
pni = TestRecipientUtils.nextPni().toByteString(),
username = "cool.01",
e164 = 141255501234,
blocked = true,
visibility = Contact.Visibility.HIDDEN,
registered = Contact.Registered(),
profileKey = TestRecipientUtils.generateProfileKey().toByteString(),
profileSharing = true,
profileGivenName = "Alexa",
profileFamilyName = "Kim",
hideStory = true
)
)
val importData = exportFrames(
*standardFrames,
alexa,
Recipient(
id = 6,
distributionList = DistributionListItem(
distributionId = DistributionId.create().asUuid().toByteArray().toByteString(),
deletionTimestamp = 12345L
)
)
)
import(importData)
val exported = BackupRepository.debugExport()
val expected = exportFrames(
*standardFrames,
alexa
)
compare(expected, exported)
}
@Test
fun chatThreads() {
importExport(
@@ -1254,12 +1214,7 @@ class ImportExportTest {
chatId = 1,
authorId = alice.id,
dateSent = dateSentStart++,
incoming = ChatItem.IncomingMessageDetails(
dateReceived = dateSentStart,
dateServerSent = dateSentStart,
read = true,
sealedSender = true
),
directionless = ChatItem.DirectionlessMessageDetails(),
updateMessage = ChatUpdateMessage(
simpleUpdate = SimpleChatUpdate(
type = SimpleChatUpdate.Type.fromValue(i)!!
@@ -1287,12 +1242,7 @@ class ImportExportTest {
chatId = 1,
authorId = alice.id,
dateSent = dateSentStart++,
incoming = ChatItem.IncomingMessageDetails(
dateReceived = dateSentStart,
dateServerSent = dateSentStart,
read = true,
sealedSender = true
),
directionless = ChatItem.DirectionlessMessageDetails(),
updateMessage = ChatUpdateMessage(
expirationTimerChange = ExpirationTimerChatUpdate(
1000
@@ -1303,11 +1253,7 @@ class ImportExportTest {
chatId = 1,
authorId = selfRecipient.id,
dateSent = dateSentStart++,
outgoing = ChatItem.OutgoingMessageDetails(
sendStatus = listOf(
SendStatus(alice.id, deliveryStatus = SendStatus.Status.READ, sealedSender = true, lastStatusUpdateTimestamp = -1)
)
),
directionless = ChatItem.DirectionlessMessageDetails(),
updateMessage = ChatUpdateMessage(
expirationTimerChange = ExpirationTimerChatUpdate(
0
@@ -1318,9 +1264,7 @@ class ImportExportTest {
chatId = 1,
authorId = selfRecipient.id,
dateSent = dateSentStart++,
outgoing = ChatItem.OutgoingMessageDetails(
sendStatus = listOf(SendStatus(alice.id, deliveryStatus = SendStatus.Status.READ, sealedSender = true, lastStatusUpdateTimestamp = -1))
),
directionless = ChatItem.DirectionlessMessageDetails(),
updateMessage = ChatUpdateMessage(
expirationTimerChange = ExpirationTimerChatUpdate(
10000
@@ -1331,12 +1275,7 @@ class ImportExportTest {
chatId = 1,
authorId = alice.id,
dateSent = dateSentStart++,
incoming = ChatItem.IncomingMessageDetails(
dateReceived = dateSentStart,
dateServerSent = dateSentStart,
read = true,
sealedSender = true
),
directionless = ChatItem.DirectionlessMessageDetails(),
updateMessage = ChatUpdateMessage(
expirationTimerChange = ExpirationTimerChatUpdate(
0
@@ -1348,7 +1287,6 @@ class ImportExportTest {
@Test
fun profileChangeChatUpdateMessage() {
var dateSentStart = 100L
importExport(
*standardFrames,
alice,
@@ -1356,13 +1294,8 @@ class ImportExportTest {
ChatItem(
chatId = 1,
authorId = alice.id,
dateSent = dateSentStart++,
incoming = ChatItem.IncomingMessageDetails(
dateReceived = dateSentStart,
dateServerSent = dateSentStart,
read = true,
sealedSender = true
),
dateSent = 100L,
directionless = ChatItem.DirectionlessMessageDetails(),
updateMessage = ChatUpdateMessage(
profileChange = ProfileChangeChatUpdate(
previousName = "Aliceee Kim",
@@ -1375,7 +1308,6 @@ class ImportExportTest {
@Test
fun threadMergeChatUpdate() {
var dateSentStart = 100L
importExport(
*standardFrames,
alice,
@@ -1383,13 +1315,8 @@ class ImportExportTest {
ChatItem(
chatId = 1,
authorId = alice.id,
dateSent = dateSentStart++,
incoming = ChatItem.IncomingMessageDetails(
dateReceived = dateSentStart,
dateServerSent = dateSentStart,
read = true,
sealedSender = true
),
dateSent = 100L,
directionless = ChatItem.DirectionlessMessageDetails(),
updateMessage = ChatUpdateMessage(
threadMerge = ThreadMergeChatUpdate(
previousE164 = 141255501237
@@ -1409,13 +1336,8 @@ class ImportExportTest {
ChatItem(
chatId = 1,
authorId = alice.id,
dateSent = dateSentStart++,
incoming = ChatItem.IncomingMessageDetails(
dateReceived = dateSentStart,
dateServerSent = dateSentStart,
read = true,
sealedSender = true
),
dateSent = dateSentStart,
directionless = ChatItem.DirectionlessMessageDetails(),
updateMessage = ChatUpdateMessage(
sessionSwitchover = SessionSwitchoverChatUpdate(
e164 = 141255501237