Skip to content

refactor: adapt to HyphenateChat SDK 5.0 and remove message report feature#70

Open
ziloongyang wants to merge 8 commits into
easemob:sdk-5.0from
ziloongyang:5.0
Open

refactor: adapt to HyphenateChat SDK 5.0 and remove message report feature#70
ziloongyang wants to merge 8 commits into
easemob:sdk-5.0from
ziloongyang:5.0

Conversation

@ziloongyang

Copy link
Copy Markdown
Collaborator
  • 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.

yangzilong 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.
Comment thread Example/EaseChatUIKit/AppDelegate.swift Outdated
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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

移除这块逻辑

private var threadHistoryCursor: String?

/// Whether the server has no more chat-thread history.
private var threadHistoryNoMore = false

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

移到viewmodel

ChatUIKitContext.shared?.chatCache?[message.from] = user
}
let option = ChatFetchServerMessagesOption()
option.direction = searchMessage ? .down:.up

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

加兼容注释

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修改参数option


deinit {
ChatClient.shared().contactManager?.removeDelegate(self)
ChatClient.shared().removeDelegate(self)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

整合提前

notifyLocalConversations()
return
}
self.fetchSilentMode(conversationIds: conversations.map({ $0.conversationId })) { [weak self] resultSilent, silentError in

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

conversation中已有

/// - 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)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

移除

})
} else {
self.mirrorIdsToProfiles(users: ChatClient.shared().contactManager?.getBlackList())
ChatClient.shared().contactManager?.getBlackListFromServer(completion: { [weak self] users, error in

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改回本地

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])

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不需要loading

@zjc19891106
zjc19891106 changed the base branch from main to sdk-5.0 July 15, 2026 05:35
yangzilong 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant