Commit 96b4f43
committed
New chat architecture + replace ChatKit with Compose + chat relay via signaling
Most code was coded by myself but it partly contains code that was generated by AI agents:
AI-assistant: Claude Code 2.1.80 (Claude Sonnet 4.6)
AI-assistant: GitHUb Copilot 1.7.1-243 (Claude Sonnet 4.6)
AI-assistant: Gemini bundled 253.30387.90.2532.14935130 (gemini-3-flash-preview)
---
- resolve #1552
- resolve #5633
- resolve #2000
## Chat relay
- Use signaling to receive chat messages (instead of long polling) when the HPB supports it
- Introduce a regular insurance request if somehow signaling messages did not make it through
## New chat architecture
- The ChatKit library is removed. A lot of logic and designs are reimplemented (using MVVM and Jetpack Compose)
- Change the chat architecture from an event based message handling to a state based messages handling.
- 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.
- Design changes while migrating XML to Compose
## TODO
- [x] avatars
- [x] determinePreviousMessageIds + handleExpandableSystemMessages + collapseSystemMessages()
- [x] quoted messages
- [x] chat relay
- [x] support multiple message handling via chat-relay https://nextcloud-spreed-signaling.readthedocs.io/en/latest/standalone-signaling-api-v1/#send-chat-room-message
- [x] implement signaling handling for chat-relay
- [x] add features to HelloWebSocketMessage
- [x] implement insurance request
- [x] implement new mark as read handling
- [x] handle actually shown newest messages on screen
- Before: messages were marked as read as soon as they were received.
- Now: 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.
- [x] improve scope handling of the flows from database
- [x] last read handling
- [x] show unread chat item. Add in viewmodel
- [x] message context menu
- [x] add temporary solution to get ChatMessage for this
- [x] show play button for audio/video with preview
- [x] reactions
- [x] different handling for chatRelay?
- [x] nextcloud/spreed#16349
- [x] implement all message types
- [x] media files
- [x] voice message playback
- [x] location
- [x] link preview
- [x] poll
- [x] temp messages
- [x] threads handling
- [x] reply handling
- [x] get single message from offline stored messages
- [x] get single message from server if ot stored offline
- [x] scroll to message when clicked
- [x] make new ui model for chat message immutable to work better with Compose
- [x] rewrite handling of message parameters / rich object type handling / "selectedIndividualHashMap"?
- [x] reimplement mention chips
- [ ] improve it
- [x] send chat-relay feature offer to HPB
- [x] handle chat-relay feature response from HPB
- [x] migrate database for unique reference id's
- [x] partly reimplement message editing
- [x] add theming to chatComponents by CompositionLocalProvider
- [x] implement own stickyHeader for reversed list
- [x] Compose only offers stickyHeader when the list is not reverted. But i use "reverseLayout = true" as it fits best for a chatapp. To have a stickyHeader anyway i implemented a stickyHeader for reversed lists
- [x] do never show it when chat is scrolled to bottom
- [x] reimplement temorary messages
- [x] change ChatMessages database table: make referenceIds unique
- [x] reimplement message read indicator
- [x] reimplement message status icon handling
- [x] introduce MessageTypeContent for type-safe rendering
- [x] reimplement parent message handling
- [x] load parent messages from same flow that are already contained in latest chat block
- [x] load missing parent messages from api or older chatBlocks
- [x] reimplement markdown
- [ ] improve it
- [x] reimplement links handling
- [x] reimplement unread message marker between chat messages
- [x] reimplement unread messages bubble
- use latestKnownMessageIdFromSync ? -> move to viewmodel
- [x] Set Read marker
- [x] add message counter for unread messages bubble
- [x] remove chatkit dependency
- [x] check New features. Scheduled messaages / fixed messages
- [x] Copyright headers
- [x] lint + format code
- [x] Remove dead code & comments
- [x] Refresh chat after file upload
- [x] fix incoming bubble width for group chats
- [x] comment in openHelperFactory again
## TODOs for followup PRs
- [ ] bugfix: sometimes jumping to newest message when scrolling up
- [ ] empty list passed??
- [ ] ViewCompositionStrategy ??
- [ ] special system messages handling regarding signaling?
- [ ] handle and translate the important ones
- [ ] request server via insurance request for others instead to handle the message
ref https://github.com/nextcloud/spreed/blob/fd1807d0017d736b3d058a830f720defc670a6a0/lib/Signaling/Listener.php#L80-L101
ref https://github.com/nextcloud/spreed/blob/bf0f5f05e42b9d94449970c09836978650b1a514/lib/Chat/Parser/SystemMessage.php#L118
- [ ] reimplement search feature
- [ ] swipe to answer..
- [ ] reimplement/fix lobby
- [ ] Performance optimizations
- [ ] pagination /Paging3
- [ ] move even more logic out of composables
- [ ] Grouping of bubbles
- [ ] bubble design
- [ ] show only one avatar per bubble-group
- [ ] playback voice messages in service. Playback in ConversationList was removed. There mst be an overall solution to play voice messages in OS notification panel.
- [ ] reimplement GIF autoplay (#5969 was merged for legacy code)
- [ ] "Call started" message?
- [ ] Download progress
- [ ] Upload progress
- [ ] Reactions color improvements
- [ ] Quotes must support all message types. Recursive?
- [ ] Check click/longclick handling
- [ ] use Blurhash
- [ ] click on mentions
- [ ] checkbox handling
- [ ] deck card messages
- [ ] modify scheduled messages list to reuse the Composables from the chat. Modify the Composables where needed.
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>1 parent aae1b97 commit 96b4f43
153 files changed
Lines changed: 6686 additions & 13027 deletions
File tree
- app
- src
- androidTest/java/com/nextcloud/talk/data/database
- dao
- migrations
- main
- java/com/nextcloud/talk
- activities
- adapters/messages
- api
- chat
- data
- io
- model
- network
- domain
- ui/model
- viewmodels
- contacts
- contextchat
- conversationlist
- data
- network
- ui
- dagger/modules
- data/database
- dao
- mappers
- models/json/websocket
- repositories/reactions
- signaling
- threadsoverview
- ui
- chat
- dialog
- theme
- upload/chunked
- utils
- database/user
- message
- preview
- webrtc
- res
- drawable-land
- drawable
- layout-land
- layout
- values-land
- values-night
- values
- xml
- test/java/com/nextcloud/talk/json
- gradle
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
271 | | - | |
272 | 271 | | |
273 | 272 | | |
274 | 273 | | |
| |||
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
| 120 | + | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
| 126 | + | |
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | | - | |
| 132 | + | |
133 | 133 | | |
134 | 134 | | |
135 | | - | |
| 135 | + | |
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
| |||
Lines changed: 92 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | 10 | | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | | - | |
26 | | - | |
27 | 26 | | |
28 | 27 | | |
29 | 28 | | |
| |||
32 | 31 | | |
33 | 32 | | |
34 | 33 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
50 | 124 | | |
51 | 125 | | |
52 | 126 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
75 | 79 | | |
76 | 80 | | |
77 | 81 | | |
| |||
Lines changed: 7 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
284 | 284 | | |
285 | 285 | | |
286 | 286 | | |
287 | | - | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
288 | 291 | | |
289 | 292 | | |
290 | 293 | | |
| |||
1900 | 1903 | | |
1901 | 1904 | | |
1902 | 1905 | | |
1903 | | - | |
| 1906 | + | |
1904 | 1907 | | |
1905 | 1908 | | |
1906 | 1909 | | |
| |||
2716 | 2719 | | |
2717 | 2720 | | |
2718 | 2721 | | |
2719 | | - | |
| 2722 | + | |
2720 | 2723 | | |
2721 | 2724 | | |
2722 | 2725 | | |
2723 | | - | |
| 2726 | + | |
2724 | 2727 | | |
2725 | 2728 | | |
2726 | 2729 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
| 142 | + | |
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
| |||
Lines changed: 0 additions & 51 deletions
This file was deleted.
Lines changed: 0 additions & 16 deletions
This file was deleted.
0 commit comments