Skip to content

Commit

Permalink
Merge pull request #390 from zsw666/master
Browse files Browse the repository at this point in the history
v10.2.0
  • Loading branch information
shine2008 committed Jun 20, 2024
2 parents 0272983 + 53f3818 commit 3286c5a
Show file tree
Hide file tree
Showing 57 changed files with 386 additions and 190 deletions.
4 changes: 2 additions & 2 deletions NEChatUIKit/NEChatUIKit.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Pod::Spec.new do |s|
#

s.name = 'NEChatUIKit'
s.version = '10.1.0'
s.version = '10.2.0'
s.summary = 'Chat Module of IM.'

# This description is used to generate tags and improve search results.
Expand Down Expand Up @@ -48,6 +48,6 @@ TODO: Add long description of the pod here.
s.dependency 'MJRefresh'
s.dependency 'SDWebImageWebPCoder'
s.dependency 'SDWebImageSVGKitPlugin'
s.dependency 'lottie-ios','2.5.3'
s.dependency 'lottie-ios','4.4.0'

end
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"scale" : "1x"
},
{
"filename" : "fun_top_message_Image@2x.png",
"filename" : "fun_top_message_image@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "fun_top_message_Image@3x.png",
"filename" : "fun_top_message_image@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "op_ai_word@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "op_ai_word@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "op_top@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "op_top@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "op_untop@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "op_untop@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"scale" : "1x"
},
{
"filename" : "top_message_Image@2x.png",
"filename" : "top_message_image@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "top_message_Image@3x.png",
"filename" : "top_message_image@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
Expand Down
4 changes: 4 additions & 0 deletions NEChatUIKit/NEChatUIKit/Assets/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@
"message_reedit" = "reedit";
"message_revoke_confirm" = "Wether to recall this message";
"message_delete_confirm"="Wether to delete this message";
"collection_delete_confirm"="Wether to delete this collection";
"delete_collection_success"="delete success";


//MARK: toast
Expand Down Expand Up @@ -219,3 +221,5 @@
"chat_collection_p2p_tip"="From Chat with %@";

"chat_collection_team_tip"="From %@ ";

"collection_limit"="The number of favorites has reached the limit value";
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@
"message_reedit" = "重新编辑";
"message_revoke_confirm" = "确认要撤回该消息吗?";
"message_delete_confirm"="确认要删除该消息吗?";
"collection_delete_confirm"="确认要删除该收藏吗?";
"delete_collection_success"="删除成功";


//MARK: toast
Expand Down Expand Up @@ -216,3 +218,5 @@
"chat_collection_p2p_tip"="来自于 与%@的会话";

"chat_collection_team_tip"="来自于 %@";

"collection_limit"="收藏数已达到限制值";
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,6 @@ open class ChatViewController: NEChatBaseViewController, UINavigationControllerD

if let ms = weakSelf?.viewModel.messages, ms.count > 0 {
weakSelf?.tableViewReload()
weakSelf?.hasFirstLoadData = true
if weakSelf?.viewModel.isHistoryChat == true,
let num = weakSelf?.tableView.numberOfRows(inSection: 0),
index < num, index >= 0 {
Expand All @@ -654,6 +653,7 @@ open class ChatViewController: NEChatBaseViewController, UINavigationControllerD
} else if let err = error {
weakSelf?.showErrorToast(err)
}

weakSelf?.loadDataFinish()
}
}
Expand Down Expand Up @@ -1767,6 +1767,7 @@ open class ChatViewController: NEChatBaseViewController, UINavigationControllerD
// record
open func recordAudio(_ filePath: String?, didBeganWithError error: Error?) {
print("[record] sdk Began error:\(error?.localizedDescription ?? "")")
stopPlay()
}

open func recordAudio(_ filePath: String?, didCompletedWithError error: Error?) {
Expand Down Expand Up @@ -2241,7 +2242,11 @@ open class ChatViewController: NEChatBaseViewController, UINavigationControllerD

viewModel.collectMessage(operationModel, title ?? "") { [weak self] error in
if error != nil {
self?.showToast(chatLocalizable("failed_operation"))
if error?.code == collectionLimitCode {
self?.showToast(chatLocalizable("collection_limit"))
} else {
self?.showToast(chatLocalizable("failed_operation"))
}
} else {
self?.showToast(chatLocalizable("collection_success"))
}
Expand Down Expand Up @@ -2323,7 +2328,7 @@ open class ChatViewController: NEChatBaseViewController, UINavigationControllerD
open func tableView(_ tableView: UITableView,
cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard indexPath.row < viewModel.messages.count else { return NEBaseChatMessageCell() }
let model = viewModel.messages[indexPath.row]
var model = viewModel.messages[indexPath.row]
var reuseId = "\(NEBaseChatMessageCell.self)"
if model.replyedModel?.isReplay == true,
model.isRevoked == false {
Expand Down Expand Up @@ -2567,7 +2572,7 @@ open class ChatViewController: NEChatBaseViewController, UINavigationControllerD
open func showTextViewController(_ model: MessageContentModel?) {
guard let model = model as? MessageTextModel else { return }

let title = NECustomAttachment.titleOfRichText(model.message?.attachment)
let title = NECustomUtils.titleOfRichText(model.message?.attachment)
let body = model.attributeStr

if !(title?.isEmpty == false), !(body?.string.isEmpty == false) {
Expand Down Expand Up @@ -2791,7 +2796,7 @@ open class ChatViewController: NEChatBaseViewController, UINavigationControllerD
showTextViewController(model)
}
} else if customType == customMultiForwardType,
let data = NECustomAttachment.dataOfCustomMessage(model?.message?.attachment) {
let data = NECustomUtils.dataOfCustomMessage(model?.message?.attachment) {
let url = data["url"] as? String
let md5 = data["md5"] as? String
guard let fileDirectory = NEPathUtils.getDirectoryForDocuments(dir: "\(imkitDir)file/") else { return }
Expand Down Expand Up @@ -2850,15 +2855,29 @@ open class ChatViewController: NEChatBaseViewController, UINavigationControllerD
extension ChatViewController: TopMessageViewDelegate {
/// 点击置顶消息视图中的关闭按钮
public func didClickCloseButton() {
// 校验网络
if NEChatDetectNetworkTool.shareInstance.manager?.isReachable == false {
showToast(commonLocalizable("network_error"))
return
}

viewModel.untopMessage { [weak self] error in
if let err = error {
self?.showErrorToast(err)
} else {
self?.topMessageView.removeFromSuperview()
}
}
}

/// 点击置顶消息视图
public func didTapTopMessageView() {
// 校验网络
if NEChatDetectNetworkTool.shareInstance.manager?.isReachable == false {
showToast(commonLocalizable("network_error"))
return
}

var index = -1
for (i, m) in viewModel.messages.enumerated() {
if viewModel.topMessage?.messageClientId == m.message?.messageClientId {
Expand Down Expand Up @@ -2929,7 +2948,7 @@ extension ChatViewController: NEMutilSelectBottomViewDelegate {
}

// 解析消息中的depth
if let data = NECustomAttachment.dataOfCustomMessage(msg.attachment) {
if let data = NECustomUtils.dataOfCustomMessage(msg.attachment) {
if let dep = data["depth"] as? Int {
if dep >= customMultiForwardMaxDepth {
invalidMessages.append(msg)
Expand Down Expand Up @@ -3164,6 +3183,7 @@ extension ChatViewController: ChatBaseCellDelegate {
}

if index >= 0 {
ChatDeduplicationHelper.instance.removeBlackTipSendedId(messageId: msg.messageClientId)
viewModel.sendMessage(message: msg) { _, error in
if let err = error {
print("resend message error: \(err.localizedDescription)")
Expand All @@ -3188,7 +3208,7 @@ extension ChatViewController: ChatBaseCellDelegate {
return
}
}
let data = NECustomAttachment.dataOfCustomMessage(model?.message?.attachment)
let data = NECustomUtils.dataOfCustomMessage(model?.message?.attachment)

let time = message.createTime
let date = Date()
Expand Down Expand Up @@ -3285,7 +3305,9 @@ extension ChatViewController: ChatBaseCellDelegate {
ReadViewController(message: message, teamId: teamId)
}

open func loadDataFinish() {}
open func loadDataFinish() {
hasFirstLoadData = true
}

// MARK: - call kit noti

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ open class MultiForwardViewController: NEChatBaseViewController, UINavigationCon
}
} else if model?.type == .custom {
if model?.customType == customMultiForwardType,
let data = NECustomAttachment.dataOfCustomMessage(model?.message?.attachment) {
let data = NECustomUtils.dataOfCustomMessage(model?.message?.attachment) {
let url = data["url"] as? String
let md5 = data["md5"] as? String
guard let fileDirectory = NEPathUtils.getDirectoryForDocuments(dir: imkitDir) else { return }
Expand Down
Loading

0 comments on commit 3286c5a

Please sign in to comment.