stream-chat-swift
stream-chat-swift copied to clipboard
[Threads v2] Add `ChatThreadListVC` UI Component
π Issue Links
Resolves https://github.com/GetStream/ios-issues-tracking/issues/752
π― Goal
- Add a new Thread List UI Component to fetch the current user threads.
- Wires the new Threads v2 API with the UI Components.
π Summary
- [x] Changes the Demo App to show a Tab Bar with Channels and Threads
- [x] Fixes marking unread inside a
ChatThreadVCnot doing anything. - [x] Adds
markUnreadaction to root of the thread inChatThreadVC - [x] Changes the default values of
ThreadListQueryso that they have better performance by default - [x] Refactors
ChatChannelUnreadCountViewso that it is reusable inChatThreadListItemView - [x] Renames
loadOlderThreadstoloadMoreTreadsto be aligned with other controllers - [x] Exposes
ChatThreadListController - [x] Exposes
ChatThreadListRouter - [x] Exposes
ChatMessageController.markThreadRead() - [x] Exposes
ChatMessageController.markThreadUnread() - [x] Exposes
ChatMessageController.updateThreadInfo() - [x] Exposes
ChatMessageController.getThreadInfo() - [x] Marks a thread read when reaching the bottom of
ChatThreadVC - [x] Exposes new
ChatCurrentUserController.getUnreads() - [x] Update Application Badge Notifications in the Demo App
- [x] Adds new
DebugObjectViewControllerto Demo App - [x] Unit Tests
- [x] Adds Empty and Loading states to
ChatThreadListVC - [x] Snapshot Tests
- [ ] Docusaurus Thread v2 Docs
- [ ] State Layer support (Out of Scope)
π Implementation
Currently there are a couple backend issues that are blocking this feature, the ones with π΄ are blocking:
- :red_circle:
thread.readsometimes does not contain the current user read, so it is not possible to display the number of unread replies - :red_circle:
unread_threadsis not updated when a new reply is created. I get amessage.newevent andnotification.thread_message_new, but none of the 2 containsunread_threads, only the other unreads values. - The pages in the thread list some times does not contain the number provided in the limit even tho there are more pages. Ticket already created in the backend side: https://getstream.slack.com/archives/CE5N802GP/p1716911267619619?thread_ts=1716831868.119549&cid=CE5N802GP
- When a thread is mark unread, the mark unread event does not contain any information that is about a thread, and does not include the parentMessageId of the thread
- Not possible to correctly parse the
thread.updatedevent or Partial Thread response due to:thread.channel.commandsonly returns string instead of the full command structurethread.thread_participants.useruser object in thread participants is not returned
π¨ Showcase
π§ͺ QA Scenarios
Fetch Thread List [SDK β - Backend β ]
- Tap on threads
- Should load current user threads
- When scrolling to the bottom
- Should load new threads β
Known Issues:
- [x] First page has few threads because most of them are missing
parent_messagesfield.
Thread List Loading [SDK β - Backend β ]
- Logout
- Login
- Tap on Threads
- Should show a loading spinner on the first time since no DB cache is available β
Fetch Thread List Empty [SDK β - Backend β ]
- Logout
- Login with R2-D2
- Tap on Threads
- Should show an empty view β
New Thread Reply [SDK β - Backend π΄ ]
- Login with User A (ex: Han Solo)
- Login with User B (ex: Luke Skywalker)
- Tap on Threads with User A
- With User B, send a reply to a thread where User A is also present
- User A should see the thread list updated with the new reply and unread count increased β
- User A should see the unread threads badge increased +1 π΄
Known Issues:
- [x] Badge appears but does not show number (UI Bug)
- [x] Backend
thread.unreadis not updated, only local data. If User A logout and login, the unread count will disappear. (This happens 100% for threads that already exist)
Thread Soft Deleted [SDK β - Backend β ]
Not Done Yet:
- Login with User A (ex: Han Solo)
- Login with User B (ex: Luke Skywalker)
- Tap on Threads with User A
- With User B, SOFT deletes a thread parent message
- User A should see "replied to: This message was deleted." in the Thread List β
Thread Hard Deleted [SDK β - Backend π΄ ]
Not Done Yet:
- Login with User A (ex: Han Solo)
- Login with User B (ex: Luke Skywalker)
- Tap on Threads with User A
- With User B, HARD deletes a thread parent message
- User A should see the thread disappear from the Thread List β
-
- User A should see the thread unread badge decreased by one if there were unread replies π΄ (Backend)
Update Thread [SDK β - Backend β ]
- Login with User A (ex: Han Solo)
- Login with User B (ex: Luke Skywalker)
- Tap on Threads with User A
- Open a Thread with User B
- Tap on the Bug Icon top right corner with User B
- Update the Thread Title to something else
- User A should see the updated thread name in the Thread List (replied to: XXXX) β
New Thread from current user [SDK β - Backend β ]
- Login
- Open a Channel
- Create a new thread on that channel (Long tap on a message and thread reply)
- Go back to the Channel List
- Tap on Threads
- Should fetch the Thread List with the new thread β
New Thread from other user mention [SDK β - Backend π΄ ]
- Login with User A (ex: Han Solo)
- Login with User B (ex: Luke Skywalker)
- Tap on Threads with User A
- Create a new thread with User B (Long tap on a message without replies and tap thread reply)
- Send a reply by tagging User A with @
- User A should see a banner "X new threads" in the Thread List β
- User A should see the new thread when tapping the banner β
- User A should see the new thread with updated unread count π΄
Channel Deletion [SDK β - Backend π΄]
- Login with User A (ex: Han Solo)
- Login with User B (ex: Luke Skywalker)
- Open a channel with User A
- Create a new thread on that channel with User A (Long tap on a message and thread reply)
- Go to the Thread List with User A
- Open the same channel with User B
- Open the newly created thread with User B
- Send a reply to that thread with User B
- User A should see new unreads in the Thread List β
- User A should see thread unread badge updated β
- User B deletes the channel
- User A should see the Thread disappear from Thread List β
- User A should see the thread unread badge decreased by one if there were unread replies π΄ (Backend)
Mark Thread Unread [SDK β - Backend β ]
- Login
- Tap on Threads
- Open a read thread (without unreads)
- Scroll to the top to the parent message
- Long tap the parent message
- Mark it as unread
- Go back to the Thread List
- Should display unread count equal to 1 β
- Should increase threads total unread count badge β
- Logout
- Login
- Should still display unread count equal to 1 β (Backend does not return
thread.read)
Known Issues:
- [ ] Backend updates the
thread.read.unreadMessageCountto 1, instead of the number of reply count
Mark Thread Read [SDK β - Backend β ]
- Login
- Tap on Threads
- Open an unread thread
- Scroll to the bottom of the thread
- Go back to the Thread List
- Should display no unread counts β
βοΈ Contributor Checklist
- [x] I have signed the Stream CLA (required)
- [x] This change follows zero β οΈ policy (required)
- [x] This change should be manually QAed
- [x] Changelog is updated with client-facing changes
- [x] New code is covered by unit tests
- [x] Comparison screenshots added for visual changes
- [ ] Affected documentation updated (docusaurus, tutorial, CMS)
| 2 Warnings | |
|---|---|
| :warning: | Big PR |
| :warning: | The changes should be manually QAed before the Pull Request will be merged |
Generated by :no_entry_sign: Danger
Quality Gate passed
Issues
135 New issues
0 Accepted issues
Measures
0 Security Hotspots
83.9% Coverage on New Code
0.1% Duplication on New Code