Merge pull request #2780 from krille-chan/krille/bring-back-notification-sound

refactor: Bring back notification web sound but make configurable
This commit is contained in:
Krille-chan 2026-03-28 16:09:01 +01:00 committed by GitHub
commit 0e77ce53ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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,