fix: Open room after join

pull/855/merge
krille-chan 1 year ago
parent 6cc2c6a578
commit f5c536878a
No known key found for this signature in database

@ -106,48 +106,46 @@ class ChatListItem extends StatelessWidget {
if (room.membership == Membership.leave) { if (room.membership == Membership.leave) {
context.go('/rooms/archive/${room.id}'); context.go('/rooms/archive/${room.id}');
return;
} }
if (room.membership == Membership.join) { // Share content into this room
// Share content into this room final shareContent = Matrix.of(context).shareContent;
final shareContent = Matrix.of(context).shareContent; if (shareContent != null) {
if (shareContent != null) { final shareFile = shareContent.tryGet<MatrixFile>('file');
final shareFile = shareContent.tryGet<MatrixFile>('file'); if (shareContent.tryGet<String>('msgtype') == 'chat.fluffy.shared_file' &&
if (shareContent.tryGet<String>('msgtype') == shareFile != null) {
'chat.fluffy.shared_file' && await showDialog(
shareFile != null) { context: context,
await showDialog( useRootNavigator: false,
context: context, builder: (c) => SendFileDialog(
useRootNavigator: false, files: [shareFile],
builder: (c) => SendFileDialog( room: room,
files: [shareFile], ),
room: room, );
), Matrix.of(context).shareContent = null;
); } else {
final consent = await showOkCancelAlertDialog(
context: context,
title: L10n.of(context)!.forward,
message: L10n.of(context)!.forwardMessageTo(
room.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)),
),
okLabel: L10n.of(context)!.forward,
cancelLabel: L10n.of(context)!.cancel,
);
if (consent == OkCancelResult.cancel) {
Matrix.of(context).shareContent = null;
return;
}
if (consent == OkCancelResult.ok) {
room.sendEvent(shareContent);
Matrix.of(context).shareContent = null; Matrix.of(context).shareContent = null;
} else {
final consent = await showOkCancelAlertDialog(
context: context,
title: L10n.of(context)!.forward,
message: L10n.of(context)!.forwardMessageTo(
room.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)),
),
okLabel: L10n.of(context)!.forward,
cancelLabel: L10n.of(context)!.cancel,
);
if (consent == OkCancelResult.cancel) {
Matrix.of(context).shareContent = null;
return;
}
if (consent == OkCancelResult.ok) {
room.sendEvent(shareContent);
Matrix.of(context).shareContent = null;
}
} }
} }
context.go('/rooms/${room.id}');
} }
context.go('/rooms/${room.id}');
} }
Future<void> archiveAction(BuildContext context) async { Future<void> archiveAction(BuildContext context) async {

Loading…
Cancel
Save