|
@@ -23,6 +23,8 @@ package ch.threema.app.tasks
|
|
|
|
|
|
|
|
import ch.threema.app.ThreemaApplication
|
|
import ch.threema.app.ThreemaApplication
|
|
|
import ch.threema.data.models.ContactModelData
|
|
import ch.threema.data.models.ContactModelData
|
|
|
|
|
+import ch.threema.data.models.GroupIdentity
|
|
|
|
|
+import ch.threema.data.models.GroupModelData
|
|
|
import ch.threema.domain.models.ContactSyncState
|
|
import ch.threema.domain.models.ContactSyncState
|
|
|
import ch.threema.domain.models.IdentityState
|
|
import ch.threema.domain.models.IdentityState
|
|
|
import ch.threema.domain.models.IdentityType
|
|
import ch.threema.domain.models.IdentityType
|
|
@@ -34,13 +36,13 @@ import ch.threema.domain.taskmanager.Task
|
|
|
import ch.threema.domain.taskmanager.TaskCodec
|
|
import ch.threema.domain.taskmanager.TaskCodec
|
|
|
import ch.threema.storage.models.ContactModel
|
|
import ch.threema.storage.models.ContactModel
|
|
|
import com.neilalexander.jnacl.NaCl
|
|
import com.neilalexander.jnacl.NaCl
|
|
|
|
|
+import java.util.Date
|
|
|
import junit.framework.TestCase.assertEquals
|
|
import junit.framework.TestCase.assertEquals
|
|
|
import junit.framework.TestCase.assertNotNull
|
|
import junit.framework.TestCase.assertNotNull
|
|
|
import junit.framework.TestCase.fail
|
|
import junit.framework.TestCase.fail
|
|
|
import kotlinx.coroutines.runBlocking
|
|
import kotlinx.coroutines.runBlocking
|
|
|
import kotlinx.serialization.json.Json
|
|
import kotlinx.serialization.json.Json
|
|
|
import org.junit.Test
|
|
import org.junit.Test
|
|
|
-import java.util.Date
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* These tests are useful to detect when a task cannot be created out of a persisted representation
|
|
* These tests are useful to detect when a task cannot be created out of a persisted representation
|
|
@@ -55,7 +57,8 @@ class PersistableTasksTest {
|
|
|
fun testContactDeliveryReceiptMessageTask() {
|
|
fun testContactDeliveryReceiptMessageTask() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
OutgoingContactDeliveryReceiptMessageTask::class.java,
|
|
OutgoingContactDeliveryReceiptMessageTask::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.OutgoingContactDeliveryReceiptMessageTask.OutgoingDeliveryReceiptMessageData\",\"receiptType\":1,\"messageIds\":[\"0000000000000000\"],\"date\":\"1234567890\",\"toIdentity\":\"01234567\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.OutgoingContactDeliveryReceiptMessageTask.OutgoingDeliveryReceiptMessageData",""" +
|
|
|
|
|
+ """"receiptType":1,"messageIds":["0000000000000000"],"date":"1234567890","toIdentity":"01234567"}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -63,7 +66,8 @@ class PersistableTasksTest {
|
|
|
fun testFileMessageTask() {
|
|
fun testFileMessageTask() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
OutgoingFileMessageTask::class.java,
|
|
OutgoingFileMessageTask::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.OutgoingFileMessageTask.OutgoingFileMessageData\",\"messageModelId\":1,\"receiverType\":0,\"recipientIdentities\":[\"01234567\"],\"thumbnailBlobId\":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.OutgoingFileMessageTask.OutgoingFileMessageData","messageModelId":1,"receiverType":0,""" +
|
|
|
|
|
+ """"recipientIdentities":["01234567"],"thumbnailBlobId":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -71,7 +75,9 @@ class PersistableTasksTest {
|
|
|
fun testGroupDeleteProfilePictureTask() {
|
|
fun testGroupDeleteProfilePictureTask() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
OutgoingGroupDeleteProfilePictureTask::class.java,
|
|
OutgoingGroupDeleteProfilePictureTask::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.OutgoingGroupDeleteProfilePictureTask.OutgoingGroupDeleteProfilePictureData\",\"groupId\":[0,0,0,0,0,0,0,0],\"creatorIdentity\":\"01234567\",\"receiverIdentities\":[\"01234567\"],\"messageId\":[0,0,0,0,0,0,0,0]}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.OutgoingGroupDeleteProfilePictureTask.OutgoingGroupDeleteProfilePictureData",""" +
|
|
|
|
|
+ """"groupId":[0,0,0,0,0,0,0,0],"creatorIdentity":"01234567","receiverIdentities":["01234567"],""" +
|
|
|
|
|
+ """"messageId":[0,0,0,0,0,0,0,0]}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -79,7 +85,8 @@ class PersistableTasksTest {
|
|
|
fun testGroupDeliveryReceiptMessageTask() {
|
|
fun testGroupDeliveryReceiptMessageTask() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
OutgoingGroupDeliveryReceiptMessageTask::class.java,
|
|
OutgoingGroupDeliveryReceiptMessageTask::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.OutgoingGroupDeliveryReceiptMessageTask.OutgoingGroupDeliveryReceiptMessageData\",\"messageModelId\":0,\"recipientIdentities\":[\"01234567\",\"01234567\"],\"receiptType\":0}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.OutgoingGroupDeliveryReceiptMessageTask.OutgoingGroupDeliveryReceiptMessageData",""" +
|
|
|
|
|
+ """"messageModelId":0,"recipientIdentities":["01234567","01234567"],"receiptType":0}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -87,7 +94,9 @@ class PersistableTasksTest {
|
|
|
fun testGroupLeaveTask() {
|
|
fun testGroupLeaveTask() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
OutgoingGroupLeaveTask::class.java,
|
|
OutgoingGroupLeaveTask::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.OutgoingGroupLeaveTask.OutgoingGroupLeaveData\",\"groupId\":[0,0,0,0,0,0,0,0],\"creatorIdentity\":\"01234567\",\"receiverIdentities\":[\"01234567\"],\"messageId\":[0,0,0,0,0,0,0,0]}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.OutgoingGroupLeaveTask.OutgoingGroupLeaveTaskData",""" +
|
|
|
|
|
+ """"groupIdentity":{"creatorIdentity":"01234567","groupId":42},"memberIdentities":["01234567"],""" +
|
|
|
|
|
+ """"messageId":[0,0,0,0,0,0,0,0]}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -95,7 +104,9 @@ class PersistableTasksTest {
|
|
|
fun testGroupNameTask() {
|
|
fun testGroupNameTask() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
OutgoingGroupNameTask::class.java,
|
|
OutgoingGroupNameTask::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.OutgoingGroupNameTask.OutgoingGroupNameData\",\"groupId\":[0,0,0,0,0,0,0,0],\"creatorIdentity\":\"01234567\",\"groupName\":\"groupName\",\"receiverIdentities\":[\"01234567\"],\"messageId\":[0,0,0,0,0,0,0,0]}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.OutgoingGroupNameTask.OutgoingGroupNameData","groupId":[0,0,0,0,0,0,0,0],""" +
|
|
|
|
|
+ """"creatorIdentity":"01234567","groupName":"groupName","receiverIdentities":["01234567"],""" +
|
|
|
|
|
+ """"messageId":[0,0,0,0,0,0,0,0]}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -103,7 +114,9 @@ class PersistableTasksTest {
|
|
|
fun testGroupProfilePictureTask() {
|
|
fun testGroupProfilePictureTask() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
OutgoingGroupProfilePictureTask::class.java,
|
|
OutgoingGroupProfilePictureTask::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.OutgoingGroupProfilePictureTask.OutgoingGroupProfilePictureData\",\"groupId\":[0,0,0,0,0,0,0,0],\"creatorIdentity\":\"01234567\",\"receiverIdentities\":[\"01234567\"],\"messageId\":[0,0,0,0,0,0,0,0]}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.OutgoingGroupProfilePictureTask.OutgoingGroupProfilePictureData",""" +
|
|
|
|
|
+ """"groupId":[0,0,0,0,0,0,0,0],"creatorIdentity":"01234567","receiverIdentities":["01234567"],""" +
|
|
|
|
|
+ """"messageId":[0,0,0,0,0,0,0,0]}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -111,7 +124,9 @@ class PersistableTasksTest {
|
|
|
fun testGroupSetupTask() {
|
|
fun testGroupSetupTask() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
OutgoingGroupSetupTask::class.java,
|
|
OutgoingGroupSetupTask::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.OutgoingGroupSetupTask.OutgoingGroupSetupData\",\"groupId\":[0,0,0,0,0,0,0,0],\"creatorIdentity\":\"01234567\",\"memberIdentities\":[\"01234567\"],\"receiverIdentities\":[\"01234567\"],\"messageId\":[0,0,0,0,0,0,0,0]}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.OutgoingGroupSetupTask.OutgoingGroupSetupData","groupId":[0,0,0,0,0,0,0,0],""" +
|
|
|
|
|
+ """"creatorIdentity":"01234567","memberIdentities":["01234567"],"receiverIdentities":["01234567"],""" +
|
|
|
|
|
+ """"messageId":[0,0,0,0,0,0,0,0]}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -119,7 +134,8 @@ class PersistableTasksTest {
|
|
|
fun testGroupSyncRequestTask() {
|
|
fun testGroupSyncRequestTask() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
OutgoingGroupSyncRequestTask::class.java,
|
|
OutgoingGroupSyncRequestTask::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.OutgoingGroupSyncRequestTask.OutgoingGroupSyncRequestData\",\"groupId\":[0,0,0,0,0,0,0,0],\"creatorIdentity\":\"01234567\",\"messageId\":[0,0,0,0,0,0,0,0]}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.OutgoingGroupSyncRequestTask.OutgoingGroupSyncRequestData",""" +
|
|
|
|
|
+ """"groupId":[0,0,0,0,0,0,0,0],"creatorIdentity":"01234567","messageId":[0,0,0,0,0,0,0,0]}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -127,7 +143,8 @@ class PersistableTasksTest {
|
|
|
fun testGroupSyncTask() {
|
|
fun testGroupSyncTask() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
OutgoingGroupSyncTask::class.java,
|
|
OutgoingGroupSyncTask::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.OutgoingGroupSyncTask.OutgoingGroupSyncData\",\"groupId\":[0,0,0,0,0,0,0,0],\"creatorIdentity\":\"01234567\",\"receiverIdentities\":[\"01234567\"]}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.OutgoingGroupSyncTask.OutgoingGroupSyncData","groupId":[0,0,0,0,0,0,0,0],""" +
|
|
|
|
|
+ """"creatorIdentity":"01234567","receiverIdentities":["01234567"]}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -135,7 +152,8 @@ class PersistableTasksTest {
|
|
|
fun testLocationMessageTask() {
|
|
fun testLocationMessageTask() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
OutgoingLocationMessageTask::class.java,
|
|
OutgoingLocationMessageTask::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.OutgoingLocationMessageTask.OutgoingLocationMessageTaskData\",\"messageModelId\":0,\"recipientIdentities\":[\"01234567\",\"01234567\"],\"receiverType\":0}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.OutgoingLocationMessageTask.OutgoingLocationMessageTaskData","messageModelId":0,""" +
|
|
|
|
|
+ """"recipientIdentities":["01234567","01234567"],"receiverType":0}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -143,7 +161,10 @@ class PersistableTasksTest {
|
|
|
fun testPollSetupMessageTask() {
|
|
fun testPollSetupMessageTask() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
OutgoingPollSetupMessageTask::class.java,
|
|
OutgoingPollSetupMessageTask::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.OutgoingPollSetupMessageTask.OutgoingPollSetupMessageData\",\"messageModelId\":0,\"recipientIdentities\":[\"01234567\",\"01234567\"],\"receiverType\":0,\"ballotId\":[-58,11,102,-122,-119,-102,19,-10],\"ballotData\":\"{\\\"d\\\":\\\"description\\\",\\\"s\\\":0,\\\"a\\\":0,\\\"t\\\":1,\\\"o\\\":0,\\\"u\\\":0,\\\"c\\\":[{\\\"i\\\":0,\\\"n\\\":\\\"desc\\\",\\\"o\\\":0,\\\"r\\\":[0],\\\"t\\\":0}],\\\"p\\\":[\\\"01234567\\\"]}\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.OutgoingPollSetupMessageTask.OutgoingPollSetupMessageData","messageModelId":0,""" +
|
|
|
|
|
+ """"recipientIdentities":["01234567","01234567"],"receiverType":0,"ballotId":[-58,11,102,-122,-119,-102,19,-10],""" +
|
|
|
|
|
+ """"ballotData":"{\"d\":\"description\",\"s\":0,\"a\":0,\"t\":1,\"o\":0,\"u\":0,""" +
|
|
|
|
|
+ """\"c\":[{\"i\":0,\"n\":\"desc\",\"o\":0,\"r\":[0],\"t\":0}],\"p\":[\"01234567\"]}"}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -151,7 +172,9 @@ class PersistableTasksTest {
|
|
|
fun testPollVoteContactMessageTask() {
|
|
fun testPollVoteContactMessageTask() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
OutgoingPollVoteContactMessageTask::class.java,
|
|
OutgoingPollVoteContactMessageTask::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.OutgoingPollVoteContactMessageTask.OutgoingPollVoteContactMessageData\",\"messageId\":\"0000000000000000\",\"ballotId\":[-127,-79,80,-109,-98,62,-3,81],\"ballotCreator\":\"01234567\",\"ballotVotes\":[{\"first\":0,\"second\":0}],\"toIdentity\":\"01234567\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.OutgoingPollVoteContactMessageTask.OutgoingPollVoteContactMessageData",""" +
|
|
|
|
|
+ """"messageId":"0000000000000000","ballotId":[-127,-79,80,-109,-98,62,-3,81],"ballotCreator":"01234567",""" +
|
|
|
|
|
+ """"ballotVotes":[{"first":0,"second":0}],"toIdentity":"01234567"}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -159,7 +182,10 @@ class PersistableTasksTest {
|
|
|
fun testPollVoteGroupMessageTask() {
|
|
fun testPollVoteGroupMessageTask() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
OutgoingPollVoteGroupMessageTask::class.java,
|
|
OutgoingPollVoteGroupMessageTask::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.OutgoingPollVoteGroupMessageTask.OutgoingPollVoteGroupMessageData\",\"messageId\":\"0000000000000000\",\"recipientIdentities\":[\"01234567\",\"01234567\"],\"ballotId\":[52,64,-6,18,2,-71,124,-19],\"ballotCreator\":\"01234567\",\"ballotVotes\":[{\"first\":0,\"second\":0}],\"ballotType\":\"INTERMEDIATE\",\"apiGroupId\":\"0000000000000000\",\"groupCreator\":\"01234567\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.OutgoingPollVoteGroupMessageTask.OutgoingPollVoteGroupMessageData",""" +
|
|
|
|
|
+ """"messageId":"0000000000000000","recipientIdentities":["01234567","01234567"],"ballotId":[52,64,-6,18,2,-71,124,-19],""" +
|
|
|
|
|
+ """"ballotCreator":"01234567","ballotVotes":[{"first":0,"second":0}],"ballotType":"INTERMEDIATE",""" +
|
|
|
|
|
+ """"apiGroupId":"0000000000000000","groupCreator":"01234567"}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -167,7 +193,8 @@ class PersistableTasksTest {
|
|
|
fun testTextMessageTask() {
|
|
fun testTextMessageTask() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
OutgoingTextMessageTask::class.java,
|
|
OutgoingTextMessageTask::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.OutgoingTextMessageTask.OutgoingTextMessageData\",\"messageModelId\":0,\"recipientIdentities\":[\"01234567\",\"01234567\"],\"receiverType\":0}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.OutgoingTextMessageTask.OutgoingTextMessageData","messageModelId":0,""" +
|
|
|
|
|
+ """"recipientIdentities":["01234567","01234567"],"receiverType":0}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -175,7 +202,7 @@ class PersistableTasksTest {
|
|
|
fun testSendProfilePictureTask() {
|
|
fun testSendProfilePictureTask() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
SendProfilePictureTask::class.java,
|
|
SendProfilePictureTask::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.SendProfilePictureTask.SendProfilePictureData\",\"toIdentity\":\"01234567\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.SendProfilePictureTask.SendProfilePictureData","toIdentity":"01234567"}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -183,7 +210,7 @@ class PersistableTasksTest {
|
|
|
fun testSendPushTokenTask() {
|
|
fun testSendPushTokenTask() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
SendPushTokenTask::class.java,
|
|
SendPushTokenTask::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.SendPushTokenTask.SendPushTokenData\",\"token\":\"token\",\"tokenType\":0}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.SendPushTokenTask.SendPushTokenData","token":"token","tokenType":0}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -191,30 +218,35 @@ class PersistableTasksTest {
|
|
|
fun testOutgoingContactRequestProfilePictureTask() {
|
|
fun testOutgoingContactRequestProfilePictureTask() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
OutgoingContactRequestProfilePictureTask::class.java,
|
|
OutgoingContactRequestProfilePictureTask::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.OutgoingContactRequestProfilePictureTask.OutgoingContactRequestProfilePictureData\",\"toIdentity\":\"01234567\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.OutgoingContactRequestProfilePictureTask.OutgoingContactRequestProfilePictureData",""" +
|
|
|
|
|
+ """"toIdentity":"01234567"}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
@Test
|
|
|
fun testDeleteAndTerminateFSSessionsTask() {
|
|
fun testDeleteAndTerminateFSSessionsTask() {
|
|
|
// Add the contact '01234567' so that creating the tasks works
|
|
// Add the contact '01234567' so that creating the tasks works
|
|
|
- addTestIdentity()
|
|
|
|
|
|
|
+ addTestData()
|
|
|
|
|
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
DeleteAndTerminateFSSessionsTask::class.java,
|
|
DeleteAndTerminateFSSessionsTask::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.DeleteAndTerminateFSSessionsTask.DeleteAndTerminateFSSessionsTaskData\",\"identity\":\"01234567\",\"cause\":\"RESET\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.DeleteAndTerminateFSSessionsTask.DeleteAndTerminateFSSessionsTaskData",""" +
|
|
|
|
|
+ """"identity":"01234567","cause":"RESET"}""",
|
|
|
)
|
|
)
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
DeleteAndTerminateFSSessionsTask::class.java,
|
|
DeleteAndTerminateFSSessionsTask::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.DeleteAndTerminateFSSessionsTask.DeleteAndTerminateFSSessionsTaskData\",\"identity\":\"01234567\",\"cause\":\"UNKNOWN_SESSION\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.DeleteAndTerminateFSSessionsTask.DeleteAndTerminateFSSessionsTaskData",""" +
|
|
|
|
|
+ """"identity":"01234567","cause":"UNKNOWN_SESSION"}""",
|
|
|
)
|
|
)
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
DeleteAndTerminateFSSessionsTask::class.java,
|
|
DeleteAndTerminateFSSessionsTask::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.DeleteAndTerminateFSSessionsTask.DeleteAndTerminateFSSessionsTaskData\",\"identity\":\"01234567\",\"cause\":\"DISABLED_BY_LOCAL\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.DeleteAndTerminateFSSessionsTask.DeleteAndTerminateFSSessionsTaskData",""" +
|
|
|
|
|
+ """"identity":"01234567","cause":"DISABLED_BY_LOCAL"}""",
|
|
|
)
|
|
)
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
DeleteAndTerminateFSSessionsTask::class.java,
|
|
DeleteAndTerminateFSSessionsTask::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.DeleteAndTerminateFSSessionsTask.DeleteAndTerminateFSSessionsTaskData\",\"identity\":\"01234567\",\"cause\":\"DISABLED_BY_REMOTE\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.DeleteAndTerminateFSSessionsTask.DeleteAndTerminateFSSessionsTaskData",""" +
|
|
|
|
|
+ """"identity":"01234567","cause":"DISABLED_BY_REMOTE"}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -222,7 +254,7 @@ class PersistableTasksTest {
|
|
|
fun testApplicationUpdateStepsTask() {
|
|
fun testApplicationUpdateStepsTask() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
ApplicationUpdateStepsTask::class.java,
|
|
ApplicationUpdateStepsTask::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.ApplicationUpdateStepsTask.ApplicationUpdateStepsData\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.ApplicationUpdateStepsTask.ApplicationUpdateStepsData"}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -230,7 +262,7 @@ class PersistableTasksTest {
|
|
|
fun testFSRefreshStepsTask() {
|
|
fun testFSRefreshStepsTask() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
FSRefreshStepsTask::class.java,
|
|
FSRefreshStepsTask::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.FSRefreshStepsTask.FSRefreshStepsTaskData\",\"contactIdentities\":[\"01234567\"]}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.FSRefreshStepsTask.FSRefreshStepsTaskData","contactIdentities":["01234567"]}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -238,7 +270,8 @@ class PersistableTasksTest {
|
|
|
fun testOutboundIncomingContactMessageUpdateReadTask() {
|
|
fun testOutboundIncomingContactMessageUpdateReadTask() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
OutboundIncomingContactMessageUpdateReadTask::class.java,
|
|
OutboundIncomingContactMessageUpdateReadTask::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.OutboundIncomingContactMessageUpdateReadTask.OutboundIncomingContactMessageUpdateReadData\",\"messageIds\":[[0,-1,2,3,4,5,6,7]],\"timestamp\":1704067200000,\"recipientIdentity\":\"01234567\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.OutboundIncomingContactMessageUpdateReadTask.OutboundIncomingContactMessageUpdateReadData",""" +
|
|
|
|
|
+ """"messageIds":[[0,-1,2,3,4,5,6,7]],"timestamp":1704067200000,"recipientIdentity":"01234567"}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -246,7 +279,9 @@ class PersistableTasksTest {
|
|
|
fun testOutboundIncomingGroupMessageUpdateReadTask() {
|
|
fun testOutboundIncomingGroupMessageUpdateReadTask() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
OutboundIncomingGroupMessageUpdateReadTask::class.java,
|
|
OutboundIncomingGroupMessageUpdateReadTask::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.OutboundIncomingGroupMessageUpdateReadTask.OutboundIncomingGroupMessageUpdateReadData\",\"messageIds\":[[0,-1,2,3,4,5,6,7]],\"timestamp\":1704067200000,\"groupId\":[0,0,0,0,0,0,0,0],\"creatorIdentity\":\"01234567\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.OutboundIncomingGroupMessageUpdateReadTask.OutboundIncomingGroupMessageUpdateReadData",""" +
|
|
|
|
|
+ """"messageIds":[[0,-1,2,3,4,5,6,7]],"timestamp":1704067200000,"groupId":[0,0,0,0,0,0,0,0],""" +
|
|
|
|
|
+ """"creatorIdentity":"01234567"}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -254,7 +289,8 @@ class PersistableTasksTest {
|
|
|
fun testOutgoingContactEditMessageTask() {
|
|
fun testOutgoingContactEditMessageTask() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
OutgoingContactEditMessageTask::class.java,
|
|
OutgoingContactEditMessageTask::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.OutgoingContactEditMessageTask.OutgoingContactEditMessageData\",\"toIdentity\":\"01234567\",\"messageModelId\":0, \"messageId\":[0,0,0,0,0,0,0,0], \"editedText\":\"test\", \"editedAt\":0}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.OutgoingContactEditMessageTask.OutgoingContactEditMessageData",""" +
|
|
|
|
|
+ """"toIdentity":"01234567","messageModelId":0, "messageId":[0,0,0,0,0,0,0,0], "editedText":"test", "editedAt":0}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -262,7 +298,8 @@ class PersistableTasksTest {
|
|
|
fun testOutgoingGroupEditMessageTask() {
|
|
fun testOutgoingGroupEditMessageTask() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
OutgoingGroupEditMessageTask::class.java,
|
|
OutgoingGroupEditMessageTask::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.OutgoingGroupEditMessageTask.OutgoingGroupEditMessageData\",\"messageModelId\":0, \"messageId\":[0,0,0,0,0,0,0,0], \"editedText\":\"test\", \"editedAt\":0,\"recipientIdentities\":[\"01234567\",\"01234567\"]}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.OutgoingGroupEditMessageTask.OutgoingGroupEditMessageData","messageModelId":0, """ +
|
|
|
|
|
+ """"messageId":[0,0,0,0,0,0,0,0], "editedText":"test", "editedAt":0,"recipientIdentities":["01234567","01234567"]}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -270,7 +307,8 @@ class PersistableTasksTest {
|
|
|
fun testOutgoingContactDeleteMessageTask() {
|
|
fun testOutgoingContactDeleteMessageTask() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
OutgoingContactDeleteMessageTask::class.java,
|
|
OutgoingContactDeleteMessageTask::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.OutgoingContactDeleteMessageTask.OutgoingContactDeleteMessageData\",\"toIdentity\":\"01234567\",\"messageModelId\":0, \"messageId\":[0,0,0,0,0,0,0,0], \"deletedAt\":0}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.OutgoingContactDeleteMessageTask.OutgoingContactDeleteMessageData",""" +
|
|
|
|
|
+ """"toIdentity":"01234567","messageModelId":0, "messageId":[0,0,0,0,0,0,0,0], "deletedAt":0}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -278,7 +316,8 @@ class PersistableTasksTest {
|
|
|
fun testOutgoingGroupDeleteMessageTask() {
|
|
fun testOutgoingGroupDeleteMessageTask() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
OutgoingGroupDeleteMessageTask::class.java,
|
|
OutgoingGroupDeleteMessageTask::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.OutgoingGroupDeleteMessageTask.OutgoingGroupDeleteMessageData\",\"messageModelId\":0,\"messageId\":[0,0,0,0,0,0,0,0],\"deletedAt\":0,\"recipientIdentities\":[\"01234567\",\"01234567\"]}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.OutgoingGroupDeleteMessageTask.OutgoingGroupDeleteMessageData",""" +
|
|
|
|
|
+ """"messageModelId":0,"messageId":[0,0,0,0,0,0,0,0],"deletedAt":0,"recipientIdentities":["01234567","01234567"]}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -286,7 +325,8 @@ class PersistableTasksTest {
|
|
|
fun testReflectUserProfileNicknameSyncTask() {
|
|
fun testReflectUserProfileNicknameSyncTask() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
ReflectUserProfileNicknameSyncTask::class.java,
|
|
ReflectUserProfileNicknameSyncTask::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.ReflectUserProfileNicknameSyncTask.ReflectUserProfileNicknameSyncTaskData\",\"newNickname\":\"nick\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.ReflectUserProfileNicknameSyncTask.ReflectUserProfileNicknameSyncTaskData",""" +
|
|
|
|
|
+ """"newNickname":"nick"}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -294,7 +334,7 @@ class PersistableTasksTest {
|
|
|
fun testReflectUserProfilePictureSyncTask() {
|
|
fun testReflectUserProfilePictureSyncTask() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
ReflectUserProfilePictureSyncTask::class.java,
|
|
ReflectUserProfilePictureSyncTask::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.ReflectUserProfilePictureSyncTask.ReflectUserProfilePictureSyncTaskData\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.ReflectUserProfilePictureSyncTask.ReflectUserProfilePictureSyncTaskData"}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -302,7 +342,8 @@ class PersistableTasksTest {
|
|
|
fun testReflectUserProfileShareWithPolicySyncTask() {
|
|
fun testReflectUserProfileShareWithPolicySyncTask() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
ReflectUserProfileShareWithPolicySyncTask::class.java,
|
|
ReflectUserProfileShareWithPolicySyncTask::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.ReflectUserProfileShareWithPolicySyncTask.ReflectUserProfileShareWithPolicySyncTaskData\",\"newPolicy\":\"NOBODY\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.ReflectUserProfileShareWithPolicySyncTask.ReflectUserProfileShareWithPolicySyncTaskData",""" +
|
|
|
|
|
+ """"newPolicy":"NOBODY"}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -310,7 +351,17 @@ class PersistableTasksTest {
|
|
|
fun testReflectUserProfileShareWithAllowListSyncTask() {
|
|
fun testReflectUserProfileShareWithAllowListSyncTask() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
ReflectUserProfileShareWithAllowListSyncTask::class.java,
|
|
ReflectUserProfileShareWithAllowListSyncTask::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.ReflectUserProfileShareWithAllowListSyncTask.ReflectUserProfileShareWithAllowListSyncTaskData\",\"allowedIdentities\":[\"01234567\", \"01234568\"]}"
|
|
|
|
|
|
|
+ """{"type":""" +
|
|
|
|
|
+ """"ch.threema.app.tasks.ReflectUserProfileShareWithAllowListSyncTask.ReflectUserProfileShareWithAllowListSyncTaskData",""" +
|
|
|
|
|
+ """"allowedIdentities":["01234567", "01234568"]}""",
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Test
|
|
|
|
|
+ fun testReflectUserProfileIdentityLinksTask() {
|
|
|
|
|
+ assertValidEncoding(
|
|
|
|
|
+ expectedTaskClass = ReflectUserProfileIdentityLinksTask::class.java,
|
|
|
|
|
+ encodedTask = """{"type":"ch.threema.app.tasks.ReflectUserProfileIdentityLinksTask.ReflectUserProfileIdentityLinksTaskData"}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -318,15 +369,18 @@ class PersistableTasksTest {
|
|
|
fun testReflectNameUpdate() {
|
|
fun testReflectNameUpdate() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
ReflectContactSyncUpdateTask.ReflectNameUpdate::class.java,
|
|
ReflectContactSyncUpdateTask.ReflectNameUpdate::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectNameUpdate.ReflectNameUpdateData\",\"firstName\":\"A\",\"lastName\":\"B\",\"identity\":\"01234567\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectNameUpdate.ReflectNameUpdateData",""" +
|
|
|
|
|
+ """"firstName":"A","lastName":"B","identity":"01234567"}""",
|
|
|
)
|
|
)
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
ReflectContactSyncUpdateTask.ReflectNameUpdate::class.java,
|
|
ReflectContactSyncUpdateTask.ReflectNameUpdate::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectNameUpdate.ReflectNameUpdateData\",\"firstName\":\"A\",\"lastName\":\"\",\"identity\":\"01234567\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectNameUpdate.ReflectNameUpdateData",""" +
|
|
|
|
|
+ """"firstName":"A","lastName":"","identity":"01234567"}""",
|
|
|
)
|
|
)
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
ReflectContactSyncUpdateTask.ReflectNameUpdate::class.java,
|
|
ReflectContactSyncUpdateTask.ReflectNameUpdate::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectNameUpdate.ReflectNameUpdateData\",\"firstName\":\"\",\"lastName\":\"B\",\"identity\":\"01234567\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectNameUpdate.ReflectNameUpdateData",""" +
|
|
|
|
|
+ """"firstName":"","lastName":"B","identity":"01234567"}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -334,15 +388,18 @@ class PersistableTasksTest {
|
|
|
fun testReflectReadReceiptPolicyUpdate() {
|
|
fun testReflectReadReceiptPolicyUpdate() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
ReflectContactSyncUpdateTask.ReflectReadReceiptPolicyUpdate::class.java,
|
|
ReflectContactSyncUpdateTask.ReflectReadReceiptPolicyUpdate::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectReadReceiptPolicyUpdate.ReflectReadReceiptPolicyUpdateData\",\"readReceiptPolicy\":\"DEFAULT\",\"identity\":\"01234567\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectReadReceiptPolicyUpdate.ReflectReadReceiptPolicyUpdateData",""" +
|
|
|
|
|
+ """"readReceiptPolicy":"DEFAULT","identity":"01234567"}""",
|
|
|
)
|
|
)
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
ReflectContactSyncUpdateTask.ReflectReadReceiptPolicyUpdate::class.java,
|
|
ReflectContactSyncUpdateTask.ReflectReadReceiptPolicyUpdate::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectReadReceiptPolicyUpdate.ReflectReadReceiptPolicyUpdateData\",\"readReceiptPolicy\":\"SEND\",\"identity\":\"01234567\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectReadReceiptPolicyUpdate.ReflectReadReceiptPolicyUpdateData",""" +
|
|
|
|
|
+ """"readReceiptPolicy":"SEND","identity":"01234567"}""",
|
|
|
)
|
|
)
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
ReflectContactSyncUpdateTask.ReflectReadReceiptPolicyUpdate::class.java,
|
|
ReflectContactSyncUpdateTask.ReflectReadReceiptPolicyUpdate::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectReadReceiptPolicyUpdate.ReflectReadReceiptPolicyUpdateData\",\"readReceiptPolicy\":\"DONT_SEND\",\"identity\":\"01234567\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectReadReceiptPolicyUpdate.ReflectReadReceiptPolicyUpdateData",""" +
|
|
|
|
|
+ """"readReceiptPolicy":"DONT_SEND","identity":"01234567"}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -350,15 +407,18 @@ class PersistableTasksTest {
|
|
|
fun testReflectTypingIndicatorPolicyUpdate() {
|
|
fun testReflectTypingIndicatorPolicyUpdate() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
ReflectContactSyncUpdateTask.ReflectTypingIndicatorPolicyUpdate::class.java,
|
|
ReflectContactSyncUpdateTask.ReflectTypingIndicatorPolicyUpdate::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectTypingIndicatorPolicyUpdate.ReflectTypingIndicatorPolicyUpdateData\",\"typingIndicatorPolicy\":\"DEFAULT\",\"identity\":\"01234567\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectTypingIndicatorPolicyUpdate.""" +
|
|
|
|
|
+ """ReflectTypingIndicatorPolicyUpdateData","typingIndicatorPolicy":"DEFAULT","identity":"01234567"}""",
|
|
|
)
|
|
)
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
ReflectContactSyncUpdateTask.ReflectTypingIndicatorPolicyUpdate::class.java,
|
|
ReflectContactSyncUpdateTask.ReflectTypingIndicatorPolicyUpdate::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectTypingIndicatorPolicyUpdate.ReflectTypingIndicatorPolicyUpdateData\",\"typingIndicatorPolicy\":\"SEND\",\"identity\":\"01234567\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectTypingIndicatorPolicyUpdate.""" +
|
|
|
|
|
+ """ReflectTypingIndicatorPolicyUpdateData","typingIndicatorPolicy":"SEND","identity":"01234567"}""",
|
|
|
)
|
|
)
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
ReflectContactSyncUpdateTask.ReflectTypingIndicatorPolicyUpdate::class.java,
|
|
ReflectContactSyncUpdateTask.ReflectTypingIndicatorPolicyUpdate::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectTypingIndicatorPolicyUpdate.ReflectTypingIndicatorPolicyUpdateData\",\"typingIndicatorPolicy\":\"DONT_SEND\",\"identity\":\"01234567\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectTypingIndicatorPolicyUpdate.""" +
|
|
|
|
|
+ """ReflectTypingIndicatorPolicyUpdateData","typingIndicatorPolicy":"DONT_SEND","identity":"01234567"}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -366,15 +426,18 @@ class PersistableTasksTest {
|
|
|
fun testReflectActivityStateUpdate() {
|
|
fun testReflectActivityStateUpdate() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
ReflectContactSyncUpdateTask.ReflectActivityStateUpdate::class.java,
|
|
ReflectContactSyncUpdateTask.ReflectActivityStateUpdate::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectActivityStateUpdate.ReflectActivityStateUpdateData\",\"identityState\":\"ACTIVE\",\"identity\":\"01234567\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectActivityStateUpdate.ReflectActivityStateUpdateData",""" +
|
|
|
|
|
+ """"identityState":"ACTIVE","identity":"01234567"}""",
|
|
|
)
|
|
)
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
ReflectContactSyncUpdateTask.ReflectActivityStateUpdate::class.java,
|
|
ReflectContactSyncUpdateTask.ReflectActivityStateUpdate::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectActivityStateUpdate.ReflectActivityStateUpdateData\",\"identityState\":\"INACTIVE\",\"identity\":\"01234567\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectActivityStateUpdate.ReflectActivityStateUpdateData",""" +
|
|
|
|
|
+ """"identityState":"INACTIVE","identity":"01234567"}""",
|
|
|
)
|
|
)
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
ReflectContactSyncUpdateTask.ReflectActivityStateUpdate::class.java,
|
|
ReflectContactSyncUpdateTask.ReflectActivityStateUpdate::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectActivityStateUpdate.ReflectActivityStateUpdateData\",\"identityState\":\"INVALID\",\"identity\":\"01234567\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectActivityStateUpdate.ReflectActivityStateUpdateData",""" +
|
|
|
|
|
+ """"identityState":"INVALID","identity":"01234567"}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -382,7 +445,8 @@ class PersistableTasksTest {
|
|
|
fun testReflectFeatureMaskUpdate() {
|
|
fun testReflectFeatureMaskUpdate() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
ReflectContactSyncUpdateTask.ReflectFeatureMaskUpdate::class.java,
|
|
ReflectContactSyncUpdateTask.ReflectFeatureMaskUpdate::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectFeatureMaskUpdate.ReflectFeatureMaskUpdateData\",\"featureMask\":12345,\"identity\":\"01234567\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectFeatureMaskUpdate.ReflectFeatureMaskUpdateData",""" +
|
|
|
|
|
+ """"featureMask":12345,"identity":"01234567"}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -390,15 +454,18 @@ class PersistableTasksTest {
|
|
|
fun testVerificationLevelUpdate() {
|
|
fun testVerificationLevelUpdate() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
ReflectContactSyncUpdateTask.ReflectVerificationLevelUpdate::class.java,
|
|
ReflectContactSyncUpdateTask.ReflectVerificationLevelUpdate::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectVerificationLevelUpdate.ReflectVerificationLevelUpdateData\",\"verificationLevel\":\"UNVERIFIED\",\"identity\":\"01234567\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectVerificationLevelUpdate.ReflectVerificationLevelUpdateData",""" +
|
|
|
|
|
+ """"verificationLevel":"UNVERIFIED","identity":"01234567"}""",
|
|
|
)
|
|
)
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
ReflectContactSyncUpdateTask.ReflectVerificationLevelUpdate::class.java,
|
|
ReflectContactSyncUpdateTask.ReflectVerificationLevelUpdate::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectVerificationLevelUpdate.ReflectVerificationLevelUpdateData\",\"verificationLevel\":\"SERVER_VERIFIED\",\"identity\":\"01234567\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectVerificationLevelUpdate.ReflectVerificationLevelUpdateData",""" +
|
|
|
|
|
+ """"verificationLevel":"SERVER_VERIFIED","identity":"01234567"}""",
|
|
|
)
|
|
)
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
ReflectContactSyncUpdateTask.ReflectVerificationLevelUpdate::class.java,
|
|
ReflectContactSyncUpdateTask.ReflectVerificationLevelUpdate::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectVerificationLevelUpdate.ReflectVerificationLevelUpdateData\",\"verificationLevel\":\"FULLY_VERIFIED\",\"identity\":\"01234567\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectVerificationLevelUpdate.ReflectVerificationLevelUpdateData",""" +
|
|
|
|
|
+ """"verificationLevel":"FULLY_VERIFIED","identity":"01234567"}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -406,11 +473,13 @@ class PersistableTasksTest {
|
|
|
fun testWorkVerificationLevelUpdate() {
|
|
fun testWorkVerificationLevelUpdate() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
ReflectContactSyncUpdateTask.ReflectWorkVerificationLevelUpdate::class.java,
|
|
ReflectContactSyncUpdateTask.ReflectWorkVerificationLevelUpdate::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectWorkVerificationLevelUpdate.ReflectWorkVerificationLevelUpdateData\",\"workVerificationLevel\":\"NONE\",\"identity\":\"01234567\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectWorkVerificationLevelUpdate.""" +
|
|
|
|
|
+ """ReflectWorkVerificationLevelUpdateData","workVerificationLevel":"NONE","identity":"01234567"}""",
|
|
|
)
|
|
)
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
ReflectContactSyncUpdateTask.ReflectWorkVerificationLevelUpdate::class.java,
|
|
ReflectContactSyncUpdateTask.ReflectWorkVerificationLevelUpdate::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectWorkVerificationLevelUpdate.ReflectWorkVerificationLevelUpdateData\",\"workVerificationLevel\":\"WORK_SUBSCRIPTION_VERIFIED\",\"identity\":\"01234567\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectWorkVerificationLevelUpdate.""" +
|
|
|
|
|
+ """ReflectWorkVerificationLevelUpdateData","workVerificationLevel":"WORK_SUBSCRIPTION_VERIFIED","identity":"01234567"}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -418,11 +487,13 @@ class PersistableTasksTest {
|
|
|
fun testIdentityTypeUpdate() {
|
|
fun testIdentityTypeUpdate() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
ReflectContactSyncUpdateTask.ReflectIdentityTypeUpdate::class.java,
|
|
ReflectContactSyncUpdateTask.ReflectIdentityTypeUpdate::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectIdentityTypeUpdate.ReflectIdentityTypeUpdateData\",\"identityType\":\"NORMAL\",\"identity\":\"01234567\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectIdentityTypeUpdate.ReflectIdentityTypeUpdateData",""" +
|
|
|
|
|
+ """"identityType":"NORMAL","identity":"01234567"}""",
|
|
|
)
|
|
)
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
ReflectContactSyncUpdateTask.ReflectIdentityTypeUpdate::class.java,
|
|
ReflectContactSyncUpdateTask.ReflectIdentityTypeUpdate::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectIdentityTypeUpdate.ReflectIdentityTypeUpdateData\",\"identityType\":\"WORK\",\"identity\":\"01234567\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectIdentityTypeUpdate.ReflectIdentityTypeUpdateData",""" +
|
|
|
|
|
+ """"identityType":"WORK","identity":"01234567"}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -430,11 +501,13 @@ class PersistableTasksTest {
|
|
|
fun testAcquaintanceLevelUpdate() {
|
|
fun testAcquaintanceLevelUpdate() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
ReflectContactSyncUpdateTask.ReflectAcquaintanceLevelUpdate::class.java,
|
|
ReflectContactSyncUpdateTask.ReflectAcquaintanceLevelUpdate::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectAcquaintanceLevelUpdate.ReflectAcquaintanceLevelUpdateData\",\"acquaintanceLevel\":\"DIRECT\",\"identity\":\"01234567\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectAcquaintanceLevelUpdate.ReflectAcquaintanceLevelUpdateData",""" +
|
|
|
|
|
+ """"acquaintanceLevel":"DIRECT","identity":"01234567"}""",
|
|
|
)
|
|
)
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
ReflectContactSyncUpdateTask.ReflectAcquaintanceLevelUpdate::class.java,
|
|
ReflectContactSyncUpdateTask.ReflectAcquaintanceLevelUpdate::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectAcquaintanceLevelUpdate.ReflectAcquaintanceLevelUpdateData\",\"acquaintanceLevel\":\"GROUP\",\"identity\":\"01234567\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectAcquaintanceLevelUpdate.ReflectAcquaintanceLevelUpdateData",""" +
|
|
|
|
|
+ """"acquaintanceLevel":"GROUP","identity":"01234567"}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -442,18 +515,19 @@ class PersistableTasksTest {
|
|
|
fun testUserDefinedProfilePictureUpdate() {
|
|
fun testUserDefinedProfilePictureUpdate() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
ReflectContactSyncUpdateTask.ReflectUserDefinedProfilePictureUpdate::class.java,
|
|
ReflectContactSyncUpdateTask.ReflectUserDefinedProfilePictureUpdate::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectUserDefinedProfilePictureUpdate.ReflectUserDefinedProfilePictureUpdateData\",\"identity\":\"0BZYE2H9\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectUserDefinedProfilePictureUpdate.""" +
|
|
|
|
|
+ """ReflectUserDefinedProfilePictureUpdateData","identity":"0BZYE2H9"}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
@Test
|
|
|
fun testOnFSFeatureMaskDowngradedTask() {
|
|
fun testOnFSFeatureMaskDowngradedTask() {
|
|
|
// Add the contact '01234567' so that creating the tasks works
|
|
// Add the contact '01234567' so that creating the tasks works
|
|
|
- addTestIdentity()
|
|
|
|
|
|
|
+ addTestData()
|
|
|
|
|
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
OnFSFeatureMaskDowngradedTask::class.java,
|
|
OnFSFeatureMaskDowngradedTask::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.OnFSFeatureMaskDowngradedTask.OnFSFeatureMaskDowngradedData\",\"identity\":\"01234567\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.OnFSFeatureMaskDowngradedTask.OnFSFeatureMaskDowngradedData","identity":"01234567"}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -461,7 +535,8 @@ class PersistableTasksTest {
|
|
|
fun testReflectUnknownContactPolicyUpdate() {
|
|
fun testReflectUnknownContactPolicyUpdate() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
ReflectSettingsSyncTask.ReflectUnknownContactPolicySyncUpdate::class.java,
|
|
ReflectSettingsSyncTask.ReflectUnknownContactPolicySyncUpdate::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.ReflectSettingsSyncTask.ReflectUnknownContactPolicySyncUpdate.ReflectUnknownContactPolicySyncUpdateData\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.ReflectSettingsSyncTask.ReflectUnknownContactPolicySyncUpdate.""" +
|
|
|
|
|
+ """ReflectUnknownContactPolicySyncUpdateData"}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -469,7 +544,7 @@ class PersistableTasksTest {
|
|
|
fun testReflectReadReceiptPolicySyncUpdate() {
|
|
fun testReflectReadReceiptPolicySyncUpdate() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
ReflectSettingsSyncTask.ReflectReadReceiptPolicySyncUpdate::class.java,
|
|
ReflectSettingsSyncTask.ReflectReadReceiptPolicySyncUpdate::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.ReflectSettingsSyncTask.ReflectReadReceiptPolicySyncUpdate.ReadReceiptPolicySyncUpdateData\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.ReflectSettingsSyncTask.ReflectReadReceiptPolicySyncUpdate.ReadReceiptPolicySyncUpdateData"}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -477,7 +552,8 @@ class PersistableTasksTest {
|
|
|
fun testReflectTypingIndicatorPolicySyncUpdate() {
|
|
fun testReflectTypingIndicatorPolicySyncUpdate() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
ReflectSettingsSyncTask.ReflectTypingIndicatorPolicySyncUpdate::class.java,
|
|
ReflectSettingsSyncTask.ReflectTypingIndicatorPolicySyncUpdate::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.ReflectSettingsSyncTask.ReflectTypingIndicatorPolicySyncUpdate.ReflectTypingIndicatorPolicySyncUpdateData\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.ReflectSettingsSyncTask.ReflectTypingIndicatorPolicySyncUpdate.""" +
|
|
|
|
|
+ """ReflectTypingIndicatorPolicySyncUpdateData"}""",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -485,17 +561,150 @@ class PersistableTasksTest {
|
|
|
fun testReflectBlockedIdentitiesSyncUpdate() {
|
|
fun testReflectBlockedIdentitiesSyncUpdate() {
|
|
|
assertValidEncoding(
|
|
assertValidEncoding(
|
|
|
ReflectSettingsSyncTask.ReflectBlockedIdentitiesSyncUpdate::class.java,
|
|
ReflectSettingsSyncTask.ReflectBlockedIdentitiesSyncUpdate::class.java,
|
|
|
- "{\"type\":\"ch.threema.app.tasks.ReflectSettingsSyncTask.ReflectBlockedIdentitiesSyncUpdate.ReflectBlockedIdentitiesSyncUpdateData\"}"
|
|
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.ReflectSettingsSyncTask.ReflectBlockedIdentitiesSyncUpdate.ReflectBlockedIdentitiesSyncUpdateData"}""",
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Test
|
|
|
|
|
+ fun testGroupCreateTask() {
|
|
|
|
|
+ assertValidEncoding(
|
|
|
|
|
+ GroupCreateTask::class.java,
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.GroupCreateTask.GroupCreateTaskData","name":"Name","profilePictureChange":""" +
|
|
|
|
|
+ """{"type":"ch.threema.app.protocol.RemoveProfilePicture"},"members":["TESTTEST","01234567"],"groupIdentity":""" +
|
|
|
|
|
+ """{"creatorIdentity":"01234567","groupId":42},"predefinedMessageIds":{"messageIdBytes1":[-121,-57,86,-82,-126,8,80,89],""" +
|
|
|
|
|
+ """"messageIdBytes2":[54,-9,56,45,19,79,-33,80],"messageIdBytes3":[-62,57,-64,-73,-95,78,59,82],""" +
|
|
|
|
|
+ """"messageIdBytes4":[-59,-117,93,109,46,-10,-119,118]}}""",
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Test
|
|
|
|
|
+ fun testGroupUpdateTask() {
|
|
|
|
|
+ assertValidEncoding(
|
|
|
|
|
+ GroupUpdateTask::class.java,
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.GroupUpdateTask.GroupUpdateTaskData","name":"Name","profilePictureChange":""" +
|
|
|
|
|
+ """{"type":"ch.threema.app.protocol.RemoveProfilePicture"},"updatedMembers":["01234567"],"addedMembers":["TESTTEST",""" +
|
|
|
|
|
+ """"01234567"],"removedMembers":["01234567"],"groupIdentity":{"creatorIdentity":"01234567","groupId":42},""" +
|
|
|
|
|
+ """"predefinedMessageIds":{"messageIdBytes1":[5,-23,34,43,-15,49,22,-42],"messageIdBytes2":[-62,55,62,-15,-110,-56,58,-103],""" +
|
|
|
|
|
+ """"messageIdBytes3":[-128,28,-10,110,14,-39,105,-105],"messageIdBytes4":[-9,115,118,38,-118,-73,99,89]}}""",
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Test
|
|
|
|
|
+ fun testOutgoingGroupDisbandTask() {
|
|
|
|
|
+ assertValidEncoding(
|
|
|
|
|
+ OutgoingGroupDisbandTask::class.java,
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.OutgoingGroupDisbandTask.OutgoingGroupDisbandTaskData","groupIdentity":""" +
|
|
|
|
|
+ """{"creatorIdentity":"TESTTEST","groupId":42},"members":["01234567"],"messageId":[0,1,2,3,4,5,6,7]}""",
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Test
|
|
|
|
|
+ fun testContactNotificationTriggerPolicyOverrideUpdate() {
|
|
|
|
|
+ assertValidEncoding(
|
|
|
|
|
+ ReflectContactSyncUpdateTask.ReflectNotificationTriggerPolicyOverrideUpdate::class.java,
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectNotificationTriggerPolicyOverrideUpdate.""" +
|
|
|
|
|
+ """ReflectNotificationTriggerPolicyOverrideUpdateData","notificationTriggerPolicyOverride":1740396679447,""" +
|
|
|
|
|
+ """"contactIdentity":"01234567"}""",
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Test
|
|
|
|
|
+ fun testGroupNotificationTriggerPolicyOverrideUpdate() {
|
|
|
|
|
+ addTestData()
|
|
|
|
|
+ assertValidEncoding(
|
|
|
|
|
+ ReflectGroupSyncUpdateTask.ReflectNotificationTriggerPolicyOverrideUpdate::class.java,
|
|
|
|
|
+ """{"type":"ch.threema.app.tasks.ReflectGroupSyncUpdateTask.ReflectNotificationTriggerPolicyOverrideUpdate.""" +
|
|
|
|
|
+ """ReflectNotificationTriggerPolicyOverrideUpdateData","newNotificationTriggerPolicyOverride":""" +
|
|
|
|
|
+ """{"type":"ch.threema.data.datatypes.NotificationTriggerPolicyOverride.MutedUntil","dbValue":1740396953761,""" +
|
|
|
|
|
+ """"utcMillis":1740396953761},"groupIdentity":{"creatorIdentity":"01234567","groupId":6361180283070237492}}""",
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Test
|
|
|
|
|
+ fun testReflectContactConversationCategoryUpdate() {
|
|
|
|
|
+ assertValidEncoding(
|
|
|
|
|
+ expectedTaskClass = ReflectContactSyncUpdateTask.ReflectConversationCategoryUpdate::class.java,
|
|
|
|
|
+ encodedTask = "{\"type\":\"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectConversationCategoryUpdate" +
|
|
|
|
|
+ ".ReflectContactConversationCategoryUpdateData\",\"contactIdentity\":\"01234567\",\"isPrivateChat\":true}",
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private fun addTestIdentity() = runBlocking {
|
|
|
|
|
|
|
+ @Test
|
|
|
|
|
+ fun testReflectGroupConversationCategoryUpdate() {
|
|
|
|
|
+ addTestData()
|
|
|
|
|
+ assertValidEncoding(
|
|
|
|
|
+ expectedTaskClass = ReflectGroupSyncUpdateTask.ReflectGroupConversationCategoryUpdateTask::class.java,
|
|
|
|
|
+ encodedTask = "{\"type\":\"ch.threema.app.tasks.ReflectGroupSyncUpdateTask.ReflectGroupConversationCategoryUpdateTask" +
|
|
|
|
|
+ ".ReflectGroupConversationCategoryData\",\"groupIdentity\":{\"creatorIdentity\":\"01234567\",\"groupId\":6361180283070237492}" +
|
|
|
|
|
+ "\"isPrivateChat\":true}",
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Test
|
|
|
|
|
+ fun testReflectContactConversationVisibilityArchiveUpdate() {
|
|
|
|
|
+ assertValidEncoding(
|
|
|
|
|
+ ReflectContactSyncUpdateTask.ReflectConversationVisibilityArchiveUpdate::class.java,
|
|
|
|
|
+ "{\"type\":\"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectConversationVisibilityArchiveUpdate" +
|
|
|
|
|
+ ".ReflectConversationVisibilityArchiveUpdateData\",\"isArchived\":true,\"contactIdentity\":\"01234567\"}",
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Test
|
|
|
|
|
+ fun testReflectGroupConversationVisibilityArchiveUpdate() {
|
|
|
|
|
+ addTestData()
|
|
|
|
|
+ assertValidEncoding(
|
|
|
|
|
+ ReflectGroupSyncUpdateTask.ReflectGroupConversationVisibilityArchiveUpdate::class.java,
|
|
|
|
|
+ "{\"type\":\"ch.threema.app.tasks.ReflectGroupSyncUpdateTask.ReflectGroupConversationVisibilityArchiveUpdate" +
|
|
|
|
|
+ ".ReflectGroupConversationVisibilityArchiveUpdateData\",\"isArchived\":true," +
|
|
|
|
|
+ "\"groupIdentity\":{\"creatorIdentity\":\"01234567\",\"groupId\":6361180283070237492}}",
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Test
|
|
|
|
|
+ fun testReflectContactConversationVisibilityPinnedUpdate() {
|
|
|
|
|
+ assertValidEncoding(
|
|
|
|
|
+ ReflectContactSyncUpdateTask.ReflectConversationVisibilityPinnedUpdate::class.java,
|
|
|
|
|
+ "{\"type\":\"ch.threema.app.tasks.ReflectContactSyncUpdateTask.ReflectConversationVisibilityPinnedUpdate" +
|
|
|
|
|
+ ".ReflectConversationVisibilityPinnedUpdateData\",\"isPinned\":true,\"contactIdentity\":\"01234567\"}",
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Test
|
|
|
|
|
+ fun testReflectGroupConversationVisibilityPinnedUpdate() {
|
|
|
|
|
+ addTestData()
|
|
|
|
|
+ assertValidEncoding(
|
|
|
|
|
+ ReflectGroupSyncUpdateTask.ReflectGroupConversationVisibilityPinnedUpdate::class.java,
|
|
|
|
|
+ "{\"type\":\"ch.threema.app.tasks.ReflectGroupSyncUpdateTask.ReflectGroupConversationVisibilityPinnedUpdate" +
|
|
|
|
|
+ ".ReflectGroupConversationVisibilityPinnedUpdateData\",\"isPinned\":true," +
|
|
|
|
|
+ "\"groupIdentity\":{\"creatorIdentity\":\"01234567\",\"groupId\":6361180283070237492}}",
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Test
|
|
|
|
|
+ fun testDeactivateMultiDeviceTask() {
|
|
|
|
|
+ assertValidEncoding(
|
|
|
|
|
+ expectedTaskClass = DeactivateMultiDeviceTask::class.java,
|
|
|
|
|
+ encodedTask = """{"type":"ch.threema.app.tasks.DeactivateMultiDeviceTask.DeactivateMultiDeviceTaskData"}""",
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Test
|
|
|
|
|
+ fun testDeactivateMultiDeviceIfAloneTask() {
|
|
|
|
|
+ assertValidEncoding(
|
|
|
|
|
+ expectedTaskClass = DeactivateMultiDeviceIfAloneTask::class.java,
|
|
|
|
|
+ encodedTask = """{"type":"ch.threema.app.tasks.DeactivateMultiDeviceIfAloneTask.DeactivateMultiDeviceIfAloneTaskData"}""",
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private fun addTestData() = runBlocking {
|
|
|
val identity = "01234567"
|
|
val identity = "01234567"
|
|
|
if (serviceManager.modelRepositories.contacts.getByIdentity(identity) != null) {
|
|
if (serviceManager.modelRepositories.contacts.getByIdentity(identity) != null) {
|
|
|
// If the contact already exists, we do not add it again
|
|
// If the contact already exists, we do not add it again
|
|
|
return@runBlocking
|
|
return@runBlocking
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ serviceManager.identityStore.storeIdentity(identity, "", byteArrayOf(), byteArrayOf())
|
|
|
|
|
+
|
|
|
serviceManager.modelRepositories.contacts.createFromLocal(
|
|
serviceManager.modelRepositories.contacts.createFromLocal(
|
|
|
ContactModelData(
|
|
ContactModelData(
|
|
|
identity = identity,
|
|
identity = identity,
|
|
@@ -513,13 +722,35 @@ class PersistableTasksTest {
|
|
|
featureMask = 0u,
|
|
featureMask = 0u,
|
|
|
typingIndicatorPolicy = TypingIndicatorPolicy.DEFAULT,
|
|
typingIndicatorPolicy = TypingIndicatorPolicy.DEFAULT,
|
|
|
readReceiptPolicy = ReadReceiptPolicy.DEFAULT,
|
|
readReceiptPolicy = ReadReceiptPolicy.DEFAULT,
|
|
|
|
|
+ isArchived = false,
|
|
|
androidContactLookupKey = null,
|
|
androidContactLookupKey = null,
|
|
|
localAvatarExpires = null,
|
|
localAvatarExpires = null,
|
|
|
isRestored = false,
|
|
isRestored = false,
|
|
|
profilePictureBlobId = null,
|
|
profilePictureBlobId = null,
|
|
|
jobTitle = null,
|
|
jobTitle = null,
|
|
|
department = null,
|
|
department = null,
|
|
|
- )
|
|
|
|
|
|
|
+ notificationTriggerPolicyOverride = null,
|
|
|
|
|
+ ),
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ serviceManager.modelRepositories.groups.persistNewGroup(
|
|
|
|
|
+ GroupModelData(
|
|
|
|
|
+ groupIdentity = GroupIdentity(
|
|
|
|
|
+ creatorIdentity = identity,
|
|
|
|
|
+ groupId = 6361180283070237492,
|
|
|
|
|
+ ),
|
|
|
|
|
+ name = null,
|
|
|
|
|
+ createdAt = Date(),
|
|
|
|
|
+ synchronizedAt = null,
|
|
|
|
|
+ lastUpdate = null,
|
|
|
|
|
+ isArchived = false,
|
|
|
|
|
+ precomputedColorIndex = null,
|
|
|
|
|
+ groupDescription = null,
|
|
|
|
|
+ groupDescriptionChangedAt = null,
|
|
|
|
|
+ otherMembers = setOf(identity),
|
|
|
|
|
+ userState = ch.threema.storage.models.GroupModel.UserState.MEMBER,
|
|
|
|
|
+ notificationTriggerPolicyOverride = null,
|
|
|
|
|
+ ),
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|