-
Notifications
You must be signed in to change notification settings - Fork 224
Add CurrentUserUnreads.totalUnreadCountByTeam
#3733
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
Conversation
WalkthroughA new feature was added to display detailed unread message counts, including unread counts per team, in the user profile UI. This involved extending data models, updating API payloads, integrating a SwiftUI view for detailed display, and enhancing related tests to verify the new unread-by-team functionality. Changes
Sequence Diagram(s)sequenceDiagram
participant User as User
participant UserProfileVC as UserProfileViewController
participant SwiftUIView as UnreadDetailsView (SwiftUI)
participant CurrentUserController as CurrentUserController
participant API as API
User->>UserProfileVC: Tap "View Details" on Detailed Unread Counts
UserProfileVC->>SwiftUIView: Present UnreadDetailsView
SwiftUIView->>CurrentUserController: loadAllUnreads()
CurrentUserController->>API: Fetch unread counts (including by team)
API-->>CurrentUserController: Return unread counts data
CurrentUserController-->>SwiftUIView: Provide unread counts model
SwiftUIView-->>User: Display detailed unread counts (by channel, thread, type, team)
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
DemoApp/Screens/UserProfileViewController.swift (1)
201-437
: Consider breaking down the large SwiftUI view for better maintainability.The
UnreadDetailsView
is quite large (200+ lines) and handles multiple responsibilities. Consider extracting each section into separate views for better code organization and reusability.For example, you could create:
UnreadChannelsSection
UnreadThreadsSection
UnreadByTypeSection
UnreadByTeamSection
This would make the code more modular and easier to maintain.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
DemoApp/Screens/UserProfileViewController.swift
(5 hunks)Sources/StreamChat/APIClient/Endpoints/Payloads/UserPayloads.swift
(1 hunks)Sources/StreamChat/Models/CurrentUser.swift
(2 hunks)Tests/StreamChatTests/Controllers/CurrentUserController/CurrentUserController_Tests.swift
(2 hunks)Tests/StreamChatTests/Workers/CurrentUserUpdater_Tests.swift
(2 hunks)
🔇 Additional comments (5)
Tests/StreamChatTests/Workers/CurrentUserUpdater_Tests.swift (1)
744-784
: LGTM! Test coverage for the newtotalUnreadCountByTeam
feature is properly implemented.The test correctly:
- Includes the new field in the payload simulation
- Verifies the field is properly transformed and accessible in the result model
- Maintains consistency with the existing test structure
Sources/StreamChat/Models/CurrentUser.swift (1)
129-130
: LGTM! ThetotalUnreadCountByTeam
property is correctly added to the model.The implementation properly:
- Declares the property as optional, which is appropriate for backward compatibility
- Maps the value from the payload in the
asModel()
method- Maintains consistency with the existing model structure
Also applies to: 182-182
Tests/StreamChatTests/Controllers/CurrentUserController/CurrentUserController_Tests.swift (1)
804-836
: LGTM! Controller test properly validates the newtotalUnreadCountByTeam
feature.The test correctly verifies that the controller:
- Receives the new property from the updater
- Passes it through without modification
- Maintains the expected data structure
Sources/StreamChat/APIClient/Endpoints/Payloads/UserPayloads.swift (1)
211-211
: LGTM! API payload correctly implements the newtotalUnreadCountByTeam
field.The implementation:
- Uses the correct snake_case coding key following API conventions
- Declares the property as optional for backward compatibility
- Maintains consistency with the existing payload structure
Also applies to: 219-219
DemoApp/Screens/UserProfileViewController.swift (1)
110-114
: LGTM! UI implementation correctly displays the new unread counts by team feature.The implementation:
- Properly integrates with the existing table view structure
- Correctly handles async data loading with appropriate queue management
- Displays the new
totalUnreadCountByTeam
data in a user-friendly format- Handles the optional nature of the team unread counts appropriately
Also applies to: 143-160, 353-377
SDK Size
|
SDK Performance
|
SDK Size
|
|
🔗 Issue Links
https://linear.app/stream/issue/IOS-977/unread-count-per-team-support-for-ios
🎯 Goal
Add
CurrentUserUnreads.totalUnreadCountByTeam
.📝 Summary
CurrentUserUnreads.totalUnreadCountByTeam
when fetching all unreads.🧪 Manual Testing Notes
☑️ Contributor Checklist
docs-content
repoSummary by CodeRabbit
New Features
Bug Fixes
Tests