mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
feat: Mute broadcast Reaction notifications by default (#4159)
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
parent
f373aa124d
commit
78bd1ad6dd
1 changed files with 20 additions and 3 deletions
|
|
@ -324,7 +324,7 @@ constructor(
|
|||
isBroadcast: Boolean,
|
||||
channelName: String?,
|
||||
) {
|
||||
showConversationNotification(contactKey, isBroadcast, channelName)
|
||||
showConversationNotification(contactKey, isBroadcast, channelName, isSilent = isBroadcast)
|
||||
}
|
||||
|
||||
override suspend fun updateWaypointNotification(
|
||||
|
|
@ -337,7 +337,12 @@ constructor(
|
|||
notificationManager.notify(contactKey.hashCode(), notification)
|
||||
}
|
||||
|
||||
private suspend fun showConversationNotification(contactKey: String, isBroadcast: Boolean, channelName: String?) {
|
||||
private suspend fun showConversationNotification(
|
||||
contactKey: String,
|
||||
isBroadcast: Boolean,
|
||||
channelName: String?,
|
||||
isSilent: Boolean = false,
|
||||
) {
|
||||
val ourNode = nodeRepository.get().ourNodeInfo.value
|
||||
val history =
|
||||
packetRepository
|
||||
|
|
@ -361,7 +366,14 @@ constructor(
|
|||
|
||||
if (displayHistory.isEmpty()) return
|
||||
|
||||
val notification = createConversationNotification(contactKey, isBroadcast, channelName, displayHistory)
|
||||
val notification =
|
||||
createConversationNotification(
|
||||
contactKey = contactKey,
|
||||
isBroadcast = isBroadcast,
|
||||
channelName = channelName,
|
||||
history = displayHistory,
|
||||
isSilent = isSilent,
|
||||
)
|
||||
notificationManager.notify(contactKey.hashCode(), notification)
|
||||
showGroupSummary()
|
||||
}
|
||||
|
|
@ -474,10 +486,15 @@ constructor(
|
|||
isBroadcast: Boolean,
|
||||
channelName: String?,
|
||||
history: List<Message>,
|
||||
isSilent: Boolean = false,
|
||||
): Notification {
|
||||
val type = if (isBroadcast) NotificationType.BroadcastMessage else NotificationType.DirectMessage
|
||||
val builder = commonBuilder(type, createOpenMessageIntent(contactKey))
|
||||
|
||||
if (isSilent) {
|
||||
builder.setSilent(true)
|
||||
}
|
||||
|
||||
val ourNode = nodeRepository.get().ourNodeInfo.value
|
||||
val meName = ourNode?.user?.longName ?: getString(Res.string.you)
|
||||
val me =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue