-
Notifications
You must be signed in to change notification settings - Fork 306
msglist: Display typing indicators on typing. #790
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
Changes from all commits
f802d5a
2e2872b
be722d2
5d0e790
5c70c76
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 |
---|---|---|
|
@@ -16,7 +16,7 @@ Future<InitialSnapshot> registerQueue(ApiConnection connection) { | |
'notification_settings_null': true, | ||
'bulk_message_deletion': true, | ||
'user_avatar_url_field_optional': false, // TODO(#254): turn on | ||
'stream_typing_notifications': false, // TODO implement | ||
'stream_typing_notifications': true, | ||
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 should get its own commit and own commit message, since it's changing what we get from the server (whereas the rest of the commit has a very different character, adding UI). I think the effect is that it's just causing us to get more 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. Yes, that's correct. 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. |
||
'user_settings_object': true, | ||
}, | ||
}); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ import 'dart:async'; | |
import 'package:flutter/foundation.dart'; | ||
|
||
import '../api/model/events.dart'; | ||
import '../log.dart'; | ||
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. nit: this happens a commit sooner than it should (so the linter would warn at that commit) |
||
import 'narrow.dart'; | ||
|
||
/// The model for tracking the typing status organized by narrows. | ||
|
@@ -38,6 +39,10 @@ class TypingStatus extends ChangeNotifier { | |
} | ||
|
||
bool _addTypist(SendableNarrow narrow, int typistUserId) { | ||
if (typistUserId == selfUserId) { | ||
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. commit-message nit:
For files in lib/model/, we normally make the prefix more specific than this — here, (I'd be tempted to shorten it to |
||
assert(debugLog('typing status: adding self as typist')); | ||
return false; | ||
} | ||
final narrowTimerMap = _timerMapsByNarrow[narrow] ??= {}; | ||
final typistTimer = narrowTimerMap[typistUserId]; | ||
final isNewTypist = typistTimer == null; | ||
|
@@ -64,7 +69,7 @@ class TypingStatus extends ChangeNotifier { | |
void handleTypingEvent(TypingEvent event) { | ||
SendableNarrow narrow = switch (event.messageType) { | ||
MessageType.direct => DmNarrow( | ||
allRecipientIds: event.recipientIds!..sort(), selfUserId: selfUserId), | ||
allRecipientIds: event.recipientIds!, selfUserId: selfUserId), | ||
MessageType.stream => TopicNarrow(event.streamId!, event.topic!), | ||
}; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -241,5 +241,12 @@ void main() { | |
check(() => TypingEvent.fromJson({ | ||
...baseJson, 'message_type': 'stream', 'stream_id': 123})).throws<void>(); | ||
}); | ||
|
||
test('direct type sort recipient ids', () { | ||
check(TypingEvent.fromJson({ | ||
...directMessageJson, | ||
'recipients': [4, 10, 8, 2, 1].map((e) => {'user_id': e, 'email': '[email protected]'}).toList(), | ||
})).recipientIds.isNotNull().deepEquals([1, 2, 4, 8, 10]); | ||
}); | ||
}); | ||
} |
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.
commit-message nit:
The prefix we've used for changes here is
api:
, so let's stay consistent with that.A command like
git log --oneline lib/api/model/events.dart
is very handy for looking to see what precedents are for this kind of question.