diff --git a/assets/l10n/intl_en.arb b/assets/l10n/intl_en.arb index 48f46ba1..6c171ec1 100644 --- a/assets/l10n/intl_en.arb +++ b/assets/l10n/intl_en.arb @@ -2387,5 +2387,6 @@ "joinSpace": "Join space", "publicSpaces": "Public spaces", "addChatOrSubSpace": "Add chat or sub space", - "subspace": "Subspace" + "subspace": "Subspace", + "decline": "Decline" } \ No newline at end of file diff --git a/lib/pages/chat_list/chat_list_item.dart b/lib/pages/chat_list/chat_list_item.dart index 3fac2583..d0661537 100644 --- a/lib/pages/chat_list/chat_list_item.dart +++ b/lib/pages/chat_list/chat_list_item.dart @@ -41,25 +41,40 @@ class ChatListItem extends StatelessWidget { if (room.membership == Membership.invite) { final inviterId = room.getState(EventTypes.RoomMember, room.client.userID!)?.senderId; - final profile = inviterId == null - ? null - : await showFutureLoadingDialog( - context: context, - future: () => room.client.getProfileFromUserId(inviterId), - ); - final consent = await showOkCancelAlertDialog( + final inviteAction = await showModalActionSheet( context: context, - title: L10n.of(context)!.inviteForMe, - message: L10n.of(context)!.youInvitedBy( - profile?.result?.displayName ?? - profile?.result?.userId.localpart ?? - L10n.of(context)!.user, - ), - okLabel: L10n.of(context)!.joinRoom, - cancelLabel: L10n.of(context)!.delete, - barrierDismissible: false, + message: room.isDirectChat + ? L10n.of(context)!.invitePrivateChat + : L10n.of(context)!.inviteGroupChat, + title: room.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)), + style: AdaptiveStyle.material, + actions: [ + SheetAction( + key: InviteActions.accept, + label: L10n.of(context)!.accept, + icon: Icons.check_outlined, + isDefaultAction: true, + ), + SheetAction( + key: InviteActions.decline, + label: L10n.of(context)!.decline, + icon: Icons.close_outlined, + isDestructiveAction: true, + ), + SheetAction( + key: InviteActions.block, + label: L10n.of(context)!.block, + icon: Icons.block_outlined, + isDestructiveAction: true, + ), + ], ); - if (consent == OkCancelResult.cancel) { + if (inviteAction == null) return; + if (inviteAction == InviteActions.block) { + context.go('/rooms/settings/security/ignorelist', extra: inviterId); + return; + } + if (inviteAction == InviteActions.decline) { await showFutureLoadingDialog( context: context, future: room.leave, @@ -381,3 +396,9 @@ class ChatListItem extends StatelessWidget { ); } } + +enum InviteActions { + accept, + decline, + block, +}