-
Notifications
You must be signed in to change notification settings - Fork 340
all_channels: Replace three dot menu with long press gesture and add on tap to feed #1915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @chungwwei for writing this PR! Generally this looks good. Various small comments below.
lib/widgets/all_channels.dart
Outdated
onLongPress: () { | ||
if (!hasContentAccess) { | ||
return; | ||
} | ||
showChannelActionSheet(context, channelId: channel.streamId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the motivation for the hasContentAccess
condition here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason, I thought all_channels are all channels belong to the org, but all_channels are channels a user has access to. Removing the hasContentAccess
for both gestures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think hasContentAccess
is right for whether to try to go to the channel feed. This list has all channels the user has metadata access to, but that's broader than having content access:
https://zulip.com/help/channel-permissions#private-channels
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should onTap
toast a message that says viewing channel is not allowed
? I'm unsure how the UI should indicate that tapping is disabled on channels a user doesn't have access to. I modify the entry widget a bit and have it as empty SizedBox
instead of the toggle there.
I believe onLongPress
currently launches a sheet that has buttons that give you access to a private channel. Those buttons should probably be conditionally rendered with hasContentAccess
. The CopyChannelLinkButton
is the only button that shouldn't conditionally rendered for now.
zulip-flutter/lib/widgets/action_sheet.dart
Lines 507 to 513 in efc41b3
if (unreadCount > 0) | |
MarkChannelAsReadButton(pageContext: pageContext, channelId: channelId), | |
if (showTopicListButton) | |
TopicListButton(pageContext: pageContext, channelId: channelId), | |
if (!isOnChannelFeed) | |
ChannelFeedButton(pageContext: pageContext, channelId: channelId), | |
CopyChannelLinkButton(channelId: channelId, pageContext: pageContext) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think making those buttons conditional within the action sheet would be a good follow-up change, thanks. Should go in a separate commit.
I'm unsure how the UI should indicate that tapping is disabled on channels a user doesn't have access to.
I think the fact that the toggle is absent is probably enough of a hint that those channels have a different status.
buttons that give you access to a private channel
Just to be explicit: those buttons won't actually give access to a channel you don't have content access to, because the server won't give you any of the channel's messages or other information you don't have permission to see. But they won't do anything useful, so it'd be best to not offer them.
lib/widgets/all_channels.dart
Outdated
onTap: () { | ||
if (!hasContentAccess) { | ||
return; | ||
} | ||
Navigator.push(context, MessageListPage.buildRoute( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the gesture isn't going to do anything, the handler should be null
rather than a no-op function. Otherwise, the GestureDetector will tell screen-readers and other accessibility software that there's a gesture available there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hadn't thought of that, learning something new here.
The screencast video is helpful, thanks. Please also include a still screenshot. See discussion in our instructions: The interactions in the screencast are somewhat hard to follow, because the viewer can't see where on the screen you were tapping. When you take a screen recording, there's an option to have it show touches on the screen (here's Android docs); you should basically always enable that option when making a screencast to demonstrate some UI behavior. |
Thanks for the revision. One reply in a subthread above: #1915 (comment) Please also add a screenshot, and a screen recording with touches visible, so that we can review the visual changes. See details in my comment above: #1915 (comment) |
Oh and please see our Git style guide: In this PR, the two commits should be squashed together, rather than have one commit for the first revision and then another commit that adjusts those changes. |
1a64215
to
a3105d0
Compare
Thanks for the revision. Please see our Git style guide (linked above and in our README) for how to write clear commit messages. See also the reply above at #1915 (comment) . In the screenshots, the toggles are much too close to the right edge of the screen. (Notice that they're visually much closer than the content at the left is to the left edge, and much closer than the three-dots icon is in main.) They should get appropriate padding. |
698f215
to
4ae4515
Compare
Thanks Greg for the review! Hopefully the commits are following the style guide now. I believe that |
…on tap to feed Make the All channels view UI consistent with the Channels view. Specifically, onTap on a row item should lead to channel feed page and onLongPress should launch the channel bottom sheet. - all_channels: Add empty SizedBox as placeholder when toggle isn't shown for layout consistency - all_channels: Add on tap to channel feed if user has content access - all_channels: Add additional end padding for row item Fixes zulip#1914
…bottom sheet MarkChannelAsReadButton, TopicListButton, and ChannelFeedButton should not be displayed for a user without content access, as the server won't provide any information the user doesn't have permission to view.
508fa04
to
173bf47
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the revision, and the updated screenshots. Some comments below.
The commit messages are mostly good now, but the body should get line-wrapped. See this section:
https://zulip.readthedocs.io/en/latest/contributing/commit-discipline.html#formatting-guidelines
To demonstrate why, here's how the first commit message looks when I'm reviewing the changes (with git log --stat -p
):

showChannelActionSheet(context, channelId: channel.streamId); | ||
}), | ||
])); | ||
return InkWell( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that
GestureDetector
was probably not the best fit to use in the PR. Other parts of the app like the Channel Page usesInkWell
, which has the rippling effect when long press.
Yeah, agreed that this is best.
Our designer isn't always a fan of the inkwell effect. But here we're specifically aiming to make this page more like the channels/subscriptions page, and that uses the effect so this should too. (And even where we don't, we generally have some other form of touch feedback.)
onTap: hasContentAccess ? () { | ||
Navigator.push(context, MessageListPage.buildRoute( | ||
context: context, | ||
narrow: ChannelNarrow(channel.streamId))); | ||
} : null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: put the short "null" case first, and the longer case after:
onTap: hasContentAccess ? () { | |
Navigator.push(context, MessageListPage.buildRoute( | |
context: context, | |
narrow: ChannelNarrow(channel.streamId))); | |
} : null, | |
onTap: !hasContentAccess ? null : () { | |
Navigator.push(context, MessageListPage.buildRoute( | |
context: context, | |
narrow: ChannelNarrow(channel.streamId))); | |
}, |
That way the reader isn't "kept in suspense" wondering how the false case is handled while they're reading through the true case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
separate nit: format more compactly, and similar to other places; e.g. see call sites of MessageListPage.buildRoute
(or other "buildRoute" methods):
onTap: hasContentAccess ? () { | |
Navigator.push(context, MessageListPage.buildRoute( | |
context: context, | |
narrow: ChannelNarrow(channel.streamId))); | |
} : null, | |
onTap: !hasContentAccess ? null : () => Navigator.push(context, | |
MessageListPage.buildRoute(context: context, | |
narrow: ChannelNarrow(channel.streamId))), |
child: SizedBox( | ||
height: 38, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I just noticed this part — a fixed height like this can't be right.
Try setting your system's font size setting to larger text, and you'll see why.
This is also too short. Touch targets should be at least 44px high so it's not too difficult to tap the right one. In your screenshots, these rows are getting shorter; they should stay the same height unless there's a clear reason we're choosing to change the height.
Fixes #1914
Page View
Long Press View
screen-20251018-105741.mp4