From 7e07289ae767156db0ff8c94b6e49f3062dff1b2 Mon Sep 17 00:00:00 2001 From: ggurdin <46800240+ggurdin@users.noreply.github.com> Date: Fri, 11 Jul 2025 13:18:44 -0400 Subject: [PATCH] chore: hide invite page share button if room does not have join code / is not space (#3426) --- .../pangea_invitation_selection_view.dart | 100 ++++++------------ 1 file changed, 32 insertions(+), 68 deletions(-) diff --git a/lib/pangea/chat_settings/pages/pangea_invitation_selection_view.dart b/lib/pangea/chat_settings/pages/pangea_invitation_selection_view.dart index 62985a972..f4abaea00 100644 --- a/lib/pangea/chat_settings/pages/pangea_invitation_selection_view.dart +++ b/lib/pangea/chat_settings/pages/pangea_invitation_selection_view.dart @@ -16,7 +16,6 @@ import 'package:fluffychat/pangea/chat_settings/pages/pangea_invitation_selectio import 'package:fluffychat/pangea/common/config/environment.dart'; import 'package:fluffychat/pangea/extensions/pangea_room_extension.dart'; import 'package:fluffychat/pangea/spaces/constants/space_constants.dart'; -import 'package:fluffychat/utils/fluffy_share.dart'; import 'package:fluffychat/utils/stream_extension.dart'; import 'package:fluffychat/widgets/adaptive_dialogs/user_dialog.dart'; import 'package:fluffychat/widgets/avatar.dart'; @@ -47,9 +46,35 @@ class PangeaInvitationSelectionView extends StatelessWidget { final theme = Theme.of(context); final contacts = controller.filteredContacts(); - final alias = room.canonicalAlias.isEmpty - ? controller.widget.roomId - : room.canonicalAlias; + final doneButton = ElevatedButton( + style: ElevatedButton.styleFrom( + backgroundColor: theme.colorScheme.primaryContainer, + padding: const EdgeInsets.symmetric( + horizontal: 24, + vertical: 16, + ), + ), + child: Row( + spacing: 34.0, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + Icons.check, + color: theme.colorScheme.onPrimaryContainer, + ), + Text( + L10n.of(context).done, + style: TextStyle( + color: theme.colorScheme.onPrimaryContainer, + fontWeight: FontWeight.w600, + ), + ), + ], + ), + onPressed: () => context.go( + room.isSpace ? "/rooms?spaceId=${room.id}" : "/rooms/${room.id}", + ), + ); return Scaffold( appBar: AppBar( @@ -316,71 +341,10 @@ class PangeaInvitationSelectionView extends StatelessWidget { ), ], ), - ) - else - Expanded( - child: ElevatedButton( - style: ElevatedButton.styleFrom( - backgroundColor: theme.colorScheme.primaryContainer, - padding: const EdgeInsets.symmetric( - horizontal: 24, - vertical: 16, - ), - ), - child: Row( - spacing: 34.0, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon( - Icons.share_outlined, - color: theme.colorScheme.onPrimaryContainer, - ), - Text( - L10n.of(context).share, - style: TextStyle( - color: theme.colorScheme.onPrimaryContainer, - fontWeight: FontWeight.w600, - ), - ), - ], - ), - onPressed: () => FluffyShare.share( - "${Environment.frontendURL}/#/join_with_alias?alias=$alias", - context, - ), - ), ), - ElevatedButton( - style: ElevatedButton.styleFrom( - backgroundColor: theme.colorScheme.primaryContainer, - padding: const EdgeInsets.symmetric( - horizontal: 24, - vertical: 16, - ), - ), - child: Row( - spacing: 34.0, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon( - Icons.check, - color: theme.colorScheme.onPrimaryContainer, - ), - Text( - L10n.of(context).done, - style: TextStyle( - color: theme.colorScheme.onPrimaryContainer, - fontWeight: FontWeight.w600, - ), - ), - ], - ), - onPressed: () => context.go( - room.isSpace - ? "/rooms?spaceId=${room.id}" - : "/rooms/${room.id}", - ), - ), + room.isSpace && room.classCode != null + ? doneButton + : Expanded(child: doneButton), ], ), ],