From 1f86bc577b852fc7b980a4b650ecda33e3928e94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E7=BB=A7=E8=B6=85?= <984065974@qq.com> Date: Tue, 18 Nov 2025 14:39:00 +0800 Subject: [PATCH 1/4] fix modify time less than message timestamp logic --- .../Service/Implement/ChatServiceImplement.swift | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/Sources/EaseChatUIKit/Classes/Service/Implement/ChatServiceImplement.swift b/Sources/EaseChatUIKit/Classes/Service/Implement/ChatServiceImplement.swift index 40381bdd..4b1202cb 100644 --- a/Sources/EaseChatUIKit/Classes/Service/Implement/ChatServiceImplement.swift +++ b/Sources/EaseChatUIKit/Classes/Service/Implement/ChatServiceImplement.swift @@ -121,11 +121,6 @@ extension ChatServiceImplement: ChatService { for message in messages { if let dic = message.ext?["ease_chat_uikit_user_info"] as? Dictionary { if let user = ChatUIKitContext.shared?.userCache?[message.from] as? ChatUserProfile,user.modifyTime < message.timestamp { - let user = ChatUserProfile() - user.setValuesForKeys(dic) - if user.id.isEmpty { - user.id = message.from - } user.modifyTime = message.timestamp ChatUIKitContext.shared?.chatCache?[message.from] = user } else { @@ -163,11 +158,6 @@ extension ChatServiceImplement: ChatService { for message in messages { if let dic = message.ext?["ease_chat_uikit_user_info"] as? Dictionary { if let user = ChatUIKitContext.shared?.chatCache?[message.from] as? ChatUserProfile,user.modifyTime < message.timestamp { - let user = ChatUserProfile() - user.setValuesForKeys(dic) - if user.id.isEmpty { - user.id = message.from - } user.modifyTime = message.timestamp ChatUIKitContext.shared?.chatCache?[message.from] = user } else { From 23b8fdb2e9226db6d36a0f801edeffb27e274788 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E7=BB=A7=E8=B6=85?= <984065974@qq.com> Date: Tue, 18 Nov 2025 14:46:24 +0800 Subject: [PATCH 2/4] fix --- .../Implement/ChatServiceImplement.swift | 42 +++++++++---------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/Sources/EaseChatUIKit/Classes/Service/Implement/ChatServiceImplement.swift b/Sources/EaseChatUIKit/Classes/Service/Implement/ChatServiceImplement.swift index 4b1202cb..11b6d054 100644 --- a/Sources/EaseChatUIKit/Classes/Service/Implement/ChatServiceImplement.swift +++ b/Sources/EaseChatUIKit/Classes/Service/Implement/ChatServiceImplement.swift @@ -120,17 +120,16 @@ extension ChatServiceImplement: ChatService { if error == nil,let messages = messages { for message in messages { if let dic = message.ext?["ease_chat_uikit_user_info"] as? Dictionary { - if let user = ChatUIKitContext.shared?.userCache?[message.from] as? ChatUserProfile,user.modifyTime < message.timestamp { - user.modifyTime = message.timestamp - ChatUIKitContext.shared?.chatCache?[message.from] = user - } else { - let user = ChatUserProfile() - user.setValuesForKeys(dic) - if user.id.isEmpty { - user.id = message.from - } - user.modifyTime = message.timestamp - ChatUIKitContext.shared?.chatCache?[message.from] = user + let user = ChatUserProfile() + user.setValuesForKeys(dic) + if user.id.isEmpty { + user.id = message.from + } + user.modifyTime = message.timestamp + ChatUIKitContext.shared?.chatCache?[message.from] = user + if let cacheUser = ChatUIKitContext.shared?.userCache?[message.from] as? ChatUserProfile,cacheUser.modifyTime < message.timestamp { + cacheUser.modifyTime = message.timestamp + ChatUIKitContext.shared?.chatCache?[message.from] = cacheUser } } if let dic = message.ext?["ease_chat_uikit_text_url_preview"] as? Dictionary,let url = dic["url"] { @@ -157,17 +156,16 @@ extension ChatServiceImplement: ChatService { if error == nil,let messages = result?.list { for message in messages { if let dic = message.ext?["ease_chat_uikit_user_info"] as? Dictionary { - if let user = ChatUIKitContext.shared?.chatCache?[message.from] as? ChatUserProfile,user.modifyTime < message.timestamp { - user.modifyTime = message.timestamp - ChatUIKitContext.shared?.chatCache?[message.from] = user - } else { - let user = ChatUserProfile() - user.setValuesForKeys(dic) - if user.id.isEmpty { - user.id = message.from - } - user.modifyTime = message.timestamp - ChatUIKitContext.shared?.chatCache?[message.from] = user + let user = ChatUserProfile() + user.setValuesForKeys(dic) + if user.id.isEmpty { + user.id = message.from + } + user.modifyTime = message.timestamp + ChatUIKitContext.shared?.chatCache?[message.from] = user + if let cacheUser = ChatUIKitContext.shared?.userCache?[message.from] as? ChatUserProfile,cacheUser.modifyTime < message.timestamp { + cacheUser.modifyTime = message.timestamp + ChatUIKitContext.shared?.chatCache?[message.from] = cacheUser } } } From d45402b942b6a0a5280242318caa5965ebbf15b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E7=BB=A7=E8=B6=85?= <984065974@qq.com> Date: Tue, 18 Nov 2025 15:00:05 +0800 Subject: [PATCH 3/4] fix logic --- .../Implement/ChatServiceImplement.swift | 38 +++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/Sources/EaseChatUIKit/Classes/Service/Implement/ChatServiceImplement.swift b/Sources/EaseChatUIKit/Classes/Service/Implement/ChatServiceImplement.swift index 11b6d054..8e89d08c 100644 --- a/Sources/EaseChatUIKit/Classes/Service/Implement/ChatServiceImplement.swift +++ b/Sources/EaseChatUIKit/Classes/Service/Implement/ChatServiceImplement.swift @@ -120,16 +120,15 @@ extension ChatServiceImplement: ChatService { if error == nil,let messages = messages { for message in messages { if let dic = message.ext?["ease_chat_uikit_user_info"] as? Dictionary { - let user = ChatUserProfile() - user.setValuesForKeys(dic) - if user.id.isEmpty { - user.id = message.from - } - user.modifyTime = message.timestamp - ChatUIKitContext.shared?.chatCache?[message.from] = user - if let cacheUser = ChatUIKitContext.shared?.userCache?[message.from] as? ChatUserProfile,cacheUser.modifyTime < message.timestamp { - cacheUser.modifyTime = message.timestamp - ChatUIKitContext.shared?.chatCache?[message.from] = cacheUser + let user = ChatUIKitContext.shared?.userCache?[message.from] as? ChatUserProfile + if user?.modifyTime ?? 0 < message.timestamp { + let user = ChatUserProfile() + user.setValuesForKeys(dic) + if user.id.isEmpty { + user.id = message.from + } + user.modifyTime = message.timestamp + ChatUIKitContext.shared?.chatCache?[message.from] = user } } if let dic = message.ext?["ease_chat_uikit_text_url_preview"] as? Dictionary,let url = dic["url"] { @@ -156,16 +155,15 @@ extension ChatServiceImplement: ChatService { if error == nil,let messages = result?.list { for message in messages { if let dic = message.ext?["ease_chat_uikit_user_info"] as? Dictionary { - let user = ChatUserProfile() - user.setValuesForKeys(dic) - if user.id.isEmpty { - user.id = message.from - } - user.modifyTime = message.timestamp - ChatUIKitContext.shared?.chatCache?[message.from] = user - if let cacheUser = ChatUIKitContext.shared?.userCache?[message.from] as? ChatUserProfile,cacheUser.modifyTime < message.timestamp { - cacheUser.modifyTime = message.timestamp - ChatUIKitContext.shared?.chatCache?[message.from] = cacheUser + let user = ChatUIKitContext.shared?.userCache?[message.from] as? ChatUserProfile + if user?.modifyTime ?? 0 < message.timestamp { + let user = ChatUserProfile() + user.setValuesForKeys(dic) + if user.id.isEmpty { + user.id = message.from + } + user.modifyTime = message.timestamp + ChatUIKitContext.shared?.chatCache?[message.from] = user } } } From a3b3d80c90443c49f4a740b6d5f88712676f2056 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E7=BB=A7=E8=B6=85?= <984065974@qq.com> Date: Tue, 18 Nov 2025 17:20:29 +0800 Subject: [PATCH 4/4] fix hooker incorrect --- .../Classes/UI/Components/Chat/Views/MessageListView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/EaseChatUIKit/Classes/UI/Components/Chat/Views/MessageListView.swift b/Sources/EaseChatUIKit/Classes/UI/Components/Chat/Views/MessageListView.swift index 53e29dbd..09370a27 100644 --- a/Sources/EaseChatUIKit/Classes/UI/Components/Chat/Views/MessageListView.swift +++ b/Sources/EaseChatUIKit/Classes/UI/Components/Chat/Views/MessageListView.swift @@ -640,7 +640,7 @@ extension MessageListView: UITableViewDelegate,UITableViewDataSource { } switch area { case .avatar: - if ComponentViewsActionHooker.shared.chat.bubbleClicked != nil { + if ComponentViewsActionHooker.shared.chat.avatarClicked != nil { if let user = entity.message.user { ComponentViewsActionHooker.shared.chat.avatarClicked?(user) } else {