Skip to content

local echo (7/7): Support simplified version of local echo #1453

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

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

PIG208
Copy link
Member

@PIG208 PIG208 commented Apr 1, 2025

screenshots
message sent got message event
sending-success-before sending-success-after
message failed to send message content tapped recipient headers
send-failed sent-failed-interacted recipient-headers

(This branch can be used to preview the full implementation)

Fixes #1441

@PIG208 PIG208 changed the title Support simplified version a local echo (n/n) Support simplified version of local echo (n/n) Apr 1, 2025
@PIG208 PIG208 changed the title Support simplified version of local echo (n/n) locale echo (n/n): Support simplified version of local echo Apr 1, 2025
@PIG208 PIG208 changed the title locale echo (n/n): Support simplified version of local echo local echo (n/n): Support simplified version of local echo Apr 2, 2025
@PIG208 PIG208 force-pushed the pr-echo branch 16 times, most recently from 988c615 to f297a65 Compare April 15, 2025 01:45
@PIG208 PIG208 marked this pull request as ready for review April 15, 2025 01:49
@PIG208 PIG208 force-pushed the pr-echo branch 5 times, most recently from aa81e2f to 28d545f Compare April 17, 2025 18:49
@PIG208 PIG208 changed the title local echo (n/n): Support simplified version of local echo local echo (6/6): Support simplified version of local echo Apr 17, 2025
@PIG208 PIG208 changed the title local echo (6/6): Support simplified version of local echo local echo (7/7): Support simplified version of local echo Apr 17, 2025
PIG208 added 4 commits April 21, 2025 22:43
The point of this helper is to replicate what a topic sent from the
client will become, after being processed by the server.

This important when trying to create a local copy of a stream message,
whose topic can get translated when it's delivered by the server.
This will be the same as `DateTime.timestamp()` in live code (therefore
the NFC). For testing, utcNow uses a clock instance that can be controlled
by FakeAsync.

We could have made call sites of `DateTime.now()` use it too, but
those for now don't need it for testing.
While we do create outbox messages, there are in no way user-visible
changes since the outbox messages don't end up in message list views.
We create skeletons for helpers needed from message list view, but don't
implement them yet, to make the diff smaller.

For testing, similar to TypingNotifier.debugEnable, we add
MessageStoreImpl.debugOutboxEnable for tests that do not intend to
cover outbox messages.

Some of the delays to fake responses added in tests are not necessary
because the future of sendMessage is not completed immediately, but we
still add them to keep the tests realistic.
PIG208 added 11 commits April 23, 2025 22:06
Also removed a stale comment that refers to resolved issues
(zulip#173 and zulip#175).

We will reuse this helper when handling outbox messages.
This is for the upcoming local-echo feature, to hide the timestamp.

There isn't a Figma design for messages without a timestamp.
This will make it easier to support comparing the conversations
between subclasses of MessageBase.

The message list tests on displayRecipient are now mostly exercising the
logic on Conversation.isSameAs, which makes it reasonable to move the
tests.  Keep them here for now since this logic is more relevant to
message lists than it is to the rest of the app.
This is NFC because MessageListMessageItem is still the only
subclass of it.
This will make MessageItem compatible with other future subclasses of
MessageBase, in particular OutboxMessage, which do not need unread
markers.
This 11px whitespace can be traced back to 311d4d5 in 2022, and is not
present in the Figma design. It was there to match the web design while
prototyping the app.
PIG208 added 3 commits April 24, 2025 22:39
This adds some overhead in magnitude of O(1) (where the constant is
the number of outbox messages in a view, expected to be small) on
message event handling.

We add outboxMessages as a list independent from messages on
_MessageSequence.  Because outbox messages are not rendered
(the raw content is shown as plain text), we leave the 1-1
relationship between `messages` and `contents` unchanged.

When computing `items`, we now start to look at `outboxMessages` as
well, with the guarantee that the items related to outbox messages
always come after those for other messages.  Look for places that call
`_processOutboxMessage(int index)` for references, and the changes to
`checkInvariants` on how this affects the message list invariants.

`addOutboxMessage` is similar to `handleMessage`.  However, outbox
messages do not rely on the fetched state, i.e. they can be
synchronously updated when the message list view was first
initialized.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Simplified local echo, with retry
1 participant