Skip to content

Commit

Permalink
fix(push-payload): map 'u' and 'message_id' to notificationData and p…
Browse files Browse the repository at this point in the history
…ass them to the eventHandler

SUITEDEV-35736

Co-authored-by: davidSchuppa <[email protected]>
Co-authored-by: LasOri <[email protected]>
Co-authored-by: matusekma <[email protected]>
  • Loading branch information
4 people committed May 7, 2024
1 parent 94d4224 commit 3808812
Show file tree
Hide file tree
Showing 13 changed files with 261 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ class InappNotificationIntegrationTest : AnnotationSpec() {
operation = NotificationOperation.INIT.name,
actions = null,
defaultAction = null,
inapp = inappPayload
inapp = inappPayload,
u = "{\"customField\":\"customValue\"}",
message_id = "messageId"
)
val intent = IntentUtils.createNotificationHandlerServiceIntent(
application,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ class NotificationCommandFactoryTest : AnnotationSpec() {
const val MULTICHANNEL_ID = "test multiChannel id"
const val SMALL_RESOURCE_ID = 123
const val COLOR_RESOURCE_ID = 456
const val MESSAGE_ID = "messageId"
const val U = "{\"customField\":\"customValue\"}"
val notificationMethod = NotificationMethod(COLLAPSE_ID, NotificationOperation.INIT)
val notificationData = NotificationData(
null,
Expand All @@ -74,12 +76,12 @@ class NotificationCommandFactoryTest : AnnotationSpec() {
rootParams = mapOf(
"rootParamKey1" to "rootParamValue1",
"rootParamKey2" to "rootParamValue2"
)
),
u = U,
message_id = MESSAGE_ID
)
}



private lateinit var factory: NotificationCommandFactory
private lateinit var context: Context
private lateinit var mockConcurrentHandlerHolder: ConcurrentHandlerHolder
Expand Down Expand Up @@ -425,6 +427,7 @@ class NotificationCommandFactoryTest : AnnotationSpec() {
mapOf(
"rootParamKey1" to "rootParamValue1",
"rootParamKey2" to "rootParamValue2",
"u" to U,
"title" to TITLE,
"body" to BODY,
"channelId" to CHANNEL_ID,
Expand All @@ -446,7 +449,9 @@ class NotificationCommandFactoryTest : AnnotationSpec() {
)
)
)
)
),
"u" to U,
"message_id" to MESSAGE_ID
)
)
JsonUtils.toFlatMap(payload!!) shouldBe JsonUtils.toFlatMap(expected)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ class DismissNotificationCommandTest : AnnotationSpec() {
collapseId = COLLAPSE_ID,
operation = OPERATION,
actions = null,
inapp = null
inapp = null,
u = "{\"customField\":\"customValue\"}",
message_id = "messageId"
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ class PreloadedInappHandlerCommandTest : AnnotationSpec() {
collapseId = COLLAPSE_ID,
operation = NotificationOperation.INIT.name,
actions = null,
inapp = null
inapp = null,
u = "{\"customField\":\"customValue\"}",
message_id = "messageId"
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ class IntentUtilsTest : AnnotationSpec() {
collapseId = COLLAPSE_ID,
operation = NotificationOperation.INIT.name,
actions = null,
inapp = null
inapp = null,
u = "{\"customField\":\"customValue\"}",
message_id = "messageId"
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ class MessagingServiceUtilsTest : AnnotationSpec() {
collapseId = COLLAPSE_ID,
operation = OPERATION,
actions = null,
inapp = null
inapp = null,
u = "{\"customField\":\"customValue\"}",
message_id = "messageId"
)
}

Expand Down Expand Up @@ -221,6 +223,8 @@ class MessagingServiceUtilsTest : AnnotationSpec() {
operation = OPERATION,
actions = null,
inapp = null,
u = "{\"customField\":\"customValue\"}",
message_id = "messageId"
)

val ems = JSONObject()
Expand Down Expand Up @@ -289,7 +293,9 @@ class MessagingServiceUtilsTest : AnnotationSpec() {
collapseId = COLLAPSE_ID,
operation = OPERATION,
actions = null,
inapp = null
inapp = null,
u = "{\"customField\":\"customValue\"}",
message_id = "messageId"
)

MessagingServiceUtils.createNotification(
Expand Down Expand Up @@ -317,6 +323,8 @@ class MessagingServiceUtilsTest : AnnotationSpec() {
operation = OPERATION,
actions = null,
inapp = null,
u = "{\"customField\":\"customValue\"}",
message_id = "messageId"
)

val input: MutableMap<String, String> = HashMap()
Expand Down Expand Up @@ -353,7 +361,9 @@ class MessagingServiceUtilsTest : AnnotationSpec() {
collapseId = COLLAPSE_ID,
operation = OPERATION,
actions = null,
inapp = null
inapp = null,
u = "{\"customField\":\"customValue\"}",
message_id = "messageId"
)

val input: MutableMap<String, String> = HashMap()
Expand Down Expand Up @@ -389,7 +399,9 @@ class MessagingServiceUtilsTest : AnnotationSpec() {
collapseId = COLLAPSE_ID,
operation = OPERATION,
actions = null,
inapp = null
inapp = null,
u = "{\"customField\":\"customValue\"}",
message_id = "messageId"
)

val result = MessagingServiceUtils.createNotification(
Expand Down Expand Up @@ -420,7 +432,9 @@ class MessagingServiceUtilsTest : AnnotationSpec() {
collapseId = COLLAPSE_ID,
operation = OPERATION,
actions = null,
inapp = null
inapp = null,
u = "{\"customField\":\"customValue\"}",
message_id = "messageId"
)

val result = MessagingServiceUtils.createNotification(
Expand Down Expand Up @@ -454,7 +468,9 @@ class MessagingServiceUtilsTest : AnnotationSpec() {
collapseId = COLLAPSE_ID,
operation = OPERATION,
actions = null,
inapp = null
inapp = null,
u = "{\"customField\":\"customValue\"}",
message_id = "messageId"
)

val result = MessagingServiceUtils.createNotification(
Expand Down Expand Up @@ -488,7 +504,9 @@ class MessagingServiceUtilsTest : AnnotationSpec() {
collapseId = COLLAPSE_ID,
operation = OPERATION,
actions = null,
inapp = null
inapp = null,
u = "{\"customField\":\"customValue\"}",
message_id = "messageId"
)

val expectedColor = ContextCompat.getColor(context, colorResourceId)
Expand Down Expand Up @@ -520,7 +538,9 @@ class MessagingServiceUtilsTest : AnnotationSpec() {
collapseId = COLLAPSE_ID,
operation = OPERATION,
actions = null,
inapp = null
inapp = null,
u = "{\"customField\":\"customValue\"}",
message_id = "messageId"
)

val result = MessagingServiceUtils.createNotification(
Expand Down Expand Up @@ -550,7 +570,9 @@ class MessagingServiceUtilsTest : AnnotationSpec() {
collapseId = COLLAPSE_ID,
operation = OPERATION,
actions = null,
inapp = null
inapp = null,
u = "{\"customField\":\"customValue\"}",
message_id = "messageId"
)

val result = MessagingServiceUtils.createNotification(
Expand Down Expand Up @@ -580,7 +602,9 @@ class MessagingServiceUtilsTest : AnnotationSpec() {
collapseId = COLLAPSE_ID,
operation = OPERATION,
actions = null,
inapp = null
inapp = null,
u = "{\"customField\":\"customValue\"}",
message_id = "messageId"
)

val notificationSettings: NotificationSettings = mock()
Expand Down Expand Up @@ -617,7 +641,9 @@ class MessagingServiceUtilsTest : AnnotationSpec() {
collapseId = COLLAPSE_ID,
operation = OPERATION,
actions = null,
inapp = null
inapp = null,
u = "{\"customField\":\"customValue\"}",
message_id = "messageId"
)

val notificationSettings: NotificationSettings = mock()
Expand Down Expand Up @@ -672,7 +698,9 @@ class MessagingServiceUtilsTest : AnnotationSpec() {
collapseId = COLLAPSE_ID,
operation = OPERATION,
actions = actions.toString(),
inapp = null
inapp = null,
u = "{\"customField\":\"customValue\"}",
message_id = "messageId"
)

val result = MessagingServiceUtils.createNotification(
Expand Down Expand Up @@ -715,7 +743,9 @@ class MessagingServiceUtilsTest : AnnotationSpec() {
collapseId = COLLAPSE_ID,
operation = OPERATION,
actions = null,
inapp = null
inapp = null,
u = "{\"customField\":\"customValue\"}",
message_id = "messageId"
)

val notificationSettings: NotificationSettings = mock()
Expand Down Expand Up @@ -750,7 +780,9 @@ class MessagingServiceUtilsTest : AnnotationSpec() {
collapseId = COLLAPSE_ID,
operation = OPERATION,
actions = null,
inapp = null
inapp = null,
u = "{\"customField\":\"customValue\"}",
message_id = "messageId"
)

val notificationSettings: NotificationSettings = mock()
Expand Down Expand Up @@ -872,7 +904,9 @@ class MessagingServiceUtilsTest : AnnotationSpec() {
collapseId = COLLAPSE_ID,
operation = OPERATION,
actions = null,
inapp = null
inapp = null,
u = "{\"customField\":\"customValue\"}",
message_id = "messageId"
)

MessagingServiceUtils.createSilentPushCommands(
Expand All @@ -897,7 +931,9 @@ class MessagingServiceUtilsTest : AnnotationSpec() {
collapseId = COLLAPSE_ID,
operation = OPERATION,
actions = null,
inapp = null
inapp = null,
u = "{\"customField\":\"customValue\"}",
message_id = "messageId"
)

MessagingServiceUtils.createSilentPushCommands(
Expand Down Expand Up @@ -958,7 +994,9 @@ class MessagingServiceUtilsTest : AnnotationSpec() {
collapseId = COLLAPSE_ID,
operation = OPERATION,
actions = actions,
inapp = null
inapp = null,
u = "{\"customField\":\"customValue\"}",
message_id = "messageId"
)

MessagingServiceUtils.createSilentPushCommands(
Expand Down Expand Up @@ -1017,7 +1055,9 @@ class MessagingServiceUtilsTest : AnnotationSpec() {
collapseId = COLLAPSE_ID,
operation = OPERATION,
actions = actions,
inapp = null
inapp = null,
u = "{\"customField\":\"customValue\"}",
message_id = "messageId"
)

MessagingServiceUtils.createSilentPushCommands(
Expand Down Expand Up @@ -1062,7 +1102,9 @@ class MessagingServiceUtilsTest : AnnotationSpec() {
collapseId = COLLAPSE_ID,
operation = OPERATION,
actions = null,
inapp = null
inapp = null,
u = "{\"customField\":\"customValue\"}",
message_id = "messageId"
),
mockFileDownloader,
deviceInfo
Expand Down Expand Up @@ -1095,7 +1137,9 @@ class MessagingServiceUtilsTest : AnnotationSpec() {
collapseId = COLLAPSE_ID,
operation = OPERATION,
actions = null,
inapp = null
inapp = null,
u = "{\"customField\":\"customValue\"}",
message_id = "messageId"
),
mockFileDownloader,
deviceInfo
Expand Down Expand Up @@ -1132,7 +1176,9 @@ class MessagingServiceUtilsTest : AnnotationSpec() {
collapseId = COLLAPSE_ID,
operation = OPERATION,
actions = null,
inapp = null
inapp = null,
u = "{\"customField\":\"customValue\"}",
message_id = "messageId"
),
mockFileDownloader,
deviceInfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ class NotificationActionUtilsTest : AnnotationSpec() {
collapseId = COLLAPSE_ID,
operation = OPERATION,
actions = null,
inapp = null
inapp = null,
u = "{\"customField\":\"customValue\"}",
message_id = "messageId"
)
}

Expand Down
Loading

0 comments on commit 3808812

Please sign in to comment.