diff --git a/lib/pages/chat_list/chat_list.dart b/lib/pages/chat_list/chat_list.dart index 4f96aff6d..2e8e04e65 100644 --- a/lib/pages/chat_list/chat_list.dart +++ b/lib/pages/chat_list/chat_list.dart @@ -415,6 +415,7 @@ class ChatListController extends State ); }); + Matrix.of(context).setController(this); super.initState(); } @@ -815,6 +816,14 @@ 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 4d2b09721..ef7e9127c 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) { - Matrix.of(context).setActiveClientWithUserId(userId); + if (userId != null && controller != null) { + controller!.setActiveClientWithUserId(userId); } FluffyChatApp.router.go('/rooms/${event.room.id}'); diff --git a/lib/widgets/matrix.dart b/lib/widgets/matrix.dart index c5125870b..ee04638b8 100644 --- a/lib/widgets/matrix.dart +++ b/lib/widgets/matrix.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'dart:convert'; +import 'package:fluffychat/pages/chat_list/chat_list.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; @@ -70,6 +71,7 @@ class MatrixState extends State with WidgetsBindingObserver { bool? loginRegistrationSupported; BackgroundPush? backgroundPush; + ChatListController? controller; Client get client { if (_activeClient < 0 || _activeClient >= widget.clients.length) { @@ -100,6 +102,9 @@ class MatrixState extends State with WidgetsBindingObserver { 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); diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt index ecb5b8764..ffff12596 100644 --- a/linux/CMakeLists.txt +++ b/linux/CMakeLists.txt @@ -42,6 +42,7 @@ endif() # default. In most cases, you should add new options to specific targets instead # of modifying this function. function(APPLY_STANDARD_SETTINGS TARGET) + target_compile_options(${TARGET} PRIVATE -Wno-deprecated) target_compile_features(${TARGET} PUBLIC cxx_std_14) target_compile_options(${TARGET} PRIVATE -Wall -Werror) target_compile_options(${TARGET} PRIVATE "$<$>:-O3>")