Skip to content

Commit 9764afd

Browse files
authored
v10.8.4 (#441)
1 parent 7203735 commit 9764afd

11 files changed

Lines changed: 44 additions & 35 deletions

File tree

NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/ChatViewController.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,11 @@ open class ChatViewController: NEChatBaseViewController, UINavigationControllerD
901901
open func appEnterForegournd() {
902902
isCurrentPage = true
903903
markNeedReadMsg()
904+
if !viewModel.isHistoryChat {
905+
DispatchQueue.main.asyncAfter(deadline: .now() + 0.25, execute: DispatchWorkItem(block: { [weak self] in
906+
self?.scrollTableViewToBottom()
907+
}))
908+
}
904909
}
905910

906911
// MARK: - 键盘通知相关操作
@@ -3949,6 +3954,10 @@ extension ChatViewController: NEIMKitClientListener {
39493954

39503955
if status == .CONNECT_STATUS_CONNECTED, networkBroken {
39513956
networkBroken = false
3957+
if isCurrentPage {
3958+
markNeedReadMsg()
3959+
}
3960+
39523961
DispatchQueue.main.asyncAfter(deadline: .now() + 1, execute: DispatchWorkItem(block: { [weak self] in
39533962
// 断网重连后不会重发标记回调,需要手动拉取
39543963
self?.reLoadMoreWithMessage()

NEChatUIKit/NEChatUIKit/Classes/Chat/Helper/ChatMessageHelper.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,8 @@ public class ChatMessageHelper: NSObject {
5858
return ""
5959
}
6060
if V2NIMConversationIdUtil.conversationType(conversationId) == .CONVERSATION_TYPE_P2P {
61-
if NEAIUserManager.shared.isAIUser(sessionId) {
62-
return NEAIUserManager.shared.getShowName(sessionId) ?? sessionId
63-
}
64-
return NEFriendUserCache.shared.getShowName(sessionId)
61+
let user = getUserFromCache(sessionId)
62+
return user?.showName(showAlias) ?? sessionId
6563
} else {
6664
return NETeamUserManager.shared.getTeamInfo()?.name ?? sessionId
6765
}

NEChatUIKit/NEChatUIKit/Classes/Chat/Model/MessageImageModel.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ open class MessageImageModel: MessageContentModel {
1818
if let path = imageObject.path, FileManager.default.fileExists(atPath: path) {
1919
urlString = path
2020
} else if let url = imageObject.url {
21-
if imageObject.ext?.lowercased() != ".gif" {
22-
urlString = V2NIMStorageUtil.imageThumbUrl(url, thumbSize: 350)
21+
if imageObject.ext?.lowercased() != ".gif",
22+
ChatUIConfig.shared.imageThumbSize > 0 {
23+
urlString = V2NIMStorageUtil.imageThumbUrl(url, thumbSize: ChatUIConfig.shared.imageThumbSize)
2324
} else {
2425
urlString = url
2526
}

NEChatUIKit/NEChatUIKit/Classes/Chat/ViewModel/TeamChatViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ open class TeamChatViewModel: ChatViewModel, NETeamListener {
100100

101101
// 获取图片缩略图
102102
if let attach = topMessage.attachment as? V2NIMMessageImageAttachment, let imageUrl = attach.url {
103-
thumbUrl = V2NIMStorageUtil.imageThumbUrl(imageUrl, thumbSize: 350)
103+
thumbUrl = V2NIMStorageUtil.imageThumbUrl(imageUrl, thumbSize: ChatUIConfig.shared.imageThumbSize)
104104
}
105105

106106
// 获取视频首帧

NEChatUIKit/NEChatUIKit/Classes/ChatConfig/ChatUIConfig.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ public class ChatUIConfig: NSObject {
6262
/// 发送文件大小限制(单位:MB)
6363
public var fileSizeLimit: Double = 200
6464

65+
/// 图片缩略图尺寸大小,为 0 则使用原图,本地图片默认使用原图
66+
public var imageThumbSize: Int = 350
67+
6568
/// 群未读显示限制数,默认超过200人不显示已读未读进度
6669
public var maxReadingNum = 200
6770

NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/FunChatMessageImageCell.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,12 @@ open class FunChatMessageImageCell: FunChatMessageBaseCell {
7070
options = [.retryFailed, .progressiveLoad]
7171
}
7272

73-
let context: [SDWebImageContextOption: Any] = [.imageThumbnailPixelSize: CGSize(width: 1000, height: 1000)]
7473
if imageUrl.hasPrefix("http") {
7574
let url = URL(string: imageUrl)
76-
contentImageView.sd_setImage(with: url, placeholderImage: nil, options: options, context: context)
75+
contentImageView.sd_setImage(with: url, placeholderImage: nil, options: options, context: nil)
7776
} else {
7877
let url = URL(fileURLWithPath: imageUrl)
79-
contentImageView.sd_setImage(with: url, placeholderImage: nil, options: options, context: context)
78+
contentImageView.sd_setImage(with: url, placeholderImage: nil, options: options, context: nil)
8079
}
8180
} else {
8281
contentImageView.image = nil

NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/ChatMessageImageCell.swift

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,19 +84,20 @@ open class ChatMessageImageCell: NormalChatMessageBaseCell {
8484

8585
setCustomCorner(model.isReplay)
8686

87-
if let m = model as? MessageImageModel, let imageUrl = m.urlString {
87+
if let m = model as? MessageImageModel,
88+
let imageUrl = m.urlString {
8889
var options: SDWebImageOptions = [.retryFailed]
89-
if let imageObject = model.message?.attachment as? V2NIMMessageImageAttachment, imageObject.ext?.lowercased() != ".gif" {
90+
if let imageObject = model.message?.attachment as? V2NIMMessageImageAttachment,
91+
imageObject.ext?.lowercased() != ".gif" {
9092
options = [.retryFailed, .progressiveLoad]
9193
}
9294

93-
let context: [SDWebImageContextOption: Any] = [.imageThumbnailPixelSize: CGSize(width: 1000, height: 1000)]
9495
if imageUrl.hasPrefix("http") {
9596
let url = URL(string: imageUrl)
96-
contentImageView.sd_setImage(with: url, placeholderImage: nil, options: options, context: context)
97+
contentImageView.sd_setImage(with: url, placeholderImage: nil, options: options, context: nil)
9798
} else {
9899
let url = URL(fileURLWithPath: imageUrl)
99-
contentImageView.sd_setImage(with: url, placeholderImage: nil, options: options, context: context)
100+
contentImageView.sd_setImage(with: url, placeholderImage: nil, options: options, context: nil)
100101
}
101102
} else {
102103
contentImageView.image = nil

NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/ChatMessageReplyCell.swift

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -61,30 +61,20 @@ open class ChatMessageReplyCell: ChatMessageAIStreamTextCell {
6161
super.setModel(model, isSend)
6262

6363
let replyImageView = isSend ? replyImageViewRight : replyImageViewLeft
64-
if model.message?.messageType == .MESSAGE_TYPE_IMAGE,
65-
let imageObject = model.message?.attachment as? V2NIMMessageImageAttachment {
66-
var urlString = ""
67-
if let path = imageObject.path, FileManager.default.fileExists(atPath: path) {
68-
urlString = path
69-
} else if let url = imageObject.url {
70-
if imageObject.ext?.lowercased() != ".gif" {
71-
urlString = V2NIMStorageUtil.imageThumbUrl(url, thumbSize: 350)
72-
}
73-
urlString = url
74-
}
75-
64+
if let m = model as? MessageImageModel,
65+
let urlString = m.urlString {
7666
var options: SDWebImageOptions = [.retryFailed]
77-
if imageObject.ext?.lowercased() != ".gif" {
67+
if let imageObject = model.message?.attachment as? V2NIMMessageImageAttachment,
68+
imageObject.ext?.lowercased() != ".gif" {
7869
options = [.retryFailed, .progressiveLoad]
7970
}
8071

81-
let context: [SDWebImageContextOption: Any] = [.imageThumbnailPixelSize: CGSize(width: 1000, height: 1000)]
8272
if urlString.hasPrefix("http") {
8373
let url = URL(string: urlString)
84-
replyImageView.sd_setImage(with: url, placeholderImage: nil, options: options, context: context)
74+
replyImageView.sd_setImage(with: url, placeholderImage: nil, options: options, context: nil)
8575
} else {
8676
let url = URL(fileURLWithPath: urlString)
87-
replyImageView.sd_setImage(with: url, placeholderImage: nil, options: options, context: context)
77+
replyImageView.sd_setImage(with: url, placeholderImage: nil, options: options, context: nil)
8878
}
8979
} else {
9080
replyImageView.image = nil

PodConfigs/config_podspec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module YXConfig
44
def self.imuikit_version
5-
"10.8.3"
5+
"10.8.4"
66
end
77

88
def self.deployment_target

Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ target 'app' do
1212
# 基础库
1313
pod 'NEChatKit', YXConfig.imuikit_version
1414

15-
# UI 组件,YXConfig.imuikit_version = 10.8.3
15+
# UI 组件,YXConfig.imuikit_version = 10.8.4
1616
pod 'NEChatUIKit', YXConfig.imuikit_version # 会话(聊天)组件
1717
pod 'NEContactUIKit', YXConfig.imuikit_version # 通讯录组件
1818
pod 'NEConversationUIKit', YXConfig.imuikit_version # (云端)会话列表组件

0 commit comments

Comments
 (0)