From e0298521c6c12c5f347431bfad5b6a4d7ab8b465 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Mon, 26 Mar 2018 18:04:10 +0300 Subject: Add sounds to notifications --- ui/view-main.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'ui') 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++ } -- cgit v1.2.3