refactor: Bring back notification web sound but make configurable

This commit is contained in:
Christian Kußowski 2026-03-28 15:45:47 +01:00
commit 0a59598188
No known key found for this signature in database
GPG key ID: E067ECD60F1A0652
4 changed files with 18 additions and 2 deletions

View file

@ -16,6 +16,10 @@ import 'package:matrix/matrix.dart';
import 'package:universal_html/html.dart' as html;
extension LocalNotificationsExtension on MatrixState {
static final html.AudioElement _audioPlayer = html.AudioElement()
..src = 'assets/assets/sounds/notification.ogg'
..load();
Future<void> showLocalNotification(Event event) async {
final l10n = L10n.of(context);
final roomId = event.room.id;
@ -69,6 +73,8 @@ extension LocalNotificationsExtension on MatrixState {
);
}
if (AppSettings.webNotificationSound.value) _audioPlayer.play();
html.Notification(
title,
body: body,