Skip to content

Comments

Introduce NotificationActionsFactory#6037

Merged
VelikovPetar merged 3 commits intodevelopfrom
feature/AND-941_expose_notification_action_builder_methods
Dec 12, 2025
Merged

Introduce NotificationActionsFactory#6037
VelikovPetar merged 3 commits intodevelopfrom
feature/AND-941_expose_notification_action_builder_methods

Conversation

@VelikovPetar
Copy link
Contributor

@VelikovPetar VelikovPetar commented Dec 8, 2025

🎯 Goal

Introduces a NotificationActionsFactory which exposes factory methods for the default Mark as read and Reply notification actions.

They can be customised via the NotificationHandlerFactory#actionsProvider:

val notificationHandler = NotificationHandlerFactory.createNotificationHandler(
      context = context,
      notificationConfig = notificationConfig,
      actionsProvider = { notificationId, channel, message ->
            val customReply = NotificationActionsFactory.createReplyAction(
                  context = context,
                  notificationId = notificationId,
                  channel = channel,
                  title = "Reply now",
                  hint = "Write a message to ${channel.name}",
              )
              val customMarkRead = NotificationActionsFactory.createMarkReadAction(
                  context = context,
                  notificationId = notificationId,
                  channel = channel,
                  message = message,
                  title = "Already seen",
              )
              listOf(customMarkRead, customReply)
      },
)

Related docs PR: https://github.com/GetStream/docs-content/pull/846

🛠 Implementation details

  1. Introduce NotificationHandlerFactory with methods:
  • createMarkReadAction
  • createReplyAction

🎨 UI Changes

Customization example
customization-example.mp4

🧪 Testing

  1. Apply the given patch
  2. Receive a notification
  3. Observe the custom notification actions
Provide the patch summary here
Subject: [PATCH] Introduce NotificationActionsFactory.
---
Index: stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ChatHelper.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ChatHelper.kt b/stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ChatHelper.kt
--- a/stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ChatHelper.kt	(revision fe4666a0d54158805a8027e1a1bd762c1b140316)
+++ b/stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ChatHelper.kt	(date 1765206300846)
@@ -21,6 +21,7 @@
 import io.getstream.android.push.firebase.FirebasePushDeviceGenerator
 import io.getstream.chat.android.client.ChatClient
 import io.getstream.chat.android.client.logger.ChatLogLevel
+import io.getstream.chat.android.client.notifications.handler.NotificationActionsFactory
 import io.getstream.chat.android.client.notifications.handler.NotificationConfig
 import io.getstream.chat.android.client.notifications.handler.NotificationHandlerFactory
 import io.getstream.chat.android.compose.sample.data.UserCredentials
@@ -70,6 +71,23 @@
                     parentMessageId = message.parentId,
                 )
             },
+            actionsProvider = { notificationId, channel, message ->
+                val customReply = NotificationActionsFactory.createReplyAction(
+                    context = context,
+                    notificationId = notificationId,
+                    channel = channel,
+                    title = "Reply now",
+                    hint = "Write a message to ${channel.name}",
+                )
+                val customMarkRead = NotificationActionsFactory.createMarkReadAction(
+                    context = context,
+                    notificationId = notificationId,
+                    channel = channel,
+                    message = message,
+                    title = "Already seen",
+                )
+                listOf(customMarkRead, customReply)
+            },
             onPushMessage = { pushMessage ->
                 // Mark the message as delivered when a push for a new message is received
                 if (EventType.MESSAGE_NEW == pushMessage.type) {

@github-actions
Copy link
Contributor

github-actions bot commented Dec 8, 2025

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.25 MB 5.25 MB 0.00 MB 🟢
stream-chat-android-offline 5.48 MB 5.48 MB 0.00 MB 🟢
stream-chat-android-ui-components 10.59 MB 10.60 MB 0.00 MB 🟢
stream-chat-android-compose 12.81 MB 12.81 MB 0.00 MB 🟢

@VelikovPetar VelikovPetar marked this pull request as ready for review December 8, 2025 16:58
@VelikovPetar VelikovPetar requested a review from a team as a code owner December 8, 2025 16:58
@VelikovPetar VelikovPetar enabled auto-merge (squash) December 12, 2025 09:18
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
79.5% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@VelikovPetar VelikovPetar merged commit 5a927f9 into develop Dec 12, 2025
12 of 13 checks passed
@VelikovPetar VelikovPetar deleted the feature/AND-941_expose_notification_action_builder_methods branch December 12, 2025 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants