Skip to content

Commit

Permalink
Call setSilent for notifications that should not make noise
Browse files Browse the repository at this point in the history
It's a new-ish API, added in 1.5.0 as a replacement for
`setNotificationSilent`, added in 1.3.0 (2020), which is doing the same.

Closes #529
  • Loading branch information
oakkitten committed Mar 8, 2024
1 parent da63de3 commit f3da88c
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,8 @@ private fun NotificationCompat.MessagingStyle.maybeAddMissingMessageLine(
private fun NotificationCompat.Builder.setMakeNoise(makeNoise: Boolean): NotificationCompat.Builder {
setOnlyAlertOnce(!makeNoise)

if (!makeNoise) setSilent(true)

if (makeNoise && Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
var flags = 0
if (P.notificationLight) flags = flags or Notification.DEFAULT_LIGHTS
Expand Down

0 comments on commit f3da88c

Please sign in to comment.