From 1c614490f1d2e54abc886b648ba7fdd03cb704e0 Mon Sep 17 00:00:00 2001 From: ShootingStarDragons Date: Wed, 19 Nov 2025 19:39:36 +0900 Subject: [PATCH] chore: remove the userId param now I do not pass userId in --- lib/widgets/local_notifications_extension.dart | 6 ++---- lib/widgets/matrix.dart | 13 +++++-------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/lib/widgets/local_notifications_extension.dart b/lib/widgets/local_notifications_extension.dart index b61162e39..443ed6c83 100644 --- a/lib/widgets/local_notifications_extension.dart +++ b/lib/widgets/local_notifications_extension.dart @@ -23,7 +23,7 @@ extension LocalNotificationsExtension on MatrixState { ..src = 'assets/assets/sounds/notification.ogg' ..load(); - void showLocalNotification(Event event, String? userId) async { + void showLocalNotification(Event event) async { final roomId = event.room.id; if (activeRoomId == roomId) { if (kIsWeb && webHasFocus) return; @@ -147,9 +147,7 @@ extension LocalNotificationsExtension on MatrixState { ); break; case DesktopNotificationActions.openChat: - if (userId != null) { - setActiveClient(event.room.client); - } + setActiveClient(event.room.client); FluffyChatApp.router.go('/rooms/${event.room.id}'); break; diff --git a/lib/widgets/matrix.dart b/lib/widgets/matrix.dart index 77fa4b1c4..55fd267ad 100644 --- a/lib/widgets/matrix.dart +++ b/lib/widgets/matrix.dart @@ -168,10 +168,7 @@ class MatrixState extends State with WidgetsBindingObserver { _loginClientCandidate!.clientName, store, ); - _registerSubs( - _loginClientCandidate!.clientName, - _loginClientCandidate!.userID, - ); + _registerSubs(_loginClientCandidate!.clientName); _loginClientCandidate = null; FluffyChatApp.router.go('/rooms'); }); @@ -224,7 +221,7 @@ class MatrixState extends State with WidgetsBindingObserver { initMatrix(); } - void _registerSubs(String name, String? userId) { + void _registerSubs(String name) { final c = getClientByName(name); if (c == null) { Logs().w( @@ -293,8 +290,8 @@ class MatrixState extends State with WidgetsBindingObserver { if (PlatformInfos.isWeb || PlatformInfos.isLinux) { c.onSync.stream.first.then((s) { html.Notification.requestPermission(); - onNotification[name] ??= c.onNotification.stream - .listen((data) => showLocalNotification(data, userId)); + onNotification[name] ??= + c.onNotification.stream.listen(showLocalNotification); }); } } @@ -312,7 +309,7 @@ class MatrixState extends State with WidgetsBindingObserver { void initMatrix() { for (final c in widget.clients) { - _registerSubs(c.clientName, c.userID); + _registerSubs(c.clientName); } if (kIsWeb) {