From 71bd195c625d0c1f007ff9da9683a6e64249b427 Mon Sep 17 00:00:00 2001 From: JHansen Date: Mon, 8 May 2023 04:56:40 +0000 Subject: [PATCH 1/2] Fix Quick account switching --- lib/pages/chat/chat.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/pages/chat/chat.dart b/lib/pages/chat/chat.dart index 67095237a..78b3eff37 100644 --- a/lib/pages/chat/chat.dart +++ b/lib/pages/chat/chat.dart @@ -76,7 +76,7 @@ class ChatPageWithRoom extends StatefulWidget { } class ChatController extends State { - Room get room => widget.room; + Room get room => sendingClient.getRoomById(roomId) ?? widget.room; late Client sendingClient; @@ -368,7 +368,7 @@ class ChatController extends State { TextEditingController sendController = TextEditingController(); void setSendingClient(Client c) { - // first cancle typing with the old sending client + // first cancel typing with the old sending client if (currentlyTyping) { // no need to have the setting typing to false be blocking typingCoolDown?.cancel(); @@ -393,7 +393,7 @@ class ChatController extends State { final commandMatch = RegExp(r'^\/(\w+)').firstMatch(sendController.text); if (commandMatch != null && - !room.client.commands.keys.contains(commandMatch[1]!.toLowerCase())) { + !sendingClient.commands.keys.contains(commandMatch[1]!.toLowerCase())) { final l10n = L10n.of(context)!; final dialogResult = await showOkCancelAlertDialog( context: context, From ae4dee813328fe0025866dcdc1cb279d327d50d4 Mon Sep 17 00:00:00 2001 From: JHansen Date: Mon, 8 May 2023 12:02:15 +0000 Subject: [PATCH 2/2] Fix read reciepts --- lib/pages/chat/chat.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/pages/chat/chat.dart b/lib/pages/chat/chat.dart index 78b3eff37..6824f6f98 100644 --- a/lib/pages/chat/chat.dart +++ b/lib/pages/chat/chat.dart @@ -376,6 +376,10 @@ class ChatController extends State { room.setTyping(false); currentlyTyping = false; } + // then cancel the old timeline + // fixes bug with read reciepts and quick switching + loadTimelineFuture = _getTimeline(eventContextId: room.fullyRead); + // then set the new sending client setState(() => sendingClient = c); }