refactor: adapt to HyphenateChat SDK 5.0 and remove message report feature#70
Open
ziloongyang wants to merge 8 commits into
Open
refactor: adapt to HyphenateChat SDK 5.0 and remove message report feature#70ziloongyang wants to merge 8 commits into
ziloongyang wants to merge 8 commits into
Conversation
added 4 commits
June 16, 2026 14:18
…and remove toJsonObject usage 1. Remove toJsonObject methods from ChatUserProfile related classes, no longer pass user info through message extensions 2. Add utility methods for batch updating user cache, unifying the cache update process 3. Implement SDK user info change delegate to automatically synchronize and update local user cache 4. Remove manual user cache update code scattered throughout the project, simplifying business logic 5. Update example project configuration and README documentation to adapt to the new user management logic
- Unified the acquisition of the global contact service through `ChatUIKitClient.shared`. - Optimized the logic for building user profiles by prioritizing the reading of nicknames and avatars from the `userInfo` of the contact object, reducing dependency on local cache. - Added contact sync state management to prevent duplicate fetching of contact data. - Fixed the avatar loading issue in the new contact request cell by only loading the image when the avatar URL is not empty. - Improved the contact event listening process to handle scenarios such as friend sync completion, friend info changes, and friend requests. - Refactored the user profile conversion logic in example pages and search pages, extracting reusable code. - Replaced `UIImageView` with the custom `ImageView` class in the new contact request cell. - Removed the redundant `transformUserInfos` method in `ChatUIKitClient` and migrated the related logic to the corresponding business layers. - Enabled the auto-sync contacts configuration item in the example app. - Updated the README documentation to fix namespace issues and deprecated API calls in the code examples.
- Added logic in `MessageEntity` to build user profiles using the message's `senderInfo`, prioritizing the sender's profile carried by the message. - Introduced `updateUserInfoIfNeed` method in `ChatUIKitClient` to automatically synchronize local user info to the server upon login.
Adapted for both local history message loading and server fetching scenarios, extracting user profiles from message extension fields and updating the cache.
ziloongyang
commented
Jul 1, 2026
| let hasCredentials = !userName.isEmpty && !token.isEmpty | ||
| if hasCredentials { | ||
| // There is no need to wait for a successful login. | ||
| // Return `MainViewController` immediately; the conversation/contact/group |
ziloongyang
commented
Jul 1, 2026
| private var threadHistoryCursor: String? | ||
|
|
||
| /// Whether the server has no more chat-thread history. | ||
| private var threadHistoryNoMore = false |
ziloongyang
commented
Jul 1, 2026
| ChatUIKitContext.shared?.chatCache?[message.from] = user | ||
| } | ||
| let option = ChatFetchServerMessagesOption() | ||
| option.direction = searchMessage ? .down:.up |
ziloongyang
commented
Jul 1, 2026
ziloongyang
commented
Jul 1, 2026
|
|
||
| deinit { | ||
| ChatClient.shared().contactManager?.removeDelegate(self) | ||
| ChatClient.shared().removeDelegate(self) |
ziloongyang
commented
Jul 1, 2026
| notifyLocalConversations() | ||
| return | ||
| } | ||
| self.fetchSilentMode(conversationIds: conversations.map({ $0.conversationId })) { [weak self] resultSilent, silentError in |
Collaborator
Author
There was a problem hiding this comment.
conversation中已有
ziloongyang
commented
Jul 1, 2026
| /// - Parameters: | ||
| /// - completion: Callback, if successful it will return a string array of user id, if it fails it will return an error. | ||
| /// - completion: Callback, if successful it will return a ``Contact`` array, if it fails it will return an error. | ||
| func contacts(completion: @escaping (ChatError?,[Contact]) -> Void) |
ziloongyang
commented
Jul 1, 2026
| }) | ||
| } else { | ||
| self.mirrorIdsToProfiles(users: ChatClient.shared().contactManager?.getBlackList()) | ||
| ChatClient.shared().contactManager?.getBlackListFromServer(completion: { [weak self] users, error in |
ziloongyang
commented
Jul 1, 2026
| self.view.backgroundColor = UIColor.theme.neutralColor98 | ||
| self.navigation.title = "Groups".chat.localize | ||
| self.view.addSubViews([self.navigation,self.groupList]) | ||
| self.view.addSubViews([self.navigation,self.groupList,self.loadingView]) |
added 3 commits
July 16, 2026 10:21
…ature - Removed the complete message report feature: deleted the report controller, cell, resource images, and localized strings; removed the report option from the message long-press menu; and unregistered the report controller from component registration. - Adapted to the new data synchronization mechanism in SDK 5.0: replaced the old auto-sync configuration with `dataSyncType`; removed old APIs for fetching contacts, conversations, and groups from the server; and switched to using callback notifications for auto-sync after login. - Updated the loading logic for contacts, conversations, and group modules, adding loading animations during the synchronization process to optimize user experience. - Modified Pod dependencies and project configurations, updated API parameters for creating groups, and removed useless Main Storyboard configurations. - Optimized the logic for loading ChatThread history messages, and unified the localized string key for the ActionSheet cancel button.
- Introduced a new `ChatDataSyncListener` protocol for unified data synchronization notifications. - Refactored chat service implementations to support cursor-based pagination for loading messages, improving the handling of server history. - Removed deprecated methods and optimized the logic for fetching contacts and conversations, ensuring a more efficient data sync process. - Adjusted UI components to reflect changes in data handling, including updates to the message input bar and contact info view controller.
…tiple users - Modified `userDidJoin` and `userDidLeave` methods in `GroupServiceImplement` to accept an array of user IDs instead of a single user ID, enhancing the functionality to support multiple users joining or leaving a group. - Updated the corresponding protocol in `GroupService` to reflect the changes in method parameters. - Refactored UI components to utilize the local methods for improved data handling when managing blocked contacts.
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
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.
dataSyncType; removed old APIs for fetching contacts, conversations, and groups from the server; and switched to using callback notifications for auto-sync after login.