From 27b2eac7ed1c79312b30c3f9ee93792753bb8a34 Mon Sep 17 00:00:00 2001 From: ShootingStarDragons Date: Wed, 19 Nov 2025 18:16:37 +0900 Subject: [PATCH] chore: do as suggested --- lib/pages/chat_list/chat_list.dart | 9 --------- .../local_notifications_extension.dart | 4 ++-- lib/widgets/matrix.dart | 19 ------------------- 3 files changed, 2 insertions(+), 30 deletions(-) diff --git a/lib/pages/chat_list/chat_list.dart b/lib/pages/chat_list/chat_list.dart index 2e8e04e65..4f96aff6d 100644 --- a/lib/pages/chat_list/chat_list.dart +++ b/lib/pages/chat_list/chat_list.dart @@ -415,7 +415,6 @@ class ChatListController extends State ); }); - Matrix.of(context).setController(this); super.initState(); } @@ -816,14 +815,6 @@ class ChatListController extends State _clientStream.add(client); } - void setActiveClientWithUserId(String name) { - setState(() { - activeFilter = ActiveFilter.allChats; - _activeSpaceId = null; - Matrix.of(context).setActiveClientWithUserId(name); - }); - } - void setActiveBundle(String bundle) { context.go('/rooms'); setState(() { diff --git a/lib/widgets/local_notifications_extension.dart b/lib/widgets/local_notifications_extension.dart index ef7e9127c..b61162e39 100644 --- a/lib/widgets/local_notifications_extension.dart +++ b/lib/widgets/local_notifications_extension.dart @@ -147,8 +147,8 @@ extension LocalNotificationsExtension on MatrixState { ); break; case DesktopNotificationActions.openChat: - if (userId != null && controller != null) { - controller!.setActiveClientWithUserId(userId); + if (userId != null) { + setActiveClient(event.room.client); } FluffyChatApp.router.go('/rooms/${event.room.id}'); diff --git a/lib/widgets/matrix.dart b/lib/widgets/matrix.dart index 23d81c244..77fa4b1c4 100644 --- a/lib/widgets/matrix.dart +++ b/lib/widgets/matrix.dart @@ -17,7 +17,6 @@ import 'package:universal_html/html.dart' as html; import 'package:url_launcher/url_launcher_string.dart'; import 'package:fluffychat/l10n/l10n.dart'; -import 'package:fluffychat/pages/chat_list/chat_list.dart'; import 'package:fluffychat/utils/client_manager.dart'; import 'package:fluffychat/utils/init_with_restore.dart'; import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_file_extension.dart'; @@ -71,7 +70,6 @@ class MatrixState extends State with WidgetsBindingObserver { bool? loginRegistrationSupported; BackgroundPush? backgroundPush; - ChatListController? controller; Client get client { if (_activeClient < 0 || _activeClient >= widget.clients.length) { @@ -89,23 +87,6 @@ class MatrixState extends State with WidgetsBindingObserver { late String currentClientSecret; RequestTokenResponse? currentThreepidCreds; - void setActiveClientWithUserId(String userId) { - final i = widget.clients.indexWhere((c) => c.userID == userId); - if (i != -1) { - if (_activeClient == i) { - return; - } - _activeClient = i; - // TODO: Multi-client VoiP support - createVoipPlugin(); - } else { - Logs().w('Tried to set an unknown user $userId as active'); - } - } - - void setController(ChatListController controller) { - this.controller = controller; - } void setActiveClient(Client? cl) { final i = widget.clients.indexWhere((c) => c == cl);