-
Notifications
You must be signed in to change notification settings - Fork 321
Offer subscribe/unsubscribe in channel action sheet #1790
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
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 @chrisbobbe! This LGTM, and tests well.
One (probably unrelated to this PR) thing I noticed is that currently when sending a message to an unsubscribed channel, the local echo progress bar is persistent. Even though on the Web app I notice that the message was acutally sent.
Yep, I've got a draft branch to address that :) foreshadowed in #1792. |
Is the context for the "might not" warning (vs. "will not" on web) that we aren't checking the can-subscribe permission 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.
Thanks for building this! Generally this all looks good.
I'm not convinced that we want this rename commit:
648ab7f action_sheet [nfc]: Renames/doc changes to fit context-menu Figma component
I think so far "context menu" has been pretty much a synonym of "action sheet" for us. The "context menu" term appears in Figma, and in the names of design variables because we keep those aligned with Figma, but everywhere else we say "action sheet".
It'd be nice to have one term instead of two, or else to identify a useful distinction and then assign the two terms consistently to two related meanings. But to get to having just one term requires doing a quite comprehensive rename. With this rename commit, it feels like we still have two terms but the boundary between where they appear is less crisp than it is in the status quo.
lib/api/route/channels.dart
Outdated
List<int>? principals, | ||
}) { | ||
return connection.post('subscribeToChannel', (_) {}, 'users/me/subscriptions', { | ||
'subscriptions': subscriptions.map((subName) => {'name': subName}).toList(), |
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: the name "name" seems clear enough, and avoids making up a distinct name for the same thing:
'subscriptions': subscriptions.map((subName) => {'name': subName}).toList(), | |
'subscriptions': subscriptions.map((name) => {'name': name}).toList(), |
@@ -34,10 +34,14 @@ import 'text.dart'; | |||
import 'theme.dart'; | |||
import 'topic_list.dart'; | |||
|
|||
void _showActionSheet( |
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:
The Figma has a "context menu" component (see link in new dartdoc),
which _showBottomSheet has been a good fit for. (See e.g.
should this say "_showActionSheet"?
lib/widgets/action_sheet.dart
Outdated
/// A button in a context menu. | ||
/// | ||
/// When built from server data, the action sheet ignores changes in that data; |
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 the term "action sheet" is going to remain in some places. The term "bottom sheet" will too, since it refers to the Material concept we're using.
So if we're going to introduce this third term, it'd be good to write down somewhere how the three different terms relate to each other. Perhaps on _showContextMenu
? And/or here on ContextMenuItemButton, or have a reference here.
required List<Widget> optionButtons, | ||
required List<List<Widget>> buttonSections, |
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:
Some context menus in the Figma have multiple groups/sections of
buttons, e.g.:
https://www.figma.com/design/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=6327-96694&m=dev
please mention which menu this is, too — Figma is super slow to load, so I'd rather not have to follow the link to learn the answer when it's something that could be conveyed easily in text
lib/widgets/action_sheet.dart
Outdated
Navigator.push(pageContext, | ||
TopicListPage.buildRoute(context: pageContext, streamId: channelId)); | ||
void onPressed() async { | ||
final zulipLocalizations = ZulipLocalizations.of(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.
nit: defer this lookup until we need the data (since that only happens on error)
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.
And since it's across an async gap :)
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.
Indeed. For localizations like this, that's basically harmless, which is why I didn't flag that reason — the potential impact is that if you changed your language settings while the request was ongoing, you'll see a message in your previously-chosen language. (Unlike the store, the old localizations object doesn't get disposed.)
But in principle that's also a good reason, and in the case of the store it'd be important.
253f4b9
to
b907739
Compare
Thanks! Revision pushed, and I removed that rename commit. I think my thought was: the Figma has a special kind of action sheet called a context menu, which is different from other action sheets, and it has these elements:
And I was thinking about code organization around that pattern, just for the things that are actually meant to follow it:
|
Cool.
That seems to align with "context menu" and "action sheet" being synonyms for us, then.
A context menu, aka an action sheet, is still a specific kind of bottom sheet, though. |
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! All looks good now except a couple of nits below.
assets/l10n/app_en.arb
Outdated
"@actionSheetOptionSubscribe": { | ||
"description": "Label in the channel context menu for subscribing to the channel." |
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.
Let's stick to "action sheet" in these descriptions (here and another below)
child: MenuButtonsShape(buttons: optionButtons)))), | ||
child: Column( |
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:
action_sheet [nfc]: Support multiple button sections in context menu
Some context menus in the Figma have multiple groups/sections of
s/context menu/action sheet/g
b907739
to
12b47e9
Compare
Ah indeed, basically an incomplete removal of that rename commit :) revision pushed. |
Some action sheets in the Figma have multiple groups/sections of buttons, like in the channel action sheet, which has e.g. "Mark all messages as read" in one section, "Channel settings" in another, and "Unsubscribe" in its own one-item section: https://www.figma.com/design/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=6327-96694&m=dev
Thanks! Looks good; merging. |
12b47e9
to
7f7aa98
Compare
These were added yesterday in 7f7aa98 (zulip#1790). The descriptions changed in the last revision before the PR was merged; but the edit apparently didn't make it to the generated file, causing CI to fail.
Fixes #1224.
Stacked atop #1789.
We'll need API bindings for subscribe/unsubscribe for #188, so might as well knock out #1224 now that we have those.
Putting the context-menu buttons in groups, with spacing in between, is new here, and follows the Figma: https://www.figma.com/design/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=6327-96691&m=dev
The Figma varies in whether to put 10px or 8px space between the sections, even within one context menu: https://www.figma.com/design/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=6098-6519&m=dev
and I've opted for 8px.
Screenshots
When unsubscribing from a private channel, a confirmation dialog:
with a followup to say "will not" instead of "might not", blocked on being able to check the group-based can-subscribe permission (#1786, #814).