feat: Add mute node functionality (#4181)

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
James Rich 2026-01-10 15:35:01 -06:00 committed by GitHub
parent 42fe7e9b2e
commit a67b519abd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
34 changed files with 2174 additions and 458 deletions

View file

@ -313,8 +313,9 @@ constructor(
message: String,
isBroadcast: Boolean,
channelName: String?,
isSilent: Boolean,
) {
showConversationNotification(contactKey, isBroadcast, channelName)
showConversationNotification(contactKey, isBroadcast, channelName, isSilent = isSilent)
}
override suspend fun updateReactionNotification(
@ -323,8 +324,9 @@ constructor(
emoji: String,
isBroadcast: Boolean,
channelName: String?,
isSilent: Boolean,
) {
showConversationNotification(contactKey, isBroadcast, channelName, isSilent = isBroadcast)
showConversationNotification(contactKey, isBroadcast, channelName, isSilent = isSilent)
}
override suspend fun updateWaypointNotification(
@ -332,8 +334,9 @@ constructor(
name: String,
message: String,
waypointId: Int,
isSilent: Boolean,
) {
val notification = createWaypointNotification(name, message, waypointId)
val notification = createWaypointNotification(name, message, waypointId, isSilent)
notificationManager.notify(contactKey.hashCode(), notification)
}
@ -571,19 +574,30 @@ constructor(
return builder.build()
}
private fun createWaypointNotification(name: String, message: String, waypointId: Int): Notification {
private fun createWaypointNotification(
name: String,
message: String,
waypointId: Int,
isSilent: Boolean,
): Notification {
val person = Person.Builder().setName(name).build()
val style = NotificationCompat.MessagingStyle(person).addMessage(message, System.currentTimeMillis(), person)
return commonBuilder(NotificationType.Waypoint, createOpenWaypointIntent(waypointId))
.setCategory(Notification.CATEGORY_MESSAGE)
.setAutoCancel(true)
.setStyle(style)
.setGroup(GROUP_KEY_MESSAGES)
.setVisibility(NotificationCompat.VISIBILITY_PRIVATE)
.setWhen(System.currentTimeMillis())
.setShowWhen(true)
.build()
val builder =
commonBuilder(NotificationType.Waypoint, createOpenWaypointIntent(waypointId))
.setCategory(Notification.CATEGORY_MESSAGE)
.setAutoCancel(true)
.setStyle(style)
.setGroup(GROUP_KEY_MESSAGES)
.setVisibility(NotificationCompat.VISIBILITY_PRIVATE)
.setWhen(System.currentTimeMillis())
.setShowWhen(true)
if (isSilent) {
builder.setSilent(true)
}
return builder.build()
}
private fun createAlertNotification(contactKey: String, name: String, alert: String): Notification {