chore: remove the userId param

now I do not pass userId in
This commit is contained in:
ShootingStarDragons 2025-11-19 19:39:36 +09:00
commit 1c614490f1
2 changed files with 7 additions and 12 deletions

View file

@ -23,7 +23,7 @@ extension LocalNotificationsExtension on MatrixState {
..src = 'assets/assets/sounds/notification.ogg' ..src = 'assets/assets/sounds/notification.ogg'
..load(); ..load();
void showLocalNotification(Event event, String? userId) async { void showLocalNotification(Event event) async {
final roomId = event.room.id; final roomId = event.room.id;
if (activeRoomId == roomId) { if (activeRoomId == roomId) {
if (kIsWeb && webHasFocus) return; if (kIsWeb && webHasFocus) return;
@ -147,9 +147,7 @@ extension LocalNotificationsExtension on MatrixState {
); );
break; break;
case DesktopNotificationActions.openChat: case DesktopNotificationActions.openChat:
if (userId != null) { setActiveClient(event.room.client);
setActiveClient(event.room.client);
}
FluffyChatApp.router.go('/rooms/${event.room.id}'); FluffyChatApp.router.go('/rooms/${event.room.id}');
break; break;

View file

@ -168,10 +168,7 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
_loginClientCandidate!.clientName, _loginClientCandidate!.clientName,
store, store,
); );
_registerSubs( _registerSubs(_loginClientCandidate!.clientName);
_loginClientCandidate!.clientName,
_loginClientCandidate!.userID,
);
_loginClientCandidate = null; _loginClientCandidate = null;
FluffyChatApp.router.go('/rooms'); FluffyChatApp.router.go('/rooms');
}); });
@ -224,7 +221,7 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
initMatrix(); initMatrix();
} }
void _registerSubs(String name, String? userId) { void _registerSubs(String name) {
final c = getClientByName(name); final c = getClientByName(name);
if (c == null) { if (c == null) {
Logs().w( Logs().w(
@ -293,8 +290,8 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
if (PlatformInfos.isWeb || PlatformInfos.isLinux) { if (PlatformInfos.isWeb || PlatformInfos.isLinux) {
c.onSync.stream.first.then((s) { c.onSync.stream.first.then((s) {
html.Notification.requestPermission(); html.Notification.requestPermission();
onNotification[name] ??= c.onNotification.stream onNotification[name] ??=
.listen((data) => showLocalNotification(data, userId)); c.onNotification.stream.listen(showLocalNotification);
}); });
} }
} }
@ -312,7 +309,7 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
void initMatrix() { void initMatrix() {
for (final c in widget.clients) { for (final c in widget.clients) {
_registerSubs(c.clientName, c.userID); _registerSubs(c.clientName);
} }
if (kIsWeb) { if (kIsWeb) {