-
-
Notifications
You must be signed in to change notification settings - Fork 298
New chat architecture + chat relay #5635
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
Draft
mahibi
wants to merge
6
commits into
master
Choose a base branch
from
feature/5633/chatRelay
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
074dc73 to
2d34ff3
Compare
ab134d2 to
3127450
Compare
3127450 to
f50377e
Compare
23b18fc to
05b9a26
Compare
deb4c0e to
e21d4e5
Compare
e21d4e5 to
ceef454
Compare
ceef454 to
425ed1c
Compare
4f12d55 to
37d84db
Compare
Signed-off-by: Marcel Hibbe <[email protected]>
Signed-off-by: Marcel Hibbe <[email protected]>
Signed-off-by: Marcel Hibbe <[email protected]>
Signed-off-by: Marcel Hibbe <[email protected]>
…ar newest message Signed-off-by: Marcel Hibbe <[email protected]>
Signed-off-by: Marcel Hibbe <[email protected]>
37d84db to
538c7db
Compare
Contributor
|
APK file: https://www.kaminsky.me/nc-dev/android-artifacts/5635.apk |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

WIP
resolve Chat relay via High-performance backend #5633
prepare to get rid of forked ChatKit #1552 by adding a solution for developers to use Jetpack Compose for rendering of the chat messages. The goal of this PR is not to come up with a polished Compose implementation but to set the stage so that Compose can be improved over time until it finally replaces chatkit.
This PR will
Use signaling to receive chat messages instead of long polling when hpb is used
Introduce a regular insurance request if somehow a signaling messages did not make it through
Change the chat architecture from an event based message handling to a state based messages handling. This change was done in this PR because adding two more ways how messages can be received (signaling and insurance request) would have made the event based messages Handling even more complex.
Before:
messages were passed to ui directly from responses (as well to DB). This was necessary as the chatkit library required different processing depending on if messages from the past or future were received
Now:
Received messages are just written to database no matter where they come from (initial request / request for scrolling into past /long polling / signaling / insurance request).
Messages are observed on database to be shown in UI via flows.
The database is the single source of truth, so no events are needed to update the ui.
To avoid messages gaps in UI, the chat block handling is used: the flow is implemented so that always the messages from the newest chat block are emitted. For this, the database is observed for the newest chat block and whenever it changes, the messages of it are emitted.
Implement a workaround so that chatkit library can handle the messages flow instead of the former events. For this, the adapter is cleared and all messages are added again. This may come with a minor performance loss on some devices, but as a temporary solution to migrate to Jetpack Compose + flow handling, this is the best way to go.
Refactor and improve the Jetpack Compose code for messages that was used for the message search window to be able to handle flows. (for now it was only able to handle a single response with a chat message list)
Add a switch for developers to use Jetpack Compose instead of chatkit. We can continue to maintain the chatkit based solution while being able to further improve the new compose solution until it's ready to replace chatkit.
To use the compose solution for developing, just change the value of
useJetpackComposeinonCreatein the ChatActvity.Add a new solution to automatically mark messages as read.
messages were marked as read as soon as they were received.
messages are marked as read until the newest message that was shown on the screen. This is transmitted whenever the user manually scrolls or when the chat is closed/brought to background.
This change was planned for ages and it was now necessary because of the signaling handling.
improve scope handling of the flows from database
TODO
insurance request and re add them??
🏁 Checklist
/backport to stable-xx.x