refactor: Improved UX for room upgrades
This commit is contained in:
parent
730fb22be3
commit
b645193f7b
5 changed files with 37 additions and 47 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue