chore: do as suggested

This commit is contained in:
ShootingStarDragons 2025-11-19 18:16:37 +09:00
parent acce4a8d7b
commit 27b2eac7ed
3 changed files with 2 additions and 30 deletions

View file

@ -415,7 +415,6 @@ class ChatListController extends State<ChatList>
);
});
Matrix.of(context).setController(this);
super.initState();
}
@ -816,14 +815,6 @@ class ChatListController extends State<ChatList>
_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(() {

View file

@ -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}');

View file

@ -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<Matrix> 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<Matrix> 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);