Skip to content

Commit 748523f

Browse files
authored
v10.8.5 (#442)
1 parent 9764afd commit 748523f

569 files changed

Lines changed: 57454 additions & 362 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

NEChatUIKit/NEChatUIKit/Assets/en.lproj/Localizable.strings

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,5 @@
226226

227227
"p2p_chat_online" = "(Online)";
228228
"p2p_chat_offline" = "(Offline)";
229+
230+
"line_break" = "Return";

NEChatUIKit/NEChatUIKit/Assets/zh-Hans.lproj/Localizable.strings

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,5 @@
222222

223223
"p2p_chat_online" = "(在线)";
224224
"p2p_chat_offline" = "(离线)";
225+
226+
"line_break" = "换行";

NEChatUIKit/NEChatUIKit/Classes/Base/BaseViewController/NEChatBaseViewController.swift

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ open class NEChatBaseViewController: UIViewController, UIGestureRecognizerDelega
8383
}
8484

8585
open func setupBackUI() {
86-
let image = coreLoader.loadImage("back_arrow")?.withRenderingMode(.alwaysOriginal)
86+
let image = CommonUIConfig.shared.backArrowImage?.withRenderingMode(.alwaysOriginal)
8787
let backItem = UIBarButtonItem(
8888
image: image,
8989
style: .plain,
@@ -101,4 +101,17 @@ open class NEChatBaseViewController: UIViewController, UIGestureRecognizerDelega
101101
}
102102

103103
open func toSetting() {}
104+
105+
open func addLeftSwipeDismissGesture() {
106+
// 侧滑返回(根视图)
107+
let gestureRecognizer = UIScreenEdgePanGestureRecognizer(target: self, action: #selector(swipeDismiss))
108+
gestureRecognizer.edges = .left
109+
view.addGestureRecognizer(gestureRecognizer)
110+
}
111+
112+
func swipeDismiss(_ gestureRecognizer: UIScreenEdgePanGestureRecognizer) {
113+
if gestureRecognizer.state == .ended {
114+
navigationController?.dismiss(animated: true, completion: nil)
115+
}
116+
}
104117
}

NEChatUIKit/NEChatUIKit/Classes/Base/NEChatService.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@ public class NEChatService: NSObject, ChatServiceDelegate, NEChatEmojProtocol {
4242
NEChatKitClient.instance.addEmojDelegate(self)
4343
}
4444

45-
open func getEmojAttributeString(_ content: String, _ font: CGFloat) -> NSAttributedString? {
45+
open func getEmojAttributeString(_ content: String, _ font: CGFloat, _ color: UIColor) -> NSAttributedString? {
4646
let attributeStr = NEEmotionTool.getAttWithStr(
4747
str: content,
48-
font: UIFont.systemFont(ofSize: font)
48+
font: UIFont.systemFont(ofSize: font),
49+
color: color
4950
)
5051
return attributeStr
5152
}

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

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import NECoreKit
1313
import NIMSDK
1414
import Photos
1515
import UIKit
16-
import WebKit
1716

1817
@objcMembers
1918
open class ChatViewController: NEChatBaseViewController, UINavigationControllerDelegate, UITableViewDataSource, UITableViewDelegate, UIDocumentPickerDelegate, UIDocumentInteractionControllerDelegate, NIMMediaManagerDelegate, CLLocationManagerDelegate, UITextViewDelegate, UIImagePickerControllerDelegate, ChatInputViewDelegate, ChatInputMultilineDelegate, ChatViewModelDelegate, MessageOperationViewDelegate, NETranslateViewDelegate, SelectLanguageDelegate {
@@ -269,7 +268,7 @@ open class ChatViewController: NEChatBaseViewController, UINavigationControllerD
269268

270269
/// 长按操作菜单
271270
public lazy var operationView: MessageOperationView = {
272-
let operationView = MessageOperationView(frame: .zero)
271+
let operationView = MessageOperationView(frame: CGRect(x: 0, y: 0, width: 16, height: 16))
273272
operationView.isHidden = true
274273
operationView.delegate = self
275274
view.addSubview(operationView)
@@ -323,12 +322,6 @@ open class ChatViewController: NEChatBaseViewController, UINavigationControllerD
323322
self?.contentViewTopAnchor?.constant = 0
324323
}
325324
}
326-
327-
if !viewModel.isHistoryChat {
328-
DispatchQueue.main.asyncAfter(deadline: .now() + 0.25, execute: DispatchWorkItem(block: { [weak self] in
329-
self?.scrollTableViewToBottom()
330-
}))
331-
}
332325
}
333326

334327
override open func viewDidLoad() {
@@ -1719,9 +1712,7 @@ open class ChatViewController: NEChatBaseViewController, UINavigationControllerD
17191712
public func onModefiedMessage(_ index: IndexPath) {
17201713
let visibleRows = tableView.indexPathsForVisibleRows
17211714

1722-
UIView.performWithoutAnimation {
1723-
tableViewReloadIndexs([index])
1724-
}
1715+
tableViewReloadIndexs([index])
17251716

17261717
if !(tableView.isDragging || tableView.isDecelerating),
17271718
let visibleRows = visibleRows,
@@ -2826,7 +2817,7 @@ open class ChatViewController: NEChatBaseViewController, UINavigationControllerD
28262817
/// 获取文本详情页视图控制器
28272818
open func getTextViewController(title: String?, body: NSAttributedString?) -> TextViewController {
28282819
let textViewController = TextViewController(title: title, body: body)
2829-
textViewController.view.backgroundColor = .white
2820+
textViewController.updateLinkDetection()
28302821
return textViewController
28312822
}
28322823

@@ -2895,11 +2886,10 @@ open class ChatViewController: NEChatBaseViewController, UINavigationControllerD
28952886
return
28962887
}
28972888

2898-
let textView = getTextViewController(title: title, body: body)
2899-
textView.modalPresentationStyle = .fullScreen
2900-
DispatchQueue.main.asyncAfter(deadline: .now() + 0.25, execute: DispatchWorkItem(block: { [weak self] in
2901-
self?.navigationController?.present(textView, animated: false)
2902-
}))
2889+
let textViewController = getTextViewController(title: title, body: body)
2890+
let nav = NENavigationController(rootViewController: textViewController)
2891+
nav.modalPresentationStyle = .fullScreen
2892+
present(nav, animated: false)
29032893
}
29042894

29052895
/// 单击消息
@@ -2925,7 +2915,7 @@ open class ChatViewController: NEChatBaseViewController, UINavigationControllerD
29252915
didTapLocationMessage(model)
29262916
case .rtcCallRecord:
29272917
didTapCallMessage(model)
2928-
case .custom:
2918+
case .richText, .multiForward, .custom:
29292919
didTapCustomMessage(model, replyIndex)
29302920
default:
29312921
print(#function + "message did tap, type:\(String(describing: model?.type.rawValue))")
@@ -3776,6 +3766,28 @@ extension ChatViewController: ChatBaseCellDelegate {
37763766
viewModel.regenAIMessage(message)
37773767
}
37783768

3769+
public func didTapDetectedLink(_ cell: UITableViewCell, _ model: MessageContentModel?, _ url: URL) {
3770+
if url.scheme == "mailto" {
3771+
// 处理邮箱
3772+
didTapMailto(url)
3773+
} else if url.scheme == "tel" {
3774+
// 处理电话号码
3775+
didTapTel(url)
3776+
} else {
3777+
// 处理网页链接
3778+
let ctrl = NEWKWebViewController(url: url.absoluteString, title: url.absoluteString)
3779+
navigationController?.pushViewController(ctrl, animated: true)
3780+
}
3781+
}
3782+
3783+
open func didTapTel(_ url: URL) {
3784+
showBottomTelAction(url)
3785+
}
3786+
3787+
open func didTapMailto(_ url: URL) {
3788+
showBottomMailAction(url)
3789+
}
3790+
37793791
open func getReadView(_ message: V2NIMMessage, _ teamId: String) -> NEBaseReadViewController {
37803792
ReadViewController(message: message, teamId: teamId)
37813793
}

NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/MultiForwardViewController.swift

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,28 @@ open class MultiForwardViewController: NEChatBaseViewController, UINavigationCon
359359
}
360360
}
361361

362+
public func didTapDetectedLink(_ cell: UITableViewCell, _ model: MessageContentModel?, _ url: URL) {
363+
if url.scheme == "mailto" {
364+
// 处理邮箱
365+
didTapMailto(url)
366+
} else if url.scheme == "tel" {
367+
// 处理电话号码
368+
didTapTel(url)
369+
} else {
370+
// 处理网页链接
371+
let ctrl = NEWKWebViewController(url: url.absoluteString, title: url.absoluteString)
372+
navigationController?.pushViewController(ctrl, animated: true)
373+
}
374+
}
375+
376+
open func didTapTel(_ url: URL) {
377+
showBottomTelAction(url)
378+
}
379+
380+
open func didTapMailto(_ url: URL) {
381+
showBottomMailAction(url)
382+
}
383+
362384
// MARK: ChatBaseCellDelegate ignore protocol
363385

364386
open func didTapAvatarView(_ cell: UITableViewCell, _ model: MessageContentModel?) {}

NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBaseCollectionMessageController.swift

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,6 @@ open class NEBaseCollectionMessageController: NEChatBaseViewController, UITableV
521521

522522
if customType == customRichTextType {
523523
showTextViewController(model)
524-
525524
} else if customType == customMultiForwardType,
526525
let data = NECustomUtils.dataOfCustomMessage(message.attachment) {
527526
let url = data["url"] as? String
@@ -568,6 +567,36 @@ open class NEBaseCollectionMessageController: NEChatBaseViewController, UITableV
568567
}
569568
}
570569

570+
public func didTapDetectedLink(_ model: CollectionMessageModel?, _ cell: NEBaseCollectionMessageCell, _ url: URL?) {
571+
if let url = url {
572+
if url.scheme == "mailto" {
573+
// 处理邮箱
574+
didTapMailto(url)
575+
} else if url.scheme == "tel" {
576+
// 处理电话号码
577+
didTapTel(url)
578+
} else {
579+
// 处理网页链接
580+
let ctrl = NEWKWebViewController(url: url.absoluteString, title: url.absoluteString)
581+
navigationController?.pushViewController(ctrl, animated: true)
582+
}
583+
} else {
584+
if model?.message?.messageType == .MESSAGE_TYPE_TEXT {
585+
showTextViewController(model)
586+
} else if model?.message?.messageType == .MESSAGE_TYPE_CUSTOM {
587+
showTextView(model)
588+
}
589+
}
590+
}
591+
592+
open func didTapTel(_ url: URL) {
593+
showBottomTelAction(url)
594+
}
595+
596+
open func didTapMailto(_ url: URL) {
597+
showBottomMailAction(url)
598+
}
599+
571600
/// 开始播放
572601
/// - Parameter cell: 收藏列表视图对象
573602
/// - Parameter model: 收藏对象
@@ -688,16 +717,15 @@ open class NEBaseCollectionMessageController: NEChatBaseViewController, UITableV
688717

689718
let title = NECustomUtils.titleOfRichText(model.message?.attachment)
690719
let body = model.attributeStr
691-
let textView = getTextViewController(title: title, body: body)
692-
textView.modalPresentationStyle = .fullScreen
693-
DispatchQueue.main.asyncAfter(deadline: .now() + 0.25, execute: DispatchWorkItem(block: { [weak self] in
694-
self?.navigationController?.present(textView, animated: false)
695-
}))
720+
let textViewController = getTextViewController(title: title, body: body)
721+
let nav = NENavigationController(rootViewController: textViewController)
722+
nav.modalPresentationStyle = .fullScreen
723+
present(nav, animated: false)
696724
}
697725

698726
func getTextViewController(title: String?, body: NSAttributedString?) -> TextViewController {
699727
let textViewController = TextViewController(title: title, body: body)
700-
textViewController.view.backgroundColor = .white
728+
textViewController.updateLinkDetection()
701729
return textViewController
702730
}
703731

NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBasePinMessageViewController.swift

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,36 @@ open class NEBasePinMessageViewController: NEChatBaseViewController, UITableView
579579
}
580580
}
581581

582+
public func didTapDetectedLink(_ model: NEPinMessageModel?, _ cell: NEBasePinMessageCell, _ url: URL?) {
583+
if let url = url {
584+
if url.scheme == "mailto" {
585+
// 处理邮箱
586+
didTapMailto(url)
587+
} else if url.scheme == "tel" {
588+
// 处理电话号码
589+
didTapTel(url)
590+
} else {
591+
// 处理网页链接
592+
let ctrl = NEWKWebViewController(url: url.absoluteString, title: url.absoluteString)
593+
navigationController?.pushViewController(ctrl, animated: true)
594+
}
595+
} else {
596+
if model?.message.messageType == .MESSAGE_TYPE_TEXT {
597+
showTextViewController(model)
598+
} else if model?.message.messageType == .MESSAGE_TYPE_CUSTOM {
599+
toTextViewShow(model)
600+
}
601+
}
602+
}
603+
604+
open func didTapTel(_ url: URL) {
605+
showBottomTelAction(url)
606+
}
607+
608+
open func didTapMailto(_ url: URL) {
609+
showBottomMailAction(url)
610+
}
611+
582612
/// 点击开始播放
583613
/// - Parameter cell: 标记列表视图对象
584614
/// - Parameter model: 标记对象
@@ -694,16 +724,15 @@ open class NEBasePinMessageViewController: NEChatBaseViewController, UITableView
694724

695725
let title = NECustomUtils.titleOfRichText(model.message?.attachment)
696726
let body = model.attributeStr
697-
let textView = getTextViewController(title: title, body: body)
698-
textView.modalPresentationStyle = .fullScreen
699-
DispatchQueue.main.asyncAfter(deadline: .now() + 0.25, execute: DispatchWorkItem(block: { [weak self] in
700-
self?.navigationController?.present(textView, animated: false)
701-
}))
727+
let textViewController = getTextViewController(title: title, body: body)
728+
let nav = NENavigationController(rootViewController: textViewController)
729+
nav.modalPresentationStyle = .fullScreen
730+
present(nav, animated: false)
702731
}
703732

704733
func getTextViewController(title: String?, body: NSAttributedString?) -> TextViewController {
705734
let textViewController = TextViewController(title: title, body: body)
706-
textViewController.view.backgroundColor = .white
735+
textViewController.updateLinkDetection()
707736
return textViewController
708737
}
709738

0 commit comments

Comments
 (0)