aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2018-03-26 18:04:10 +0300
committerTulir Asokan <tulir@maunium.net>2018-03-26 18:04:10 +0300
commite0298521c6c12c5f347431bfad5b6a4d7ab8b465 (patch)
tree317a7e635eab0badefdf632d0a308980ead66d1b /ui
parentb31d96881432ebb1d4918ae970fabfd6362e1186 (diff)
Add sounds to notifications
Diffstat (limited to 'ui')
-rw-r--r--ui/view-main.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/ui/view-main.go b/ui/view-main.go
index a037ea0..a35c35e 100644
--- a/ui/view-main.go
+++ b/ui/view-main.go
@@ -378,11 +378,11 @@ func (view *MainView) SetTyping(room string, users []string) {
}
}
-func sendNotification(room *rooms.Room, sender, text string, critical bool) {
+func sendNotification(room *rooms.Room, sender, text string, critical, sound bool) {
if room.GetTitle() != sender {
sender = fmt.Sprintf("%s (%s)", sender, room.GetTitle())
}
- notification.Send(sender, text, critical)
+ notification.Send(sender, text, critical, sound)
}
func (view *MainView) NotifyMessage(room *rooms.Room, message *types.Message, should pushrules.PushActionArrayShould) {
@@ -392,7 +392,8 @@ func (view *MainView) NotifyMessage(room *rooms.Room, message *types.Message, sh
}
shouldNotify := (should.Notify || !should.NotifySpecified) && message.Sender != view.config.Session.UserID
if shouldNotify {
- sendNotification(room, message.Sender, message.Text, should.Highlight)
+ shouldPlaySound := should.PlaySound && should.SoundName == "default"
+ sendNotification(room, message.Sender, message.Text, should.Highlight, shouldPlaySound)
if !isCurrent {
room.UnreadMessages++
}