π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][photos] Open participant options on long press (#13379)
aman-pilot47bbc0f7aa70
diff --git a/mobile/apps/photos/changes/participant-row-long-press.md b/mobile/apps/photos/changes/participant-row-long-press.mdnew file mode 100644index 0000000000..6399921a4f--- /dev/null+++ b/mobile/apps/photos/changes/participant-row-long-press.md@@ -0,0 +1 @@+- Added support for opening participant options by long pressing their row in album sharing.diff --git a/mobile/apps/photos/lib/ui/sharing/widgets/participant_role_row.dart b/mobile/apps/photos/lib/ui/sharing/widgets/participant_role_row.dartindex 02ec2c2796..1aee3774d8 100644--- a/mobile/apps/photos/lib/ui/sharing/widgets/participant_role_row.dart+++ b/mobile/apps/photos/lib/ui/sharing/widgets/participant_role_row.dart@@ -43,6 +43,7 @@ class ParticipantRoleRow extends StatefulWidget {class _ParticipantRoleRowState extends State<ParticipantRoleRow> {bool _isChangingRole = false;+ final _menuKey = GlobalKey();@overrideWidget build(BuildContext context) {@@ -51,6 +52,7 @@ class _ParticipantRoleRowState extends State<ParticipantRoleRow> {user: widget.user,role: role,currentUserID: widget.currentUserID,+ onLongPress: _isChangingRole ? null : _showMenu,trailing: _isChangingRole? SizedBox.square(dimension: IconSizes.small,@@ -60,10 +62,9 @@ class _ParticipantRoleRowState extends State<ParticipantRoleRow> {),): EntePopupMenuButton<_ParticipantRoleAction>(+ key: _menuKey,optionsBuilder: () => _options(context),- onSelected: (action) => action == _ParticipantRoleAction.remove- ? _removeParticipant()- : _changeRole(action.role!),+ onSelected: _onSelected,child: HugeIcon(icon: albumSharingRoleIcon(role),color: context.componentColors.textBase,@@ -74,6 +75,22 @@ class _ParticipantRoleRowState extends State<ParticipantRoleRow> {);}+ Future<void> _showMenu() async {+ final action = await showEntePopupMenu<_ParticipantRoleAction>(+ context: _menuKey.currentContext!,+ options: _options(context),+ );+ if (!mounted || action == null) {+ return;+ }+ await _onSelected(action);+ }++ Future<void> _onSelected(_ParticipantRoleAction action) =>+ action == _ParticipantRoleAction.remove+ ? _removeParticipant()+ : _changeRole(action.role!);+List<EntePopupMenuOption<_ParticipantRoleAction>> _options(BuildContext context,) {diff --git a/mobile/apps/photos/lib/ui/sharing/widgets/participant_row.dart b/mobile/apps/photos/lib/ui/sharing/widgets/participant_row.dartindex f1a622cdf1..39a45b4feb 100644--- a/mobile/apps/photos/lib/ui/sharing/widgets/participant_row.dart+++ b/mobile/apps/photos/lib/ui/sharing/widgets/participant_row.dart@@ -98,12 +98,14 @@ class ParticipantRow extends StatelessWidget {required this.role,required this.currentUserID,this.trailing,+ this.onLongPress,});final User user;final CollectionParticipantRole role;final int currentUserID;final Widget? trailing;+ final VoidCallback? onLongPress;@overrideWidget build(BuildContext context) {@@ -122,7 +124,7 @@ class ParticipantRow extends StatelessWidget {size: IconSizes.small,strokeWidth: 1.6,),- isDisabled: true,+ onLongPress: onLongPress,);}}