From f58bc1d67d7b4b14b8c57f0bf29f6031a8592858 Mon Sep 17 00:00:00 2001 From: ggurdin Date: Wed, 25 Oct 2023 14:53:51 -0400 Subject: [PATCH] Redirect to rooms when archiving or leaving active room --- lib/pages/chat_list/chat_list.dart | 9 +++++++++ lib/pages/chat_list/space_view.dart | 10 +++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/pages/chat_list/chat_list.dart b/lib/pages/chat_list/chat_list.dart index e7de171f7..08eabe6fd 100644 --- a/lib/pages/chat_list/chat_list.dart +++ b/lib/pages/chat_list/chat_list.dart @@ -587,11 +587,20 @@ class ChatListController extends State ) == OkCancelResult.ok; if (!confirmed) return; + // #Pangea + final bool archivedActiveRoom = + selectedRoomIds.contains(Matrix.of(context).activeRoomId); + // Pangea# await showFutureLoadingDialog( context: context, future: () => _archiveSelectedRooms(), ); setState(() {}); + // #Pangea + if (archivedActiveRoom) { + VRouter.of(context).to('/rooms'); + } + // Pangea# } void setStatus() async { diff --git a/lib/pages/chat_list/space_view.dart b/lib/pages/chat_list/space_view.dart index 15f5f06e2..fdd6b2954 100644 --- a/lib/pages/chat_list/space_view.dart +++ b/lib/pages/chat_list/space_view.dart @@ -162,7 +162,15 @@ class _SpaceViewState extends State { case SpaceChildContextAction.leave: await showFutureLoadingDialog( context: context, - future: room!.leave, + // #Pangea + // future: room!.leave, + future: () async { + await room!.leave(); + if (Matrix.of(context).activeRoomId == room.id) { + VRouter.of(context).to('/rooms'); + } + }, + // Pangea# ); break; case SpaceChildContextAction.removeFromSpace: