Notification sound added. Docs updated.
This commit is contained in:
1 parent
4c9a267897
commit
81cc630319
29 files changed
+845
-57
No files matched your search
@@ -4,6 +4,8 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log/slog"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -11,6 +13,7 @@ import (
|
||||
"git.stormux.org/storm/fenrir/internal/diagnostic"
|
||||
"git.stormux.org/storm/fenrir/internal/i18n"
|
||||
"git.stormux.org/storm/fenrir/internal/interaction"
|
||||
"git.stormux.org/storm/fenrir/internal/presentation"
|
||||
)
|
||||
|
||||
const notificationLimit = 100
|
||||
@@ -33,6 +36,19 @@ func (a *application) notify(text string, received time.Time) {
|
||||
}
|
||||
a.notifications = append(a.notifications, notification{text: text, received: received})
|
||||
diagnostic.Record("notification received", "length", len(text), "retained", len(a.notifications))
|
||||
if a.settings.live.Presentation.Sound.Enabled && a.settings.live.Presentation.Sound.Volume > 0 && a.cues != nil {
|
||||
if a.temporarySilence || a.muted {
|
||||
a.play(presentation.Notification)
|
||||
return
|
||||
}
|
||||
cues := a.cues
|
||||
a.voice.Say_after(text, func(ctx context.Context) {
|
||||
if err := cues.Play_wait(ctx, presentation.Notification); err != nil && ctx.Err() == nil {
|
||||
slog.Warn("notification sound incomplete", "error", err, "at", time.Now())
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
a.present(text, "")
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user