refactor: Improved UX for room upgrades

This commit is contained in:
Krille 2025-03-07 12:29:31 +01:00
commit b645193f7b
No known key found for this signature in database
GPG key ID: E067ECD60F1A0652
5 changed files with 37 additions and 47 deletions

View file

@ -1050,35 +1050,23 @@ class ChatController extends State<ChatPageWithRoom>
}
void goToNewRoomAction() async {
if (OkCancelResult.ok !=
await showOkCancelAlertDialog(
context: context,
title: L10n.of(context).goToTheNewRoom,
message: room
.getState(EventTypes.RoomTombstone)!
.parsedTombstoneContent
.body,
okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context).cancel,
)) {
return;
}
final result = await showFutureLoadingDialog(
context: context,
future: () async {
final roomId = room.client.joinRoom(
room
.getState(EventTypes.RoomTombstone)!
.parsedTombstoneContent
.replacementRoom,
);
await room.leave();
return roomId;
},
future: () => room.client.joinRoom(
room
.getState(EventTypes.RoomTombstone)!
.parsedTombstoneContent
.replacementRoom,
),
);
if (result.error != null) return;
if (!mounted) return;
context.go('/rooms/${result.result!}');
await showFutureLoadingDialog(
context: context,
future: room.leave,
);
if (result.error == null) {
context.go('/rooms/${result.result!}');
}
}
void onSelectMessage(Event event) {