fix: salas removidas de vez, paginação no mural, mídia em largura total e teclado nos comentários

This commit is contained in:
2026-09-14 17:15:52 -03:00
parent 8927e80cce
commit 9d69e833bd
8 changed files with 234 additions and 134 deletions

View File

@@ -413,8 +413,9 @@ class ChatListController extends State<ChatList>
scrollController.addListener(_onScroll);
_waitForFirstSync();
_backfillSubscription =
_clientStream.stream.listen((_) => backfillRoomTypeMarkers());
_backfillSubscription = _clientStream.stream.listen(
(_) => backfillRoomTypeMarkers(),
);
if (PlatformInfos.isMobile) {
_callEventSubscription = FlutterCallkitIncoming.onEvent.listen(
_onCallEvent,
@@ -910,30 +911,7 @@ class ChatListController extends State<ChatList>
bool waitForFirstSync = false;
/// Leaves the room locally and removes it from the local database.
Future<void> leaveRoom(Room room) async {
try {
await room.leave();
} on MatrixException catch (e, s) {
// If the room was already left on the server (e.g. a stale local copy
// reappeared after a restart) the leave request fails, but the user
// intent (room not being listed anymore) is already fulfilled. Clean up
// locally instead of showing an error.
if (!{
MatrixError.M_FORBIDDEN,
MatrixError.M_NOT_FOUND,
MatrixError.M_UNKNOWN,
}.contains(e.error)) {
Logs().w('Failed to leave room ${room.id}', e, s);
rethrow;
}
Logs().w('Room ${room.id} is already gone, cleaning up locally...', e, s);
}
final client = room.client;
// Make sure the room does not reappear from the local database after an
// app restart, even if the leave sync did not run in time.
await client.database.forgetRoom(room.id);
client.rooms.remove(room);
}
Future<void> leaveRoom(Room room) => safeLeave(room);
/// Loads the shared [roomTypeStateEvent] marker from the synced room state
/// (from the local database for partially loaded rooms) and writes it for

View File

@@ -13,6 +13,7 @@ import 'package:tatchat/pages/chat_list/active_call_indicator.dart';
import 'package:tatchat/pages/chat_list/unread_bubble.dart';
import 'package:tatchat/utils/localized_exception_extension.dart';
import 'package:tatchat/utils/matrix_live_kit_calls/matrix_live_kit_call.dart';
import 'package:tatchat/utils/matrix_sdk_extensions/room_extension.dart';
import 'package:tatchat/utils/stream_extension.dart';
import 'package:tatchat/utils/string_color.dart';
import 'package:tatchat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart';
@@ -198,7 +199,11 @@ class _SpaceViewState extends State<SpaceView> {
final success = await showFutureLoadingDialog(
context: context,
future: () async => await space?.leave(),
future: () async {
final room = space;
if (room == null) return;
await safeLeave(room);
},
);
if (!mounted) return;
if (success.error != null) return;
@@ -361,7 +366,7 @@ class _SpaceViewState extends State<SpaceView> {
case SpaceChildAction.leave:
await showFutureLoadingDialog(
context: context,
future: () => room!.leave(),
future: () => safeLeave(room!),
);
}
}