-
Notifications
You must be signed in to change notification settings - Fork 270
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
action_sheet: Offer "Mark channel as read" in channel action sheet #1317
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -395,36 +395,47 @@ class MessageListAppBarTitle extends StatelessWidget { | |
case ChannelNarrow(:var streamId): | ||
final store = PerAccountStoreWidget.of(context); | ||
final stream = store.streams[streamId]; | ||
return _buildStreamRow(context, stream: stream); | ||
return GestureDetector( | ||
behavior: HitTestBehavior.translucent, | ||
onLongPress: () { | ||
showChannelActionSheet(context, channelId: streamId); | ||
}, | ||
child: _buildStreamRow(context, stream: stream)); | ||
|
||
case TopicNarrow(:var streamId, :var topic): | ||
final store = PerAccountStoreWidget.of(context); | ||
final stream = store.streams[streamId]; | ||
return SizedBox( | ||
width: double.infinity, | ||
child: GestureDetector( | ||
behavior: HitTestBehavior.translucent, | ||
onLongPress: () { | ||
final someMessage = MessageListPage.ancestorOf(context) | ||
.model?.messages.firstOrNull; | ||
// If someMessage is null, the topic action sheet won't have a | ||
// resolve/unresolve button. That seems OK; in that case we're | ||
// either still fetching messages (and the user can reopen the | ||
// sheet after that finishes) or there aren't any messages to | ||
// act on anyway. | ||
assert(someMessage == null || narrow.containsMessage(someMessage)); | ||
showTopicActionSheet(context, | ||
channelId: streamId, | ||
topic: topic, | ||
someMessageIdInTopic: someMessage?.id); | ||
}, | ||
child: Column( | ||
crossAxisAlignment: willCenterTitle ? CrossAxisAlignment.center | ||
: CrossAxisAlignment.start, | ||
children: [ | ||
_buildStreamRow(context, stream: stream), | ||
_buildTopicRow(context, stream: stream, topic: topic), | ||
]))); | ||
final alignment = willCenterTitle | ||
? Alignment.center | ||
: AlignmentDirectional.centerStart; | ||
return Column( | ||
crossAxisAlignment: CrossAxisAlignment.stretch, | ||
children: [ | ||
GestureDetector( | ||
behavior: HitTestBehavior.translucent, | ||
onLongPress: () { | ||
showChannelActionSheet(context, channelId: streamId); | ||
}, | ||
child: Align(alignment: alignment, | ||
child: _buildStreamRow(context, stream: stream))), | ||
GestureDetector( | ||
behavior: HitTestBehavior.translucent, | ||
onLongPress: () { | ||
final someMessage = MessageListPage.ancestorOf(context) | ||
.model?.messages.firstOrNull; | ||
// If someMessage is null, the topic action sheet won't have a | ||
// resolve/unresolve button. That seems OK; in that case we're | ||
// either still fetching messages (and the user can reopen the | ||
// sheet after that finishes) or there aren't any messages to | ||
// act on anyway. | ||
assert(someMessage == null || narrow.containsMessage(someMessage)); | ||
showTopicActionSheet(context, | ||
channelId: streamId, | ||
topic: topic, | ||
someMessageIdInTopic: someMessage?.id); | ||
}, | ||
child: Align(alignment: alignment, | ||
child: _buildTopicRow(context, stream: stream, topic: topic)))]); | ||
|
||
case DmNarrow(:var otherRecipientIds): | ||
final store = PerAccountStoreWidget.of(context); | ||
|
@@ -1083,6 +1094,7 @@ class StreamMessageRecipientHeader extends StatelessWidget { | |
onTap: () => Navigator.push(context, | ||
MessageListPage.buildRoute(context: context, | ||
narrow: ChannelNarrow(message.streamId))), | ||
onLongPress: () => showChannelActionSheet(context, channelId: message.streamId), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs test coverage. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've noticed an existing bug with the gesture handling here. I filed it as #1368; no need to fix it in this PR (but feel free to claim the issue if you'd like to work on it as a followup). |
||
child: Row( | ||
crossAxisAlignment: CrossAxisAlignment.center, | ||
children: [ | ||
|
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 see; the reasoning for
ZulipAction
, in its dartdoc, makes sense.I see that
ZulipAction.markNarrowAsRead
takes care of giving UI feedback, so I agree atry
/catch
isn't needed here.It still doesn't give one specific kind of feedback I was hoping for, though 🙂:
#1317 (comment)
Could you make that adjustment, in a separate commit, for both values of
useLegacy
? ForuseLegacy
false
, that means adjustingupdateMessageFlagsStartingFromAnchor
, which is where the UI-feedback code is in that case.