diff --git a/IMUIKitOC/IMUIKitOCExample/Podfile b/IMUIKitOC/IMUIKitOCExample/Podfile index 34ea1d8f..f7e12ced 100644 --- a/IMUIKitOC/IMUIKitOCExample/Podfile +++ b/IMUIKitOC/IMUIKitOCExample/Podfile @@ -1,73 +1,57 @@ # Uncomment the next line to define a global platform for your project -# platform :ios, '9.0' - -# 引入配置文件 -require_relative "../../../PodConfigs/config_third.rb" -require_relative "../../../PodConfigs/config_local_common.rb" -require_relative "../../../PodConfigs/config_local_core.rb" -require_relative "../../../PodConfigs/config_local_im.rb" -require_relative "../../../PodConfigs/config_local_room.rb" -require_relative "../../../PodConfigs/config_local_social.rb" - -platform :ios, '12.0' + platform :ios, '12.0' source 'https://github.com/CocoaPods/Specs.git' -# XKit工程的podspec引用采用源码的环境变量 -ENV["USE_SOURCE_FILES"] = "true" - target 'IMUIKitOCExample' do # Comment the next line if you don't want to use dynamic frameworks use_frameworks! + #登录组件 pod 'YXLogin', '1.1.0' - #可选UI库 -# pod 'NEContactUIKit', '9.6.5' -# pod 'NEQChatUIKit', '9.6.5' -# pod 'NEConversationUIKit', '9.6.5' -# pod 'NEChatUIKit', '9.6.5' -# pod 'NETeamUIKit', '9.6.5' - + # 基础库 + pod 'NEChatKit', '10.5.1' - #可选Kit库(和UIKit对应) -# pod 'NEChatKit', '9.6.5' + # UI 组件,依次为通讯录组件、会话列表组件、会话(聊天)组件、群相关设置组件 + pod 'NEChatUIKit', '10.5.1' + pod 'NEContactUIKit', '10.5.1' + pod 'NEConversationUIKit', '10.5.1' + pod 'NETeamUIKit', '10.5.1' - - #基础kit库 -# pod 'NECommonUIKit', '9.6.5' -# pod 'NECommonKit', '9.6.5' -# pod 'NECoreIMKit', '9.6.5' -# pod 'NECoreKit', '9.6.5' -# pod 'NEMapKit', '9.6.5' + # 扩展库 - 地理位置组件 + pod 'NEMapKit', '10.5.1' - pod NIMSDK.name, NIMSDK.version2 + # 扩展库 - AI 划词搜索 + pod 'NEAISearchKit', '1.0.4' - pod 'NECoreKit', :path => '../../../CoreKit/NECoreKit/NECoreKit.podspec' - pod 'NECoreIM2Kit', :path => '../../../CoreKit/NECoreIM2Kit/NECoreIM2Kit.podspec' - pod 'NECommonKit', :path => '../../../Common/NECommonKit/NECommonKit.podspec' - pod 'NECommonUIKit', :path => '../../../Common/NECommonUIKit/NECommonUIKit.podspec' - pod 'NEChatKit', :path => '../../NEChatKit/NEChatKit.podspec' - pod 'NEChatUIKit', :path => '../../NEChatUIKit/NEChatUIKit.podspec' - pod 'NEContactUIKit', :path => '../../NEContactUIKit/NEContactUIKit.podspec' - pod 'NEConversationUIKit', :path => '../../NEConversationUIKit/NEConversationUIKit.podspec' - pod 'NETeamUIKit', :path => '../../NETeamUIKit/NETeamUIKit.podspec' - pod 'NEMapKit', :path => '../../NEMapKit/NEMapKit.podspec' + # 扩展库 - 呼叫组件 + pod 'NERtcCallKit/NOS_Special', '3.1.0' + pod 'NERtcCallUIKit/NOS_Special', '3.1.0' + + # 扩展库,依次为 RTC 音视频基础组件、RTC 音视频神经网络组件(使用背景虚化功能需要集成)、RTC 音视频背景分割组件(使用背景虚化功能需要集成) + pod 'NERtcSDK/RtcBasic', '5.6.33' + pod 'NERtcSDK/Nenn' + pod 'NERtcSDK/Segment' - # 如果需要查看UI部分源码请注释掉以上在线依赖,打开下面的本地依赖 -# pod 'NEQChatUIKit', :path => '../NEQChatUIKit/NEQChatUIKit.podspec' -# pod 'NEContactUIKit', :path => '../NEContactUIKit/NEContactUIKit.podspec' -# pod 'NEConversationUIKit', :path => '../NEConversationUIKit/NEConversationUIKit.podspec' -# pod 'NETeamUIKit', :path => '../NETeamUIKit/NETeamUIKit.podspec' -# pod 'NEChatUIKit', :path => '../NEChatUIKit/NEChatUIKit.podspec' +# pod 'NEContactUIKit', :path => 'NEContactUIKit/NEContactUIKit.podspec' +# pod 'NEConversationUIKit', :path => 'NEConversationUIKit/NEConversationUIKit.podspec' +# pod 'NETeamUIKit', :path => 'NETeamUIKit/NETeamUIKit.podspec' +# pod 'NEChatUIKit', :path => 'NEChatUIKit/NEChatUIKit.podspec' +# pod 'NEMapKit', :path => 'NEMapKit/NEMapKit.podspec' +# pod 'NEAISearchKit', :path => 'NEAISearchKit/NEAISearchKit.podspec' +# pod 'NERtcCallUIKit', :path => 'NERtcCallUIKit/NERtcCallUIKit.podspec' + end +# ⚠️如果pod依赖报错,可打开以下注释 post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| - config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] = "12.0" + config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES' + config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0' end end end diff --git a/NEChatUIKit/NEChatUIKit.podspec b/NEChatUIKit/NEChatUIKit.podspec index 775b5380..1692aba6 100644 --- a/NEChatUIKit/NEChatUIKit.podspec +++ b/NEChatUIKit/NEChatUIKit.podspec @@ -16,7 +16,7 @@ Pod::Spec.new do |s| # s.name = 'NEChatUIKit' - s.version = '10.5.0' + s.version = '10.5.1' s.summary = 'Chat Module of IM.' # This description is used to generate tags and improve search results. @@ -43,7 +43,7 @@ TODO: Add long description of the pod here. s.resource = 'NEChatUIKit/Assets/**/*' s.dependency 'NEChatKit' - s.dependency 'NECommonUIKit', '9.7.4' + s.dependency 'NECommonUIKit' s.dependency 'MJRefresh' s.dependency 'SDWebImageWebPCoder' s.dependency 'SDWebImageSVGKitPlugin' diff --git a/NEChatUIKit/NEChatUIKit/Assets/en.lproj/Localizable.strings b/NEChatUIKit/NEChatUIKit/Assets/en.lproj/Localizable.strings index 6ec03a04..e1bd5d77 100644 --- a/NEChatUIKit/NEChatUIKit/Assets/en.lproj/Localizable.strings +++ b/NEChatUIKit/NEChatUIKit/Assets/en.lproj/Localizable.strings @@ -65,7 +65,7 @@ "team_all_mute"="Mute everyone"; "team_all_no_mute"="Unmute all"; -"pin_text"="Pinned by "; +"pin_text"="Pinned by %@"; "top_message"="Top Message"; "untop_message"="Untop Message"; diff --git a/NEChatUIKit/NEChatUIKit/Assets/zh-Hans.lproj/Localizable.strings b/NEChatUIKit/NEChatUIKit/Assets/zh-Hans.lproj/Localizable.strings index 555a52c1..06e67ebd 100644 --- a/NEChatUIKit/NEChatUIKit/Assets/zh-Hans.lproj/Localizable.strings +++ b/NEChatUIKit/NEChatUIKit/Assets/zh-Hans.lproj/Localizable.strings @@ -63,7 +63,7 @@ "team_mute"="当前群主设置为禁言"; "team_all_mute"="群禁言已开启"; "team_all_no_mute"="群禁言已关闭"; -"pin_text"="标记了这条信息"; +"pin_text"="%@标记了这条信息"; "top_message"="置顶了一条消息"; "untop_message"="移除了置顶消息"; "chat_setting"="聊天设置"; diff --git a/NEChatUIKit/NEChatUIKit/Classes/Base/BaseView/ChatCenterTextCell.swift b/NEChatUIKit/NEChatUIKit/Classes/Base/BaseView/ChatCenterTextCell.swift index 6da85cc3..52d64003 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Base/BaseView/ChatCenterTextCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Base/BaseView/ChatCenterTextCell.swift @@ -9,7 +9,7 @@ import UIKit open class ChatCenterTextCell: ChatCornerCell { public var titleLabel: UILabel = .init() public var line = UIView() - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) titleLabel.font = UIFont.systemFont(ofSize: 16) diff --git a/NEChatUIKit/NEChatUIKit/Classes/Base/BaseView/ChatHeaderView.swift b/NEChatUIKit/NEChatUIKit/Classes/Base/BaseView/ChatHeaderView.swift index 10b02a91..d781e2d3 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Base/BaseView/ChatHeaderView.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Base/BaseView/ChatHeaderView.swift @@ -15,7 +15,7 @@ open class ChatHeaderView: UIView { return label }() - override init(frame: CGRect) { + override public init(frame: CGRect) { super.init(frame: frame) setupUI() } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Base/BaseView/ChatSectionView.swift b/NEChatUIKit/NEChatUIKit/Classes/Base/BaseView/ChatSectionView.swift index 5ac4eac6..c0994bb1 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Base/BaseView/ChatSectionView.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Base/BaseView/ChatSectionView.swift @@ -8,7 +8,7 @@ import UIKit @objcMembers open class ChatSectionView: UITableViewHeaderFooterView { public var titleLabel = UILabel() - override init(reuseIdentifier: String?) { + override public init(reuseIdentifier: String?) { super.init(reuseIdentifier: reuseIdentifier) commonUI() } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Base/BaseView/ChatStateCell.swift b/NEChatUIKit/NEChatUIKit/Classes/Base/BaseView/ChatStateCell.swift index 60ae2245..825f0115 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Base/BaseView/ChatStateCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Base/BaseView/ChatStateCell.swift @@ -34,7 +34,7 @@ open class ChatStateCell: ChatCornerCell { } } - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) setupUI() } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Base/BaseView/ChatTextArrowCell.swift b/NEChatUIKit/NEChatUIKit/Classes/Base/BaseView/ChatTextArrowCell.swift index d76003c2..23d26d58 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Base/BaseView/ChatTextArrowCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Base/BaseView/ChatTextArrowCell.swift @@ -7,7 +7,7 @@ import UIKit @objcMembers open class ChatTextArrowCell: ChatTextCell { - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) rightStyle = .indicate } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Base/BaseView/ChatTextCell.swift b/NEChatUIKit/NEChatUIKit/Classes/Base/BaseView/ChatTextCell.swift index f602321b..79e5680c 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Base/BaseView/ChatTextCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Base/BaseView/ChatTextCell.swift @@ -15,7 +15,7 @@ open class ChatTextCell: ChatStateCell { var detailRightMargin: NSLayoutConstraint? - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Base/BaseView/ChatUnfoldCell.swift b/NEChatUIKit/NEChatUIKit/Classes/Base/BaseView/ChatUnfoldCell.swift index 39dfcac2..84e84480 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Base/BaseView/ChatUnfoldCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Base/BaseView/ChatUnfoldCell.swift @@ -22,7 +22,7 @@ open class ChatUnfoldCell: ChatCornerCell { return label }() - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) setupUI() } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Base/BaseViewController/ChatTableViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/Base/BaseViewController/ChatTableViewController.swift deleted file mode 100644 index 4bfcb77a..00000000 --- a/NEChatUIKit/NEChatUIKit/Classes/Base/BaseViewController/ChatTableViewController.swift +++ /dev/null @@ -1,68 +0,0 @@ - -// Copyright (c) 2022 NetEase, Inc. All rights reserved. -// Use of this source code is governed by a MIT license that can be -// found in the LICENSE file. - -import NECoreKit -import UIKit - -@objcMembers -open class ChatTableViewController: NEBaseViewController, UITableViewDelegate, - UITableViewDataSource { - public var tableView: UITableView = .init(frame: .zero, style: .grouped) - public var topConstraint: NSLayoutConstraint? - public var bottomConstraint: NSLayoutConstraint? - - override open func viewDidLoad() { - super.viewDidLoad() - tableView.separatorStyle = .none - tableView.delegate = self - tableView.dataSource = self - tableView.translatesAutoresizingMaskIntoConstraints = false - view.addSubview(tableView) - NSLayoutConstraint.activate([ - tableView.leftAnchor.constraint(equalTo: view.leftAnchor), - tableView.rightAnchor.constraint(equalTo: view.rightAnchor), - ]) - - if #available(iOS 11.0, *) { - self.topConstraint = self.tableView.topAnchor.constraint( - equalTo: self.view.safeAreaLayoutGuide.topAnchor, - constant: 0 - ) - self.bottomConstraint = self.tableView.bottomAnchor - .constraint(equalTo: self.view.safeAreaLayoutGuide.bottomAnchor) - - } else { - // Fallback on earlier versions - topConstraint = tableView.topAnchor.constraint(equalTo: view.topAnchor) - bottomConstraint = tableView.bottomAnchor.constraint(equalTo: view.bottomAnchor) - } - topConstraint?.isActive = true - bottomConstraint?.isActive = true - - tableView.sectionHeaderHeight = 38 - tableView.sectionFooterHeight = 0 - tableView.rowHeight = 62 - tableView.tableHeaderView = UIView(frame: CGRect(x: 0, y: 0, width: 0, height: 0.1)) - } - - open func tableView(_ tableView: UITableView, - cellForRowAt indexPath: IndexPath) -> UITableViewCell { - tableView.dequeueReusableCell(withIdentifier: "UITableViewCell", for: indexPath) - } - - open func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - 0 - } - - /* - // MARK: - Navigation - - // In a storyboard-based application, you will often want to do a little preparation before navigation - override func prepare(for segue: UIStoryboardSegue, sender: Any?) { - // Get the new view controller using segue.destination. - // Pass the selected object to the new view controller. - } - */ -} diff --git a/NEChatUIKit/NEChatUIKit/Classes/Base/NEChatLoaderService.swift b/NEChatUIKit/NEChatUIKit/Classes/Base/NEChatLoaderService.swift index 6a995798..8fff1533 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Base/NEChatLoaderService.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Base/NEChatLoaderService.swift @@ -15,7 +15,7 @@ public class NEChatLoaderService: NSObject { /// 初始化方法 /// 此方法会在模块被加载时调用 - public func setupInit() { + open func setupInit() { ChatKitClient.shared.registerInit(NEChatService.shared) } } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Base/NEChatService.swift b/NEChatUIKit/NEChatUIKit/Classes/Base/NEChatService.swift index 517a3b25..8baf2ff5 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Base/NEChatService.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Base/NEChatService.swift @@ -19,13 +19,13 @@ public class NEChatService: NSObject, ChatServiceDelegate, NEChatEmojProtocol { /// 注册 NEChatUIKit 初始化协议 /// - Parameter params: 初始化参数 - public func setupInit(_ params: [String: Any]?) { + open func setupInit(_ params: [String: Any]?) { registerRouter(params) } /// 注册路由 /// - Parameter param: 参数 - public func registerRouter(_ param: [String: Any]?) { + open func registerRouter(_ param: [String: Any]?) { if let isFun = param?["isFun"] as? Bool, isFun { ChatRouter.registerFun() } else { @@ -42,7 +42,7 @@ public class NEChatService: NSObject, ChatServiceDelegate, NEChatEmojProtocol { NEChatKitClient.instance.addEmojDelegate(self) } - public func getEmojAttributeString(_ content: String, _ font: CGFloat) -> NSAttributedString? { + open func getEmojAttributeString(_ content: String, _ font: CGFloat) -> NSAttributedString? { let attributeStr = NEEmotionTool.getAttWithStr( str: content, font: UIFont.systemFont(ofSize: font) diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/ChatViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/ChatViewController.swift index 7009ac9f..a0aee871 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/ChatViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/ChatViewController.swift @@ -180,12 +180,10 @@ open class ChatViewController: NEChatBaseViewController, UINavigationControllerD refreshingAction: #selector(loadMoreData) ) tableView.keyboardDismissMode = .onDrag + tableView.estimatedRowHeight = 0 + tableView.estimatedSectionHeaderHeight = 0 + tableView.estimatedSectionFooterHeight = 0 - if #available(iOS 11.0, *) { - tableView.estimatedRowHeight = 0 - tableView.estimatedSectionHeaderHeight = 0 - tableView.estimatedSectionFooterHeight = 0 - } if #available(iOS 15.0, *) { tableView.sectionHeaderTopPadding = 0.0 } @@ -1423,8 +1421,7 @@ open class ChatViewController: NEChatBaseViewController, UINavigationControllerD present(imagePickerVC, animated: true) } - open func sendMediaMessage(didFinishPickingMediaWithInfo info: [UIImagePickerController - .InfoKey: Any]) { + open func sendMediaMessage(_ info: [UIImagePickerController.InfoKey: Any]) { var imageName = "IMG_0001" var imageWidth: Int32 = 0 var imageHeight: Int32 = 0 @@ -1432,22 +1429,23 @@ open class ChatViewController: NEChatBaseViewController, UINavigationControllerD // 获取展示名称 if isFile == true, - let imgUrl = info[.referenceURL] as? URL { - let fetchRes = PHAsset.fetchAssets(withALAssetURLs: [imgUrl], options: nil) - let asset = fetchRes.firstObject - if let fileName = asset?.value(forKey: "filename") as? String { + let asset = info[.phAsset] as? PHAsset { + if let fileName = asset.value(forKey: "filename") as? String { imageName = fileName } + } else if let url = info[.imageURL] as? URL { + imageName = url.lastPathComponent + } else if let url = info[.mediaURL] as? URL { + imageName = url.lastPathComponent + } else if let url = info[.referenceURL] as? URL { + imageName = url.lastPathComponent } // 获取图片宽高、视频时长 - // phAsset 不一定有 - if #available(iOS 11.0, *) { - if let phAsset = info[.phAsset] as? PHAsset { - imageWidth = Int32(phAsset.pixelWidth) - imageHeight = Int32(phAsset.pixelHeight) - videoDuration = Int32(phAsset.duration * 1000) - } + if let phAsset = info[.phAsset] as? PHAsset { + imageWidth = Int32(phAsset.pixelWidth) + imageHeight = Int32(phAsset.pixelHeight) + videoDuration = Int32(phAsset.duration * 1000) } // video @@ -1467,131 +1465,79 @@ open class ChatViewController: NEChatBaseViewController, UINavigationControllerD imageHeight = Int32(abs(correctedSize.height)) } - weak var weakSelf = self - if isFile == true { - copyFileToSend(url: videoUrl, displayName: imageName) - } else { - viewModel.sendVideoMessage(url: videoUrl, - name: imageName, - width: imageWidth, - height: imageHeight, - duration: videoDuration) { [weak self] message, error, progress in - NEALog.infoLog( - ModuleName + " " + ChatViewController.className(), - desc: #function + "CALLBACK sendVideoMessage " + (error?.localizedDescription ?? "no error") - ) - weakSelf?.showErrorToast(error) - - if progress > 0, progress <= 100 { - self?.setModelProgress(message, progress) - } - } - } + copyFileToSend(url: videoUrl, + displayName: imageName, + isFile: isFile ?? true, + width: imageWidth, + height: imageHeight, + duration: videoDuration) return } - if #available(iOS 11.0, *) { - var imageUrl = info[.imageURL] as? URL - var image = info[.originalImage] as? UIImage - image = image?.fixOrientation() + var imageUrl = info[.imageURL] as? URL + var image = (info[.originalImage] as? UIImage) + image = image?.fixOrientation() - // 获取图片宽度 - if let width = image?.size.width { - imageWidth = Int32(width) - } + // 获取图片宽度 + if let width = image?.size.width { + imageWidth = Int32(width) + } - // 获取图片高度度 - if let height = image?.size.height { - imageHeight = Int32(height) - } + // 获取图片高度度 + if let height = image?.size.height { + imageHeight = Int32(height) + } - let pngImage = image?.pngData() - var needDelete = false + let pngImage = image?.pngData() + var needDelete = false - // 无url则临时保存到本地,发送成功后删除临时文件 - if imageUrl == nil { - if let data = pngImage, let path = NEPathUtils.getDirectoryForDocuments(dir: "\(imkitDir)image/") { - let url = URL(fileURLWithPath: path + "\(imageName).png") - do { - try data.write(to: url) - imageUrl = url - needDelete = true - } catch { - showToast(chatLocalizable("image_is_nil")) - } + // 无url则临时保存到本地,发送成功后删除临时文件 + if imageUrl == nil { + if let data = pngImage, let path = NEPathUtils.getDirectoryForDocuments(dir: "\(imkitDir)image/") { + let url = URL(fileURLWithPath: path + "\(imageName).png") + do { + try data.write(to: url) + imageUrl = url + needDelete = true + } catch { + showToast(commonLocalizable("failed_operation")) } } + } - guard let imageUrl = imageUrl else { - showToast(chatLocalizable("image_is_nil")) - return - } + guard let imageUrl = imageUrl else { + showToast(commonLocalizable("failed_operation")) + return + } - let imgSize_MB = Double(pngImage?.count ?? 0) / 1e6 - NEALog.infoLog(ModuleName + " " + ChatViewController.className(), desc: #function + "imgSize_MB: \(imgSize_MB) MB") - if imgSize_MB > ChatUIConfig.shared.fileSizeLimit { - showToast(String(format: chatLocalizable("fileSize_over_limit"), "\(ChatUIConfig.shared.fileSizeLimit)")) - } else { - if isFile == true { - viewModel.sendFileMessage(filePath: imageUrl.relativePath, - displayName: imageName) { [weak self] message, error, progress in - NEALog.infoLog( - ModuleName + " " + ChatViewController.className(), - desc: #function + "CALLBACK sendFileMessage" + (error?.localizedDescription ?? "no error") - ) - self?.showErrorToast(error) + let imgSize_MB = Double(pngImage?.count ?? 0) / 1e6 + NEALog.infoLog(ModuleName + " " + ChatViewController.className(), desc: #function + "imgSize_MB: \(imgSize_MB) MB") + if imgSize_MB > ChatUIConfig.shared.fileSizeLimit { + showToast(String(format: chatLocalizable("fileSize_over_limit"), "\(ChatUIConfig.shared.fileSizeLimit)")) + } else { + if isFile == true { + viewModel.sendFileMessage(filePath: imageUrl.relativePath, + displayName: imageName) { [weak self] message, error, progress in + NEALog.infoLog( + ModuleName + " " + ChatViewController.className(), + desc: #function + "CALLBACK sendFileMessage" + (error?.localizedDescription ?? "no error") + ) + self?.showErrorToast(error) - if progress > 0, progress <= 100 { - self?.setModelProgress(message, progress) - } - } - } else { - if let url = info[.referenceURL] as? URL { - if url.absoluteString.hasSuffix("ext=GIF") == true { - // GIF 需要特殊处理 - let imageAsset = info[UIImagePickerController.InfoKey.phAsset] as? PHAsset - let options = PHImageRequestOptions() - options.version = .current - guard let asset = imageAsset else { - return - } - weak var weakSelf = self - PHImageManager.default().requestImageData(for: asset, options: options) { imageData, dataUTI, orientation, info in - if let data = imageData { - let tempDirectoryURL = FileManager.default.temporaryDirectory - let uniqueString = UUID().uuidString - let temUrl = tempDirectoryURL.appendingPathComponent(uniqueString + ".gif") - print("tem url path : ", temUrl.path) - do { - try data.write(to: temUrl) - DispatchQueue.main.async { - weakSelf?.viewModel.sendImageMessage(path: temUrl.path, name: imageName, width: imageWidth, height: imageHeight) { error in - NEALog.infoLog( - ModuleName + " " + ChatViewController.className(), - desc: #function + "CALLBACK sendImageMessage " + (error?.localizedDescription ?? "no error") - ) - weakSelf?.showErrorToast(error) - } - } - } catch { - NEALog.infoLog(ModuleName, desc: #function + "write tem gif data error : \(error.localizedDescription)") - } - } - } - return - } + if progress > 0, progress <= 100 { + self?.setModelProgress(message, progress) } - - viewModel.sendImageMessage(path: imageUrl.relativePath, name: imageName, width: imageWidth, height: imageHeight) { [weak self] error in - NEALog.infoLog( - ModuleName + " " + ChatViewController.className(), - desc: #function + "CALLBACK sendImageMessage " + (error?.localizedDescription ?? "no error") - ) - self?.showErrorToast(error) - // 删除临时保存的图片 - if needDelete { - try? FileManager.default.removeItem(at: imageUrl) - } + } + } else { + viewModel.sendImageMessage(path: imageUrl.relativePath, name: imageName, width: imageWidth, height: imageHeight) { [weak self] error in + NEALog.infoLog( + ModuleName + " " + ChatViewController.className(), + desc: #function + "CALLBACK sendImageMessage " + (error?.localizedDescription ?? "no error") + ) + self?.showErrorToast(error) + // 删除临时保存的图片 + if needDelete { + try? FileManager.default.removeItem(at: imageUrl) } } } @@ -1605,7 +1551,7 @@ open class ChatViewController: NEChatBaseViewController, UINavigationControllerD .InfoKey: Any]) { weak var weakSelf = self picker.dismiss(animated: true, completion: { - weakSelf?.sendMediaMessage(didFinishPickingMediaWithInfo: info) + weakSelf?.sendMediaMessage(info) }) } @@ -1619,7 +1565,12 @@ open class ChatViewController: NEChatBaseViewController, UINavigationControllerD /// - Parameters: /// - url: 原始路径 /// - displayName: 显示名称 - func copyFileToSend(url: URL, displayName: String) { + func copyFileToSend(url: URL, + displayName: String, + isFile: Bool = true, + width: Int32 = 0, + height: Int32 = 0, + duration: Int32 = 0) { let desPath = NSTemporaryDirectory() + "\(url.lastPathComponent)" let dirUrl = URL(fileURLWithPath: desPath) if !FileManager.default.fileExists(atPath: desPath) { @@ -1640,16 +1591,36 @@ open class ChatViewController: NEChatBaseViewController, UINavigationControllerD showToast(String(format: chatLocalizable("fileSize_over_limit"), "\(ChatUIConfig.shared.fileSizeLimit)")) try? FileManager.default.removeItem(atPath: desPath) } else { - viewModel.sendFileMessage(filePath: desPath, - displayName: displayName) { [weak self] message, error, progress in - NEALog.infoLog( - ModuleName + " " + ChatViewController.className(), - desc: #function + "CALLBACK sendFileMessage " + (error?.localizedDescription ?? "no error") - ) - self?.showErrorToast(error) - - if progress > 0, progress <= 100 { - self?.setModelProgress(message, progress) + weak var weakSelf = self + if isFile == true { + viewModel.sendFileMessage(filePath: desPath, + displayName: displayName) { [weak self] message, error, progress in + NEALog.infoLog( + ModuleName + " " + ChatViewController.className(), + desc: #function + "CALLBACK sendFileMessage " + (error?.localizedDescription ?? "no error") + ) + self?.showErrorToast(error) + + if progress > 0, progress <= 100 { + self?.setModelProgress(message, progress) + } + } + } else { + guard let desPath = URL(string: desPath) else { return } + viewModel.sendVideoMessage(url: desPath, + name: displayName, + width: width, + height: height, + duration: duration) { [weak self] message, error, progress in + NEALog.infoLog( + ModuleName + " " + ChatViewController.className(), + desc: #function + "CALLBACK sendVideoMessage " + (error?.localizedDescription ?? "no error") + ) + weakSelf?.showErrorToast(error) + + if progress > 0, progress <= 100 { + self?.setModelProgress(message, progress) + } } } } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/MultiForwardViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/MultiForwardViewController.swift index 61ca6c53..8132fa1f 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/MultiForwardViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/MultiForwardViewController.swift @@ -34,11 +34,10 @@ open class MultiForwardViewController: NEChatBaseViewController, UINavigationCon tableView.backgroundColor = .clear tableView.keyboardDismissMode = .onDrag - if #available(iOS 11.0, *) { - tableView.estimatedRowHeight = 0 - tableView.estimatedSectionHeaderHeight = 0 - tableView.estimatedSectionFooterHeight = 0 - } + tableView.estimatedRowHeight = 0 + tableView.estimatedSectionHeaderHeight = 0 + tableView.estimatedSectionFooterHeight = 0 + if #available(iOS 15.0, *) { tableView.sectionHeaderTopPadding = 0.0 } @@ -102,21 +101,12 @@ open class MultiForwardViewController: NEChatBaseViewController, UINavigationCon } view.addSubview(tableView) - if #available(iOS 11.0, *) { - NSLayoutConstraint.activate([ - tableView.topAnchor.constraint(equalTo: view.topAnchor, constant: topConstant), - tableView.leftAnchor.constraint(equalTo: view.leftAnchor), - tableView.rightAnchor.constraint(equalTo: view.rightAnchor), - tableView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor), - ]) - } else { - NSLayoutConstraint.activate([ - tableView.topAnchor.constraint(equalTo: view.topAnchor, constant: topConstant), - tableView.leftAnchor.constraint(equalTo: view.leftAnchor), - tableView.rightAnchor.constraint(equalTo: view.rightAnchor), - tableView.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: -34), - ]) - } + NSLayoutConstraint.activate([ + tableView.topAnchor.constraint(equalTo: view.topAnchor, constant: topConstant), + tableView.leftAnchor.constraint(equalTo: view.leftAnchor), + tableView.rightAnchor.constraint(equalTo: view.rightAnchor), + tableView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor), + ]) view.addSubview(brokenNetworkView) NSLayoutConstraint.activate([ @@ -370,17 +360,17 @@ open class MultiForwardViewController: NEChatBaseViewController, UINavigationCon // MARK: ChatBaseCellDelegate ignore protocol - public func didTapAvatarView(_ cell: UITableViewCell, _ model: MessageContentModel?) {} + open func didTapAvatarView(_ cell: UITableViewCell, _ model: MessageContentModel?) {} - public func didLongPressAvatar(_ cell: UITableViewCell, _ model: MessageContentModel?) {} + open func didLongPressAvatar(_ cell: UITableViewCell, _ model: MessageContentModel?) {} - public func didLongPressMessageView(_ cell: UITableViewCell, _ model: MessageContentModel?) {} + open func didLongPressMessageView(_ cell: UITableViewCell, _ model: MessageContentModel?) {} - public func didTapResendView(_ cell: UITableViewCell, _ model: MessageContentModel?) {} + open func didTapResendView(_ cell: UITableViewCell, _ model: MessageContentModel?) {} - public func didTapReeditButton(_ cell: UITableViewCell, _ model: MessageContentModel?) {} + open func didTapReeditButton(_ cell: UITableViewCell, _ model: MessageContentModel?) {} - public func didTapReadView(_ cell: UITableViewCell, _ model: MessageContentModel?) {} + open func didTapReadView(_ cell: UITableViewCell, _ model: MessageContentModel?) {} - public func didTapSelectButton(_ cell: UITableViewCell, _ model: MessageContentModel?) {} + open func didTapSelectButton(_ cell: UITableViewCell, _ model: MessageContentModel?) {} } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBaseCollectionMessageController.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBaseCollectionMessageController.swift index 957d1d91..9d09592e 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBaseCollectionMessageController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBaseCollectionMessageController.swift @@ -26,11 +26,10 @@ open class NEBaseCollectionMessageController: NEChatBaseViewController, UITableV tableView.mj_footer = MJRefreshAutoFooter(refreshingTarget: self, refreshingAction: #selector(loadMoreData)) tableView.keyboardDismissMode = .onDrag - if #available(iOS 11.0, *) { - tableView.estimatedRowHeight = 0 - tableView.estimatedSectionHeaderHeight = 0 - tableView.estimatedSectionFooterHeight = 0 - } + tableView.estimatedRowHeight = 0 + tableView.estimatedSectionHeaderHeight = 0 + tableView.estimatedSectionFooterHeight = 0 + if #available(iOS 15.0, *) { tableView.sectionHeaderTopPadding = 0.0 } @@ -145,11 +144,11 @@ open class NEBaseCollectionMessageController: NEChatBaseViewController, UITableV } } - public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + open func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { viewModel.collectionDatas.count } - public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + open func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { if indexPath.row >= viewModel.collectionDatas.count { return UITableViewCell() } @@ -400,7 +399,7 @@ open class NEBaseCollectionMessageController: NEChatBaseViewController, UITableV /// 跳转视频播放器 /// - Parameter model: 收藏对象 - public func showVideoView(_ model: CollectionMessageModel?) { + open func showVideoView(_ model: CollectionMessageModel?) { if let object = model?.message?.attachment as? V2NIMMessageVideoAttachment { stopPlay() let player = VideoPlayerViewController() @@ -421,7 +420,7 @@ open class NEBaseCollectionMessageController: NEChatBaseViewController, UITableV /// 跳转地图详情页 /// - Parameter model: 收藏对象 - public func showMapDetail(_ model: CollectionMessageModel?) { + open func showMapDetail(_ model: CollectionMessageModel?) { if let title = model?.message?.text, let locationObject = model?.message?.attachment as? V2NIMMessageLocationAttachment { let lng = locationObject.longitude @@ -450,7 +449,7 @@ open class NEBaseCollectionMessageController: NEChatBaseViewController, UITableV /// 跳转文件查看器 /// - Parameter model: 收藏对象 - public func showFileDetail(_ model: CollectionMessageModel?) { + open func showFileDetail(_ model: CollectionMessageModel?) { if let object = model?.message?.attachment as? V2NIMMessageFileAttachment { // 判断是否是文件对象 guard let fileModel = model?.fileModel as? CollectionFileModel else { @@ -726,12 +725,12 @@ open class NEBaseCollectionMessageController: NEChatBaseViewController, UITableV extension NEBaseCollectionMessageController: AVAudioPlayerDelegate { /// 声音播放完成回调 - public func audioPlayerDidFinishPlaying(_ player: AVAudioPlayer, successfully flag: Bool) { + open func audioPlayerDidFinishPlaying(_ player: AVAudioPlayer, successfully flag: Bool) { stopPlay() } /// 声音解码失败回调 - public func audioPlayerDecodeErrorDidOccur(_ player: AVAudioPlayer, error: (any Error)?) { + open func audioPlayerDecodeErrorDidOccur(_ player: AVAudioPlayer, error: (any Error)?) { stopPlay() } } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBaseForwardAlertViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBaseForwardAlertViewController.swift index fe270c3b..811da22f 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBaseForwardAlertViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBaseForwardAlertViewController.swift @@ -157,6 +157,7 @@ open class NEBaseForwardAlertViewController: UIViewController, UICollectionViewD textFeild.leftView = UIView(frame: CGRect(x: 0, y: 0, width: 12, height: 0)) textFeild.leftViewMode = .always textFeild.font = .systemFont(ofSize: 14) + textFeild.accessibilityIdentifier = "id.messageInput" return textFeild }() diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBasePinMessageViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBasePinMessageViewController.swift index 0b9f15b0..e04c2c47 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBasePinMessageViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBasePinMessageViewController.swift @@ -44,11 +44,10 @@ open class NEBasePinMessageViewController: NEChatBaseViewController, UITableView tableView.backgroundColor = .clear tableView.keyboardDismissMode = .onDrag - if #available(iOS 11.0, *) { - tableView.estimatedRowHeight = 0 - tableView.estimatedSectionHeaderHeight = 0 - tableView.estimatedSectionFooterHeight = 0 - } + tableView.estimatedRowHeight = 0 + tableView.estimatedSectionHeaderHeight = 0 + tableView.estimatedSectionFooterHeight = 0 + if #available(iOS 15.0, *) { tableView.sectionHeaderTopPadding = 0.0 } @@ -381,6 +380,7 @@ open class NEBasePinMessageViewController: NEChatBaseViewController, UITableView loadData() } tableView.reloadData() + emptyView.isHidden = viewModel.items.count > 0 } open func didClickMore(_ model: NEPinMessageModel?) { @@ -414,7 +414,7 @@ open class NEBasePinMessageViewController: NEChatBaseViewController, UITableView /// 跳转视频播放器 /// - Parameter model: 标记对象 - public func toVideoView(_ model: NEPinMessageModel?) { + open func toVideoView(_ model: NEPinMessageModel?) { if let object = model?.message.attachment as? V2NIMMessageVideoAttachment { stopPlay() let player = VideoPlayerViewController() @@ -435,7 +435,7 @@ open class NEBasePinMessageViewController: NEChatBaseViewController, UITableView /// 跳转地图详情页 /// - Parameter model: 标记对象 - public func toMapDetail(_ model: NEPinMessageModel?) { + open func toMapDetail(_ model: NEPinMessageModel?) { if let title = model?.message.text, let locationObject = model?.message.attachment as? V2NIMMessageLocationAttachment { let lng = locationObject.longitude @@ -464,7 +464,7 @@ open class NEBasePinMessageViewController: NEChatBaseViewController, UITableView /// 跳转文件查看器 /// - Parameter model: 标记对象 - public func toFileDetail(_ model: NEPinMessageModel?) { + open func toFileDetail(_ model: NEPinMessageModel?) { if let object = model?.message.attachment as? V2NIMMessageFileAttachment { // 判断是否是文件对象 guard let fileModel = model?.pinFileModel as? PinMessageFileModel else { @@ -724,7 +724,7 @@ open class NEBasePinMessageViewController: NEChatBaseViewController, UITableView // MARK: - NEIMKitClientListener - public func onConnectStatus(_ status: V2NIMConnectStatus) { + open func onConnectStatus(_ status: V2NIMConnectStatus) { if status == .CONNECT_STATUS_WAITING { networkBroken = true } @@ -743,12 +743,12 @@ open class NEBasePinMessageViewController: NEChatBaseViewController, UITableView extension NEBasePinMessageViewController: AVAudioPlayerDelegate { /// 声音播放完成回调 - public func audioPlayerDidFinishPlaying(_ player: AVAudioPlayer, successfully flag: Bool) { + open func audioPlayerDidFinishPlaying(_ player: AVAudioPlayer, successfully flag: Bool) { stopPlay() } /// 声音解码失败回调 - public func audioPlayerDecodeErrorDidOccur(_ player: AVAudioPlayer, error: (any Error)?) { + open func audioPlayerDecodeErrorDidOccur(_ player: AVAudioPlayer, error: (any Error)?) { stopPlay() } } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBaseReadViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBaseReadViewController.swift index bfc61466..5f6b0c97 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBaseReadViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBaseReadViewController.swift @@ -95,11 +95,10 @@ open class NEBaseReadViewController: NEChatBaseViewController, UITableViewDelega tableView.separatorStyle = .none tableView.keyboardDismissMode = .onDrag - if #available(iOS 11.0, *) { - tableView.estimatedRowHeight = 0 - tableView.estimatedSectionHeaderHeight = 0 - tableView.estimatedSectionFooterHeight = 0 - } + tableView.estimatedRowHeight = 0 + tableView.estimatedSectionHeaderHeight = 0 + tableView.estimatedSectionFooterHeight = 0 + if #available(iOS 15.0, *) { tableView.sectionHeaderTopPadding = 0.0 } @@ -118,11 +117,10 @@ open class NEBaseReadViewController: NEChatBaseViewController, UITableViewDelega tableView.isHidden = true tableView.keyboardDismissMode = .onDrag - if #available(iOS 11.0, *) { - tableView.estimatedRowHeight = 0 - tableView.estimatedSectionHeaderHeight = 0 - tableView.estimatedSectionFooterHeight = 0 - } + tableView.estimatedRowHeight = 0 + tableView.estimatedSectionHeaderHeight = 0 + tableView.estimatedSectionFooterHeight = 0 + if #available(iOS 15.0, *) { tableView.sectionHeaderTopPadding = 0.0 } @@ -142,7 +140,7 @@ open class NEBaseReadViewController: NEChatBaseViewController, UITableViewDelega return view }() - init(message: V2NIMMessage, teamId: String) { + public init(message: V2NIMMessage, teamId: String) { self.message = message self.teamId = teamId super.init(nibName: nil, bundle: nil) diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBaseSelectLanguageViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBaseSelectLanguageViewController.swift index 05c1bb80..992b31e3 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBaseSelectLanguageViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBaseSelectLanguageViewController.swift @@ -63,11 +63,10 @@ open class NEBaseSelectLanguageViewController: NEChatBaseViewController, UITable tableView.separatorStyle = .none tableView.keyboardDismissMode = .onDrag - if #available(iOS 11.0, *) { - tableView.estimatedRowHeight = 0 - tableView.estimatedSectionHeaderHeight = 0 - tableView.estimatedSectionFooterHeight = 0 - } + tableView.estimatedRowHeight = 0 + tableView.estimatedSectionHeaderHeight = 0 + tableView.estimatedSectionFooterHeight = 0 + if #available(iOS 15.0, *) { tableView.sectionHeaderTopPadding = 0.0 } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBaseSelectUserViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBaseSelectUserViewController.swift index 853092b4..774da8af 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBaseSelectUserViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBaseSelectUserViewController.swift @@ -24,7 +24,7 @@ open class NEBaseSelectUserViewController: NEChatBaseViewController, UITableView var className = "SelectUserViewController" var isShowAtAll = true - init(conversationId: String, showSelf: Bool = true, showTeamMembers: Bool = false) { + public init(conversationId: String, showSelf: Bool = true, showTeamMembers: Bool = false) { self.conversationId = conversationId self.showSelf = showSelf self.showTeamMembers = showTeamMembers @@ -55,22 +55,12 @@ open class NEBaseSelectUserViewController: NEChatBaseViewController, UITableView button.addTarget(self, action: #selector(btnEvent), for: .touchUpInside) view.addSubview(button) - if #available(iOS 11.0, *) { - NSLayoutConstraint.activate([ - button.leadingAnchor.constraint(equalTo: self.view.leadingAnchor, constant: 16), - button.topAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.topAnchor), - button.widthAnchor.constraint(equalToConstant: 50), - button.heightAnchor.constraint(equalToConstant: 50), - ]) - } else { - // Fallback on earlier versions - NSLayoutConstraint.activate([ - button.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 16), - button.topAnchor.constraint(equalTo: view.topAnchor), - button.widthAnchor.constraint(equalToConstant: 50), - button.heightAnchor.constraint(equalToConstant: 50), - ]) - } + NSLayoutConstraint.activate([ + button.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 16), + button.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor), + button.widthAnchor.constraint(equalToConstant: 50), + button.heightAnchor.constraint(equalToConstant: 50), + ]) let label = UILabel() label.translatesAutoresizingMaskIntoConstraints = false @@ -95,35 +85,22 @@ open class NEBaseSelectUserViewController: NEChatBaseViewController, UITableView tableView.separatorStyle = .none tableView.tableFooterView = UIView() tableView.keyboardDismissMode = .onDrag + tableView.estimatedRowHeight = 0 + tableView.estimatedSectionHeaderHeight = 0 + tableView.estimatedSectionFooterHeight = 0 - if #available(iOS 11.0, *) { - tableView.estimatedRowHeight = 0 - tableView.estimatedSectionHeaderHeight = 0 - tableView.estimatedSectionFooterHeight = 0 - } if #available(iOS 15.0, *) { tableView.sectionHeaderTopPadding = 0.0 } view.addSubview(tableView) - - if #available(iOS 11.0, *) { - NSLayoutConstraint.activate([ - tableView.leadingAnchor.constraint(equalTo: self.view.leadingAnchor), - tableView.topAnchor.constraint(equalTo: label.bottomAnchor), - tableView.trailingAnchor.constraint(equalTo: self.view.trailingAnchor), - tableView.bottomAnchor - .constraint(equalTo: self.view.safeAreaLayoutGuide.bottomAnchor), - ]) - } else { - // Fallback on earlier versions - NSLayoutConstraint.activate([ - tableView.leadingAnchor.constraint(equalTo: view.leadingAnchor), - tableView.topAnchor.constraint(equalTo: label.bottomAnchor, constant: 0), - tableView.trailingAnchor.constraint(equalTo: view.trailingAnchor), - tableView.bottomAnchor.constraint(equalTo: view.bottomAnchor), - ]) - } + NSLayoutConstraint.activate([ + tableView.leadingAnchor.constraint(equalTo: view.leadingAnchor), + tableView.topAnchor.constraint(equalTo: label.bottomAnchor), + tableView.trailingAnchor.constraint(equalTo: view.trailingAnchor), + tableView.bottomAnchor + .constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor), + ]) } func loadData() { diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/TextViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/TextViewController.swift index 6a48dd08..2e0ce11a 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/TextViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/TextViewController.swift @@ -65,7 +65,7 @@ open class TextViewController: NEChatBaseViewController { var contentLabelTopAnchor: NSLayoutConstraint? var contentLabelLeftAnchor: NSLayoutConstraint? - init(title: String?, body: NSAttributedString?) { + public init(title: String?, body: NSAttributedString?) { super.init(nibName: nil, bundle: nil) contentMaxWidth = kScreenWidth - leftRightMargin * 2 if let title = title { @@ -101,21 +101,12 @@ open class TextViewController: NEChatBaseViewController { open func setupUI() { view.addSubview(scrollView) - if #available(iOS 11.0, *) { - NSLayoutConstraint.activate([ - scrollView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 20), - scrollView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -20), - scrollView.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 0), - scrollView.rightAnchor.constraint(equalTo: view.rightAnchor, constant: -0), - ]) - } else { - NSLayoutConstraint.activate([ - scrollView.topAnchor.constraint(equalTo: view.topAnchor, constant: 20), - scrollView.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: -20), - scrollView.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 0), - scrollView.rightAnchor.constraint(equalTo: view.rightAnchor, constant: -0), - ]) - } + NSLayoutConstraint.activate([ + scrollView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 20), + scrollView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -20), + scrollView.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 0), + scrollView.rightAnchor.constraint(equalTo: view.rightAnchor, constant: -0), + ]) titleLabel.preferredMaxLayoutWidth = contentMaxWidth bodyLabel.preferredMaxLayoutWidth = contentMaxWidth diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/Emoji/EmojiPageView.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/Emoji/EmojiPageView.swift index 39df506d..ccd029e1 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/Emoji/EmojiPageView.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/Emoji/EmojiPageView.swift @@ -246,7 +246,7 @@ open class EmojiPageView: UIView { } extension EmojiPageView: UIScrollViewDelegate { - public func scrollViewDidScroll(_ scrollView: UIScrollView) { + open func scrollViewDidScroll(_ scrollView: UIScrollView) { let width = scrollView.bounds.size.width let offsetX = scrollView.contentOffset.x let page = Int(abs(offsetX / width)) @@ -261,7 +261,7 @@ extension EmojiPageView: UIScrollViewDelegate { pageViewDelegate?.pageViewDidScroll?(self) } - public func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) { + open func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) { pageViewDelegate?.pageViewScrollEnd?( self, currentIndex: currentPage, diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/Emoji/NIMInputEmoticonManager.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/Emoji/NIMInputEmoticonManager.swift index ef377602..aa56420e 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/Emoji/NIMInputEmoticonManager.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/Emoji/NIMInputEmoticonManager.swift @@ -80,7 +80,7 @@ open class NIMInputEmoticonManager: NSObject { preloadEmoticonResource() } - public func setCustomEmojConfig(_ array: NSArray) { + open func setCustomEmojConfig(_ array: NSArray) { var catalogs = [NIMInputEmoticonCatalog]() for dict in array { if let convertDict = dict as? NSDictionary { diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/Helper/ChatDeduplicationHelper.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/Helper/ChatDeduplicationHelper.swift index c36b72cd..fd3d15d9 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/Helper/ChatDeduplicationHelper.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/Helper/ChatDeduplicationHelper.swift @@ -31,17 +31,17 @@ public class ChatDeduplicationHelper: NSObject, NEIMKitClientListener { IMKitClient.instance.removeLoginListener(self) } - public func onLoginStatus(_ status: V2NIMLoginStatus) { + open func onLoginStatus(_ status: V2NIMLoginStatus) { if status == .LOGIN_STATUS_LOGOUT { clearCache() } } - public func onKickedOffline(_ detail: V2NIMKickedOfflineDetail) { + open func onKickedOffline(_ detail: V2NIMKickedOfflineDetail) { clearCache() } - public func clearCache() { + open func clearCache() { blackListMessageIds.removeAll() recordAudioMessagePaths.removeAll() revokeMessageIds.removeAll() @@ -49,7 +49,7 @@ public class ChatDeduplicationHelper: NSObject, NEIMKitClientListener { } // 是否已经发送过对应消息的提示 - public func isMessageSended(messageId: String) -> Bool { + open func isMessageSended(messageId: String) -> Bool { if sendingMessageIds.contains(messageId) { return true } @@ -61,7 +61,7 @@ public class ChatDeduplicationHelper: NSObject, NEIMKitClientListener { } // 是否已经发送过黑名单消息的提示 - public func isBlackTipSended(messageId: String) -> Bool { + open func isBlackTipSended(messageId: String) -> Bool { if blackListMessageIds.contains(messageId) { return true } @@ -73,7 +73,7 @@ public class ChatDeduplicationHelper: NSObject, NEIMKitClientListener { } // 移除黑名单消息提示去重 id - public func removeBlackTipSendedId(messageId: String?) { + open func removeBlackTipSendedId(messageId: String?) { guard let messageId = messageId else { return } @@ -84,7 +84,7 @@ public class ChatDeduplicationHelper: NSObject, NEIMKitClientListener { } // 是否已经发过对应路径的音频消息,防止重复发送 - public func isRecordAudioSended(path: String) -> Bool { + open func isRecordAudioSended(path: String) -> Bool { if recordAudioMessagePaths.contains(path) { return true } @@ -95,7 +95,7 @@ public class ChatDeduplicationHelper: NSObject, NEIMKitClientListener { } // 是否已经保存过此撤回消息,防止重复保存本地撤回记录 - public func isRevokeMessageSaved(messageId: String) -> Bool { + open func isRevokeMessageSaved(messageId: String) -> Bool { if revokeMessageIds.contains(messageId) { return true } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/Helper/NEP2PChatUserCache.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/Helper/NEP2PChatUserCache.swift index 27302680..d5a6c96c 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/Helper/NEP2PChatUserCache.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/Helper/NEP2PChatUserCache.swift @@ -35,18 +35,18 @@ public class NEP2PChatUserCache: NSObject { /// 添加代理 /// - Parameter listener: 代理 - public func addListener(_ listener: NEP2PChatUserCacheListener) { + open func addListener(_ listener: NEP2PChatUserCacheListener) { multiDelegate.addDelegate(listener) } /// 移除代理 /// - Parameter listener: 代理 - public func removeListener(_ listener: NEP2PChatUserCacheListener) { + open func removeListener(_ listener: NEP2PChatUserCacheListener) { multiDelegate.removeDelegate(listener) } // 添加(更新)非好友信息 - public func updateUserInfo(_ user: V2NIMUser?) { + open func updateUserInfo(_ user: V2NIMUser?) { guard let accid = user?.accountId else { return } noUserCache[accid]?.user = user @@ -56,31 +56,31 @@ public class NEP2PChatUserCache: NSObject { } // 添加(更新)非好友信息 - public func updateUserInfo(_ user: NEUserWithFriend?) { + open func updateUserInfo(_ user: NEUserWithFriend?) { guard let accid = user?.user?.accountId else { return } noUserCache[accid] = user } /// 获取缓存的非好友信息 - public func getUserInfo(_ accountId: String) -> NEUserWithFriend? { + open func getUserInfo(_ accountId: String) -> NEUserWithFriend? { noUserCache[accountId] } /// 删除非好友信息缓存 - public func removeUserInfo(_ accountId: String) { + open func removeUserInfo(_ accountId: String) { if let _ = noUserCache[accountId] { noUserCache.removeValue(forKey: accountId) } } /// 删除所有非好友信息缓存 - public func removeAllUserInfo() { + open func removeAllUserInfo() { noUserCache.removeAll() } /// 获取缓存用户名字,p2p: 备注 > 昵称 > ID - public func getShowName(_ userId: String, - _ showAlias: Bool = true) -> String { + open func getShowName(_ userId: String, + _ showAlias: Bool = true) -> String { NEALog.infoLog(ModuleName + " " + className(), desc: #function + ", userId: " + userId) let user = getUserInfo(userId) return user?.showName(showAlias) ?? userId @@ -92,7 +92,7 @@ public class NEP2PChatUserCache: NSObject { extension NEP2PChatUserCache: NEContactListener { /// 用户信息变更回调 /// - Parameter users: 用户列表 - public func onUserProfileChanged(_ users: [V2NIMUser]) { + open func onUserProfileChanged(_ users: [V2NIMUser]) { for user in users { guard let accid = user.accountId else { break } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/Helper/NETeamUserManager.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/Helper/NETeamUserManager.swift index 19eb70cc..3df72fc6 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/Helper/NETeamUserManager.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/Helper/NETeamUserManager.swift @@ -60,19 +60,19 @@ public class NETeamUserManager: NSObject { /// 添加代理 /// - Parameter listener: 代理 - public func addListener(_ listener: NETeamChatUserCacheListener) { + open func addListener(_ listener: NETeamChatUserCacheListener) { multiDelegate.addDelegate(listener) } /// 移除代理 /// - Parameter listener: 代理 - public func removeListener(_ listener: NETeamChatUserCacheListener) { + open func removeListener(_ listener: NETeamChatUserCacheListener) { multiDelegate.removeDelegate(listener) } /// 加载缓存 /// - Parameter teamId: 群 id - public func loadData(_ teamId: String) { + open func loadData(_ teamId: String) { removeAllTeamInfo() tid = teamId @@ -89,7 +89,7 @@ public class NETeamUserManager: NSObject { /// 更新当前群信息 /// - Parameter team: 群信息 - public func updateTeamInfo(_ team: V2NIMTeam?) { + open func updateTeamInfo(_ team: V2NIMTeam?) { guard let teamId = team?.teamId, teamId == tid else { return } NEALog.infoLog(ModuleName + " " + className(), desc: #function + ", teamId: \(teamId)") currentTeam = team @@ -102,8 +102,8 @@ public class NETeamUserManager: NSObject { /// 更新群成员信息 /// - Parameter teamMember: 群成员信息 /// - Parameter notify: 是否需要通知 - public func updateTeamMemberInfo(_ teamMember: V2NIMTeamMember?, - _ notify: Bool = true) { + open func updateTeamMemberInfo(_ teamMember: V2NIMTeamMember?, + _ notify: Bool = true) { guard let teamMember = teamMember, teamMember.teamId == tid else { return } @@ -120,7 +120,7 @@ public class NETeamUserManager: NSObject { } // 添加(更新)非好友信息 - public func updateUserInfo(user: V2NIMUser?) { + open func updateUserInfo(user: V2NIMUser?) { guard let accid = user?.accountId else { return } userInfoCache[accid]?.user = user @@ -130,7 +130,7 @@ public class NETeamUserManager: NSObject { } // 添加(更新)非好友信息 - public func updateUserInfo(userWithFriend: NEUserWithFriend?) { + open func updateUserInfo(userWithFriend: NEUserWithFriend?) { guard let accid = userWithFriend?.user?.accountId else { return } userInfoCache[accid] = userWithFriend @@ -140,17 +140,17 @@ public class NETeamUserManager: NSObject { } /// 获取缓存的群聊信息 - public func getTeamInfo() -> V2NIMTeam? { + open func getTeamInfo() -> V2NIMTeam? { currentTeam } /// 获取缓存的群成员信息 - public func getTeamMemberInfo(_ accountId: String) -> V2NIMTeamMember? { + open func getTeamMemberInfo(_ accountId: String) -> V2NIMTeamMember? { teamMemberCache[accountId] } /// 获取缓存的所有群成员信息 - public func getAllTeamMembers() -> [V2NIMTeamMember]? { + open func getAllTeamMembers() -> [V2NIMTeamMember]? { if haveLoadAllMembers { var teamMemberInfoModels = [NETeamMemberInfoModel]() for (accid, member) in teamMemberCache { @@ -166,7 +166,7 @@ public class NETeamUserManager: NSObject { } /// 获取缓存的所有群成员信息 - public func getAllTeamMemberModels() -> [NETeamMemberInfoModel]? { + open func getAllTeamMemberModels() -> [NETeamMemberInfoModel]? { if haveLoadAllMembers { var teamMemberInfoModels = [NETeamMemberInfoModel]() for (accid, member) in teamMemberCache { @@ -182,19 +182,19 @@ public class NETeamUserManager: NSObject { } /// 获取缓存的非好友用户信息 - public func getUserInfo(_ accountId: String) -> NEUserWithFriend? { + open func getUserInfo(_ accountId: String) -> NEUserWithFriend? { userInfoCache[accountId] } /// 删除群成员信息缓存 - public func removeTeamMemberInfo(_ accountId: String) { + open func removeTeamMemberInfo(_ accountId: String) { if let _ = teamMemberCache[accountId] { teamMemberCache.removeValue(forKey: accountId) } } /// 删除所有信息缓存 - public func removeAllTeamInfo() { + open func removeAllTeamInfo() { tid = nil currentTeam = nil userInfoCache.removeAll() @@ -203,8 +203,8 @@ public class NETeamUserManager: NSObject { } /// 获取缓存群成员名字,team: 备注 > 群昵称 > 昵称 > ID - public func getShowName(_ accountId: String, - _ showAlias: Bool = true) -> String { + open func getShowName(_ accountId: String, + _ showAlias: Bool = true) -> String { NEALog.infoLog(ModuleName + " " + className(), desc: #function + ", userId: " + accountId) // 数字人直接返回 @@ -245,9 +245,9 @@ public class NETeamUserManager: NSObject { /// - accountIds: 成员 id 列表 /// - notify: 是否需要通知 /// - completion: 完成回调 - public func getTeamMembers(_ accountIds: [String], - _ notify: Bool = true, - _ completion: @escaping () -> Void) { + open func getTeamMembers(_ accountIds: [String], + _ notify: Bool = true, + _ completion: @escaping () -> Void) { NEALog.infoLog(ModuleName + " " + className(), desc: #function + ", teamId: \(String(describing: tid))") var loadUserIds = Set() // 需要查询用户信息的ID @@ -304,9 +304,9 @@ public class NETeamUserManager: NSObject { /// - Parameter teamId: 群id /// - Parameter queryType: 查询类型 /// - Parameter completion: 完成后的回调 - public func getAllTeamMembers(_ teamId: String, - _ queryType: V2NIMTeamMemberRoleQueryType = .TEAM_MEMBER_ROLE_QUERY_TYPE_ALL, - _ completion: @escaping ([NEUserWithFriend]) -> Void) { + open func getAllTeamMembers(_ teamId: String, + _ queryType: V2NIMTeamMemberRoleQueryType = .TEAM_MEMBER_ROLE_QUERY_TYPE_ALL, + _ completion: @escaping ([NEUserWithFriend]) -> Void) { NEALog.infoLog(ModuleName + " " + className(), desc: #function + ", teamid:\(teamId)") var memberLists = [V2NIMTeamMember]() weak var weakSelf = self @@ -332,7 +332,7 @@ public class NETeamUserManager: NSObject { /// 获取群成员(使用最大分页参数,防止触发频控) /// - Parameter teamId: 群ID /// - Parameter completion: 完成回调 - public func getAllTeamMemberWithMaxLimit(_ teamId: String, _ nextToken: String? = nil, _ memberList: inout [V2NIMTeamMember], _ queryType: V2NIMTeamMemberRoleQueryType, _ completion: @escaping ([V2NIMTeamMember]?, NSError?) -> Void) { + open func getAllTeamMemberWithMaxLimit(_ teamId: String, _ nextToken: String? = nil, _ memberList: inout [V2NIMTeamMember], _ queryType: V2NIMTeamMemberRoleQueryType, _ completion: @escaping ([V2NIMTeamMember]?, NSError?) -> Void) { NEALog.infoLog(className(), desc: #function + " teamId : \(teamId)") let option = V2NIMTeamMemberQueryOption() option.direction = .QUERY_DIRECTION_ASC @@ -419,7 +419,7 @@ public class NETeamUserManager: NSObject { extension NETeamUserManager: NEContactListener { /// 好友信息缓存更新 /// - Parameter accountId: 用户 id - public func onContactChange(_ changeType: NEContactChangeType, _ contacts: [NEUserWithFriend]) { + open func onContactChange(_ changeType: NEContactChangeType, _ contacts: [NEUserWithFriend]) { for contact in contacts { if let accid = contact.user?.accountId { // 好友被删除,则信息缓存移至 userInfoCache @@ -447,7 +447,7 @@ extension NETeamUserManager: NEContactListener { extension NETeamUserManager: NETeamListener { /// 群组信息更新回调 /// - Parameter team: 群组对象 - public func onTeamInfoUpdated(_ team: V2NIMTeam) { + open func onTeamInfoUpdated(_ team: V2NIMTeam) { if team.teamId == tid { updateTeamInfo(team) } @@ -455,7 +455,7 @@ extension NETeamUserManager: NETeamListener { /// 群组成员加入回调 /// - Parameter teamMembers: 群成员 - public func onTeamMemberJoined(_ teamMembers: [V2NIMTeamMember]) { + open func onTeamMemberJoined(_ teamMembers: [V2NIMTeamMember]) { var notFriendMembers = [String]() for member in teamMembers { if member.teamId == tid { @@ -475,7 +475,7 @@ extension NETeamUserManager: NETeamListener { /// 群组成员信息变更回调 /// - Parameter teamMembers: 群成员 - public func onTeamMemberInfoUpdated(_ teamMembers: [V2NIMTeamMember]) { + open func onTeamMemberInfoUpdated(_ teamMembers: [V2NIMTeamMember]) { for member in teamMembers { if member.teamId == tid { updateTeamMemberInfo(member) @@ -485,7 +485,7 @@ extension NETeamUserManager: NETeamListener { /// 群组成员退出回调 /// - Parameter teamMembers: 群成员列表 - public func onTeamMemberLeft(_ teamMembers: [V2NIMTeamMember]) { + open func onTeamMemberLeft(_ teamMembers: [V2NIMTeamMember]) { for member in teamMembers { if member.teamId == tid { removeTeamMemberInfo(member.accountId) @@ -496,7 +496,7 @@ extension NETeamUserManager: NETeamListener { /// 群组成员被踢回调 /// - Parameter operatorAccountId: 操作者用户id /// - Parameter teamMembers: 群成员列表 - public func onTeamMemberKicked(_ operatorAccountId: String, teamMembers: [V2NIMTeamMember]) { + open func onTeamMemberKicked(_ operatorAccountId: String, teamMembers: [V2NIMTeamMember]) { for member in teamMembers { if member.teamId == tid { removeTeamMemberInfo(member.accountId) @@ -510,7 +510,7 @@ extension NETeamUserManager: NETeamListener { extension NETeamUserManager: NEIMKitClientListener { /// 登录连接状态回调 /// - Parameter status: 连接状态 - public func onDataSync(_ type: V2NIMDataSyncType, state: V2NIMDataSyncState, error: V2NIMError?) { + open func onDataSync(_ type: V2NIMDataSyncType, state: V2NIMDataSyncState, error: V2NIMError?) { guard let tid = tid else { return } // 断网重连后,重新拉取群信息、自己的群成员信息 diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/Model/MessageAtCacheModel.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/Model/MessageAtCacheModel.swift index 10e3646e..bb919603 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/Model/MessageAtCacheModel.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/Model/MessageAtCacheModel.swift @@ -9,7 +9,7 @@ open class MessageAtCacheModel: NSObject { public var atModel: MessageAtInfoModel public var accid: String public var text: String? - init(atModel: MessageAtInfoModel, accid: String) { + public init(atModel: MessageAtInfoModel, accid: String) { self.atModel = atModel self.accid = accid } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/Model/MessageVideoModel.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/Model/MessageVideoModel.swift index ca08e54f..81b1b5af 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/Model/MessageVideoModel.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/Model/MessageVideoModel.swift @@ -35,7 +35,7 @@ open class MessageVideoModel: MessageImageModel { /// 设置(视频、文件)消息模型(上传、下载)进度 /// - Parameters: /// - progress:(上传、下载)进度 - public func setModelProgress(_ progress: UInt) { + open func setModelProgress(_ progress: UInt) { if progress == 100 { state = .Success } else { diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/Model/NEPinMessageModel.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/Model/NEPinMessageModel.swift index a5390af5..8fbf42ac 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/Model/NEPinMessageModel.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/Model/NEPinMessageModel.swift @@ -16,7 +16,7 @@ open class NEPinMessageModel: NSObject { var repo = ChatRepo.shared var pinFileModel: PinMessageFileModel? - init(message: V2NIMMessage, item: V2NIMMessagePin) { + public init(message: V2NIMMessage, item: V2NIMMessagePin) { self.message = message conversationId = item.messageRefer?.conversationId self.item = item diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageAudioCell.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageAudioCell.swift index 40a3e3f0..bc82402b 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageAudioCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageAudioCell.swift @@ -25,7 +25,7 @@ class NEBaseCollectionMessageAudioCell: NEBaseCollectionMessageCell { public var isPlaying = false - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageCell.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageCell.swift index abff668b..59e8f464 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageCell.swift @@ -80,7 +80,7 @@ open class NEBaseCollectionMessageCell: UITableViewCell { // Initialization code } - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) selectionStyle = .none backgroundColor = .clear diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageDefaultCell.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageDefaultCell.swift index fb6b74f9..cca8b7ea 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageDefaultCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageDefaultCell.swift @@ -19,7 +19,7 @@ class NEBaseCollectionMessageDefaultCell: NEBaseCollectionMessageTextCell { } /// 初始化的生命周期 - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageFileCell.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageFileCell.swift index 5215bab5..74e0bc4d 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageFileCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageFileCell.swift @@ -81,7 +81,7 @@ class NEBaseCollectionMessageFileCell: NEBaseCollectionMessageCell { } /// 初始化的生命周期 - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } @@ -153,7 +153,10 @@ class NEBaseCollectionMessageFileCell: NEBaseCollectionMessageCell { } } var fileName = "file_unknown" - let suffix = (fileObject.name as NSString).pathExtension.lowercased() + var suffix = (fileObject.name as NSString).pathExtension.lowercased() + if suffix.isEmpty, let ext = fileObject.ext { + suffix = ext[(ext.index(after: ext.startIndex)) ..< ext.endIndex].lowercased() + } switch suffix { case file_doc_support: fileName = "file_doc" @@ -167,7 +170,7 @@ class NEBaseCollectionMessageFileCell: NEBaseCollectionMessageCell { fileName = "file_txt" case file_audio_support: fileName = "file_audio" - case file_vedio_support: + case file_video_support: fileName = "file_vedio" case file_zip_support: fileName = "file_zip" @@ -185,16 +188,16 @@ class NEBaseCollectionMessageFileCell: NEBaseCollectionMessageCell { titleLabel.text = fileObject.name let size_B = Double(fileObject.size) - var size_str = String(format: "%.1f B", size_B) + var size_str = String(format: "%.2f B", size_B) if size_B > 1e3 { let size_KB = size_B / 1e3 - size_str = String(format: "%.1f KB", size_KB) + size_str = String(format: "%.2f KB", size_KB) if size_KB > 1e3 { let size_MB = size_KB / 1e3 - size_str = String(format: "%.1f MB", size_MB) + size_str = String(format: "%.2f MB", size_MB) if size_MB > 1e3 { let size_GB = size_KB / 1e6 - size_str = String(format: "%.1f GB", size_GB) + size_str = String(format: "%.2f GB", size_GB) } } } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageImageCell.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageImageCell.swift index d57f5d0e..1f4b4829 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageImageCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageImageCell.swift @@ -29,7 +29,7 @@ class NEBaseCollectionMessageImageCell: NEBaseCollectionMessageCell { } /// 初始化的生命周期 - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageLocationCell.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageLocationCell.swift index 0dbf2cf5..00831f7b 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageLocationCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageLocationCell.swift @@ -62,7 +62,7 @@ class NEBaseCollectionMessageLocationCell: NEBaseCollectionMessageCell { } /// 初始化的生命周期 - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageMultiForwardCell.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageMultiForwardCell.swift index 56ecf081..82c51c98 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageMultiForwardCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageMultiForwardCell.swift @@ -72,7 +72,7 @@ class NEBaseCollectionMessageMultiForwardCell: NEBaseCollectionMessageCell { } /// 初始化的生命周期 - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageRichTextCell.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageRichTextCell.swift index fe410ff0..16ac4453 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageRichTextCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageRichTextCell.swift @@ -30,7 +30,7 @@ class NEBaseCollectionMessageRichTextCell: NEBaseCollectionMessageTextCell { } /// 初始化的生命周期 - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageTextCell.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageTextCell.swift index 7d706383..a1dc13e0 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageTextCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageTextCell.swift @@ -34,7 +34,7 @@ class NEBaseCollectionMessageTextCell: NEBaseCollectionMessageCell { } /// 初始化的生命周期 - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageVideoCell.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageVideoCell.swift index 32383d00..658b6257 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageVideoCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/CollectionCell/NEBaseCollectionMessageVideoCell.swift @@ -55,7 +55,7 @@ class NEBaseCollectionMessageVideoCell: NEBaseCollectionMessageImageCell { } /// 初始化的生命周期 - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/NEBaseChatMessageCell.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/NEBaseChatMessageCell.swift index e64c7782..6ab72ec3 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/NEBaseChatMessageCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/NEBaseChatMessageCell.swift @@ -629,13 +629,13 @@ open class NEBaseChatMessageCell: NEChatBaseCell { pinImage.isHidden = !model.isPined contentView.backgroundColor = model.isPined ? ChatUIConfig.shared.messageProperties.signalBgColor : .clear if model.isPined { - let pinText = chatLocalizable("pin_text") + let pinText = String(format: chatLocalizable("pin_text"), chatLocalizable("You")) if model.pinAccount == nil { - pinLabel.text = pinText + chatLocalizable("You") + pinLabel.text = pinText } else if let account = model.pinAccount, account == IMKitClient.instance.account() { - pinLabel.text = pinText + chatLocalizable("You") + pinLabel.text = pinText } else if let text = model.pinShowName { - pinLabel.text = pinText + text + pinLabel.text = String(format: chatLocalizable("pin_text"), text) } pinImage.image = UIImage.ne_imageNamed(name: "msg_pin") diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/OperationCell.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/OperationCell.swift index 9360c3c3..200f4fbf 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/OperationCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/OperationCell.swift @@ -34,7 +34,7 @@ open class OperationCell: UICollectionViewCell { commonUI() } - public func commonUI() { + open func commonUI() { contentView.accessibilityIdentifier = "id.menuCell" imageView.translatesAutoresizingMaskIntoConstraints = false diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageAudioCell.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageAudioCell.swift index 4071bf74..3f23186b 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageAudioCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageAudioCell.swift @@ -12,7 +12,7 @@ open class NEBasePinMessageAudioCell: NEBasePinMessageCell { public var isPlaying = false - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageCell.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageCell.swift index 9fed1f79..ee12431d 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageCell.swift @@ -65,7 +65,7 @@ open class NEBasePinMessageCell: UITableViewCell { // Initialization code } - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) selectionStyle = .none backgroundColor = .clear diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageDefaultCell.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageDefaultCell.swift index f11ff48d..933d13b4 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageDefaultCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageDefaultCell.swift @@ -17,7 +17,7 @@ open class NEBasePinMessageDefaultCell: NEBasePinMessageTextCell { // Configure the view for the selected state } - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageFileCell.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageFileCell.swift index 3cd4e96f..a419d1ec 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageFileCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageFileCell.swift @@ -75,7 +75,7 @@ open class NEBasePinMessageFileCell: NEBasePinMessageCell { // Configure the view for the selected state } - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } @@ -148,7 +148,10 @@ open class NEBasePinMessageFileCell: NEBasePinMessageCell { } var imageName = "file_unknown" - let suffix = (fileObject.name as NSString).pathExtension.lowercased() + var suffix = (fileObject.name as NSString).pathExtension.lowercased() + if suffix.isEmpty, let ext = fileObject.ext { + suffix = ext[(ext.index(after: ext.startIndex)) ..< ext.endIndex].lowercased() + } switch suffix { case file_doc_support: imageName = "file_doc" @@ -162,7 +165,7 @@ open class NEBasePinMessageFileCell: NEBasePinMessageCell { imageName = "file_txt" case file_audio_support: imageName = "file_audio" - case file_vedio_support: + case file_video_support: imageName = "file_vedio" case file_zip_support: imageName = "file_zip" @@ -180,16 +183,16 @@ open class NEBasePinMessageFileCell: NEBasePinMessageCell { titleLabel.text = fileObject.name let size_B = Double(fileObject.size) - var size_str = String(format: "%.1f B", size_B) + var size_str = String(format: "%.2f B", size_B) if size_B > 1e3 { let size_KB = size_B / 1e3 - size_str = String(format: "%.1f KB", size_KB) + size_str = String(format: "%.2f KB", size_KB) if size_KB > 1e3 { let size_MB = size_KB / 1e3 - size_str = String(format: "%.1f MB", size_MB) + size_str = String(format: "%.2f MB", size_MB) if size_MB > 1e3 { let size_GB = size_KB / 1e6 - size_str = String(format: "%.1f GB", size_GB) + size_str = String(format: "%.2f GB", size_GB) } } } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageImageCell.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageImageCell.swift index da2bea39..2e8762e7 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageImageCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageImageCell.swift @@ -17,7 +17,7 @@ open class NEBasePinMessageImageCell: NEBasePinMessageCell { super.setSelected(selected, animated: animated) } - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageLocationCell.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageLocationCell.swift index 65e8cebb..8fe41aba 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageLocationCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageLocationCell.swift @@ -56,7 +56,7 @@ open class NEBasePinMessageLocationCell: NEBasePinMessageCell { // Configure the view for the selected state } - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageRichTextCell.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageRichTextCell.swift index be28fbac..526bda39 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageRichTextCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageRichTextCell.swift @@ -16,7 +16,7 @@ open class NEBasePinMessageRichTextCell: NEBasePinMessageTextCell { return label }() - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageTextCell.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageTextCell.swift index 53336407..a10dfddd 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageTextCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageTextCell.swift @@ -30,7 +30,7 @@ open class NEBasePinMessageTextCell: NEBasePinMessageCell { // Configure the view for the selected state } - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageVideoCell.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageVideoCell.swift index a2eb3865..7d16e80a 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageVideoCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageVideoCell.swift @@ -40,7 +40,7 @@ open class NEBasePinMessageVideoCell: NEBasePinMessageImageCell { return view }() - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/ChatActivityIndicatorView.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/ChatActivityIndicatorView.swift index 6d625cc2..cc086d9e 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/ChatActivityIndicatorView.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/ChatActivityIndicatorView.swift @@ -54,7 +54,7 @@ open class ChatActivityIndicatorView: UIView { return activityView }() - override init(frame: CGRect) { + override public init(frame: CGRect) { super.init(frame: frame) commonUI() } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/ChatBrokenNetworkView.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/ChatBrokenNetworkView.swift index d4485a48..10217bae 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/ChatBrokenNetworkView.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/ChatBrokenNetworkView.swift @@ -18,7 +18,7 @@ open class ChatBrokenNetworkView: UIView { return label }() - override init(frame: CGRect) { + override public init(frame: CGRect) { super.init(frame: frame) commonUI() } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/ChatRecordView.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/ChatRecordView.swift index c91ce70b..a193630d 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/ChatRecordView.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/ChatRecordView.swift @@ -20,7 +20,7 @@ open class ChatRecordView: UIView, UIGestureRecognizerDelegate { var tipLabel = UILabel() public weak var delegate: ChatRecordViewDelegate? private var outView = false - override init(frame: CGRect) { + override public init(frame: CGRect) { super.init(frame: frame) commonUI() } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/CirleProgressView.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/CirleProgressView.swift index 1cf574ac..5715f283 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/CirleProgressView.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/CirleProgressView.swift @@ -37,7 +37,7 @@ open class CirleProgressView: UIView { // drawCircle(progress: progress) // } - override init(frame: CGRect) { + override public init(frame: CGRect) { super.init(frame: frame) backgroundColor = .clear imageView.frame = bounds diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/MessageOperationView.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/MessageOperationView.swift index 244e2e19..6395406f 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/MessageOperationView.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/MessageOperationView.swift @@ -21,7 +21,7 @@ open class MessageOperationView: UIView, UICollectionViewDataSource, UICollectio } } - override init(frame: CGRect) { + override public init(frame: CGRect) { let layout = UICollectionViewFlowLayout() layout.itemSize = CGSize(width: 60, height: 56) layout.minimumLineSpacing = 0 diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/NEAITranslateView.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/NEAITranslateView.swift index a5eaa4d2..15ad8437 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/NEAITranslateView.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/NEAITranslateView.swift @@ -298,7 +298,7 @@ open class NEAITranslateView: UIView, NEGrowingTextViewDelegate { } /// 控件内容高度 - public func getCurrentHeight() -> CGFloat { + open func getCurrentHeight() -> CGFloat { 70 } @@ -315,7 +315,7 @@ open class NEAITranslateView: UIView, NEGrowingTextViewDelegate { // MARK: - growing text view delegate - public func growingTextView(_ growingTextView: NEGrowingTextView, didChangeHeight height: CGFloat, difference: CGFloat) { + open func growingTextView(_ growingTextView: NEGrowingTextView, didChangeHeight height: CGFloat, difference: CGFloat) { if frame.height < 1 { // 首次加载 不需要回调,此时回调将导致外部显示异常 return @@ -324,7 +324,7 @@ open class NEAITranslateView: UIView, NEGrowingTextViewDelegate { delegate?.didChangeViewHeight?(self, 52 + height) } - public func didStart() { + open func didStart() { if translateState == .Use { if let text = showTranslateContentText.text { delegate?.didUseTranslate?(text) @@ -352,7 +352,7 @@ open class NEAITranslateView: UIView, NEGrowingTextViewDelegate { } } - public func setTranslateContent(_ content: String) { + open func setTranslateContent(_ content: String) { if translateState == .Translating { showTranslateContentText.text = content changeToUseState() @@ -361,7 +361,7 @@ open class NEAITranslateView: UIView, NEGrowingTextViewDelegate { /// 恢复默认状态 /// - Parameter isClearText: 是否清空输入框 - public func changeToIdleState(_ isClearText: Bool = false) { + open func changeToIdleState(_ isClearText: Bool = false) { translateState = .Idle if isClearText { showTranslateContentText.text = "" @@ -372,7 +372,7 @@ open class NEAITranslateView: UIView, NEGrowingTextViewDelegate { } /// 进入处理中状态 - public func changeToTranslatingState() { + open func changeToTranslatingState() { translateState = .Translating statusLabel.attributedText = processingString loadingAnimationView.isHidden = false @@ -380,7 +380,7 @@ open class NEAITranslateView: UIView, NEGrowingTextViewDelegate { } /// 进入翻译完成状态(等待使用) - public func changeToUseState() { + open func changeToUseState() { translateState = .Use statusLabel.attributedText = useAttributeString loadingAnimationView.isHidden = true diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/NEBaseChatInputView.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/NEBaseChatInputView.swift index c94a3091..92ea1667 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/NEBaseChatInputView.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/NEBaseChatInputView.swift @@ -169,7 +169,7 @@ open class NEBaseChatInputView: UIView, ChatRecordViewDelegate, public var multipleLineViewHeight: NSLayoutConstraint? - override init(frame: CGRect) { + override public init(frame: CGRect) { super.init(frame: frame) commonUI() } @@ -416,7 +416,7 @@ open class NEBaseChatInputView: UIView, ChatRecordViewDelegate, } /// 点击富文本图片 - public func textView(_ textView: UITextView, shouldInteractWith textAttachment: NSTextAttachment, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool { + open func textView(_ textView: UITextView, shouldInteractWith textAttachment: NSTextAttachment, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool { textView.becomeFirstResponder() var offset = characterRange.location diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/NEChatMoreActionView.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/NEChatMoreActionView.swift index ebb0acc1..e3764017 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/NEChatMoreActionView.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/NEChatMoreActionView.swift @@ -50,7 +50,7 @@ open class NEChatMoreActionView: UIView { return collcetionView }() - override init(frame: CGRect) { + override public init(frame: CGRect) { super.init(frame: frame) addSubview(collcetionView) setupConstraints() diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/NEInputMoreCell.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/NEInputMoreCell.swift index 7fe15cee..f4a05a09 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/NEInputMoreCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/NEInputMoreCell.swift @@ -28,7 +28,7 @@ open class NEInputMoreCell: UICollectionViewCell { return titleLabel }() - override init(frame: CGRect) { + override public init(frame: CGRect) { super.init(frame: frame) setupViews() } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/ReplyView.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/ReplyView.swift index 749bca93..d51fbf9c 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/ReplyView.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/ReplyView.swift @@ -11,7 +11,7 @@ open class ReplyView: UIView { var line = UIView() var textLabel = UILabel() - override init(frame: CGRect) { + override public init(frame: CGRect) { super.init(frame: frame) backgroundColor = UIColor(hexString: "#EFF1F2") closeButton.setImage(UIImage.ne_imageNamed(name: "close"), for: .normal) diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/TopMessageView.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/TopMessageView.swift index ff2af2ee..35ee628a 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/TopMessageView.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/TopMessageView.swift @@ -70,7 +70,7 @@ open class TopMessageView: UIView { return button }() - override init(frame: CGRect) { + override public init(frame: CGRect) { super.init(frame: frame) backgroundColor = .white layer.cornerRadius = 8 @@ -121,7 +121,7 @@ open class TopMessageView: UIView { /// - Parameter url: 置顶消息 图片缩略图/视频首帧 地址 /// - Parameter isVideo: 置顶消息是否是视频消息 /// - Parameter hideClose: 是否隐藏移除置顶按钮 - public func setTopContent(name: String?, content: String?, url: String?, isVideo: Bool, hideClose: Bool) { + open func setTopContent(name: String?, content: String?, url: String?, isVideo: Bool, hideClose: Bool) { self.content = content updateTopName(name: name) @@ -140,7 +140,7 @@ open class TopMessageView: UIView { /// 设置(更新)置顶消息发送者昵称 /// - Parameter content: 发送者昵称 - public func updateTopName(name: String?) { + open func updateTopName(name: String?) { var text = "" if let fullName = name, !fullName.isEmpty { diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/ViewModel/ChatViewModel.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/ViewModel/ChatViewModel.swift index 33885327..ab60b9e4 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/ViewModel/ChatViewModel.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/ViewModel/ChatViewModel.swift @@ -152,13 +152,13 @@ open class ChatViewModel: NSObject { /// 数字人请求成功code public var aiUserRequestSuccess = 200 - override init() { + override public init() { conversationId = "" sessionId = "" super.init() } - init(conversationId: String) { + public init(conversationId: String) { NEALog.infoLog(ModuleName + " " + ChatViewModel.className(), desc: #function + ", conversationId:\(conversationId)") self.conversationId = conversationId sessionId = V2NIMConversationIdUtil.conversationTargetId(conversationId) ?? "" @@ -167,7 +167,7 @@ open class ChatViewModel: NSObject { addListener() } - init(conversationId: String, anchor: V2NIMMessage?) { + public init(conversationId: String, anchor: V2NIMMessage?) { NEALog.infoLog(ModuleName + " " + ChatViewModel.className(), desc: #function + ", conversationId:\(conversationId)") self.conversationId = conversationId self.anchor = anchor @@ -199,7 +199,7 @@ open class ChatViewModel: NSObject { } /// 清空当前会话的未读数 - public func clearUnreadCount() { + open func clearUnreadCount() { ConversationRepo.shared.clearUnreadCountByIds([conversationId]) { result, error in NEALog.infoLog(ModuleName, desc: #function + " error" + (error?.localizedDescription ?? "")) } @@ -216,6 +216,7 @@ open class ChatViewModel: NSObject { // 记录可信时间戳 if anchor == nil { messages.removeAll() + delegate?.tableViewReload() isHistoryChat = false getHistoryMessage(order: .QUERY_DIRECTION_DESC, message: nil) { [weak self] error, count, models in @@ -254,6 +255,8 @@ open class ChatViewModel: NSObject { if !hasLoad { messages.removeAll() + delegate?.tableViewReload() + group.enter() getHistoryMessage(order: .QUERY_DIRECTION_DESC, message: anchor) { [weak self] error, value, models in moreEnd = value @@ -921,6 +924,11 @@ open class ChatViewModel: NSObject { /// - videoURL: 视频文件路径 /// - completion: 完成回调 func convertVideoToMP4(videoURL: URL, completion: @escaping (URL?, Error?) -> Void) { + if videoURL.pathExtension.lowercased() == "mp4" { + completion(videoURL, nil) + return + } + let outputFileName = NIMKitFileLocationHelper.genFilename(withExt: "mp4") guard let outputPath = NIMKitFileLocationHelper.filepath(forVideo: outputFileName) else { return @@ -936,7 +944,7 @@ open class ChatViewModel: NSObject { if session?.status == AVAssetExportSession.Status.completed { completion(outputUrl, nil) } else { - completion(nil, nil) + completion(videoURL, nil) } } } @@ -2266,7 +2274,7 @@ extension ChatViewModel: NEMessageListener { /// 来源: 发送消息, 插入消息 /// - Parameter param: 消息参数,包含消息和发送参数 /// - Returns: (修改后的)消息参数,若消息参数为 nil,则表示拦截该消息不发送 - public func beforeSend(_ param: MessageSendParams) -> MessageSendParams? { + open func beforeSend(_ param: MessageSendParams) -> MessageSendParams? { delegate?.beforeSend?(param) } @@ -2274,7 +2282,7 @@ extension ChatViewModel: NEMessageListener { /// 来源: 发送消息, 插入消息 /// - Parameter param: 消息参数,包含消息和发送参数 /// - Parameter completion: (修改后的)消息参数,若消息参数为 nil,则表示拦截该消息不发送 - public func beforeSend(_ param: MessageSendParams, _ completion: @escaping (MessageSendParams?) -> Void) { + open func beforeSend(_ param: MessageSendParams, _ completion: @escaping (MessageSendParams?) -> Void) { delegate?.beforeSend?(param, completion) } } @@ -2285,7 +2293,7 @@ extension ChatViewModel: NEChatListener { /// 本端发送消息状态回调 /// 来源: 发送消息, 插入消息 /// - Parameter message: 消息 - public func onSendMessage(_ message: V2NIMMessage) { + open func onSendMessage(_ message: V2NIMMessage) { switch message.sendingState { case .MESSAGE_SENDING_STATE_SENDING: sendingMsg(message) @@ -2302,13 +2310,13 @@ extension ChatViewModel: NEChatListener { /// - Parameters: /// - message: 消息 /// - error: 错误信息 - public func sendMessageFailed(_ message: V2NIMMessage, _ error: NSError) { + open func sendMessageFailed(_ message: V2NIMMessage, _ error: NSError) { sendMsgFailed(message, error) } /// 收到消息 /// - Parameter messages: 消息列表 - public func onReceiveMessages(_ messages: [V2NIMMessage]) { + open func onReceiveMessages(_ messages: [V2NIMMessage]) { NEALog.infoLog(ModuleName + " " + className(), desc: #function + ", messages.count: \(messages.count), first.messageID: \(messages.first?.messageClientId ?? "")") for msg in messages { @@ -2346,7 +2354,7 @@ extension ChatViewModel: NEChatListener { /// 消息撤回回调 /// - Parameter revokeNotifications: 撤回通知 - public func onMessageRevokeNotifications(_ revokeNotifications: [V2NIMMessageRevokeNotification]) { + open func onMessageRevokeNotifications(_ revokeNotifications: [V2NIMMessageRevokeNotification]) { NEALog.infoLog(ModuleName + " " + className(), desc: #function + ", revokeNotifications.count: \(revokeNotifications.count)") for revokeNoti in revokeNotifications { if revokeNoti.messageRefer?.conversationId != conversationId { @@ -2363,7 +2371,7 @@ extension ChatViewModel: NEChatListener { } for model in messages { - if let msg = model.message, msg.messageClientId == revokeNoti.messageRefer?.messageClientId { + if let msg = model.message, msg.messageClientId == revokeNoti.messageRefer?.messageClientId, !model.isRevoked { msg.localExtension = revokeNoti.serverExtension revokeMessageUpdateUI(msg) break @@ -2374,7 +2382,7 @@ extension ChatViewModel: NEChatListener { /// 消息删除成功回调。当本地端或多端同步删除消息成功时会触发该回调。 /// - Parameter messageDeletedNotification: 删除通知 - public func onMessageDeletedNotifications(_ messageDeletedNotification: [V2NIMMessageDeletedNotification]) { + open func onMessageDeletedNotifications(_ messageDeletedNotification: [V2NIMMessageDeletedNotification]) { NEALog.infoLog(ModuleName + " " + className(), desc: #function + ", messageDeletedNotification.count: \(messageDeletedNotification.count)") var deleteMessages = [V2NIMMessage]() @@ -2404,13 +2412,13 @@ extension ChatViewModel: NEChatListener { /// 消息清空成功回调。当本地端或多端同步清空消息成功时会触发该回调。 /// - Parameter clearHistoryNotification: 清空通知 - public func onClearHistoryNotifications(_ clearHistoryNotification: [V2NIMClearHistoryNotification]) { + open func onClearHistoryNotifications(_ clearHistoryNotification: [V2NIMClearHistoryNotification]) { NEALog.infoLog(ModuleName + " " + className(), desc: #function + ", clearHistoryNotification.count: \(clearHistoryNotification.count)") } /// 消息pin状态回调通知 /// - Parameter pinNotification: 消息pin状态变化通知数据 - public func onMessagePinNotification(_ pinNotification: V2NIMMessagePinNotification) { + open func onMessagePinNotification(_ pinNotification: V2NIMMessagePinNotification) { NEALog.infoLog(ModuleName + " " + className(), desc: #function + ", messageId:\(String(describing: pinNotification.pin?.messageRefer?.messageClientId)), pinStatus:\(pinNotification.pinState.rawValue)") if pinNotification.pinState == .MESSAGE_PIN_STEATE_PINNED { // 置顶 @@ -2461,13 +2469,13 @@ extension ChatViewModel: NEChatListener { /// 消息评论状态回调 /// - Parameter notification: 快捷评论通知数据 - public func onMessageQuickCommentNotification(_ notification: V2NIMMessageQuickCommentNotification) { + open func onMessageQuickCommentNotification(_ notification: V2NIMMessageQuickCommentNotification) { NEALog.infoLog(ModuleName + " " + className(), desc: #function + ", quickComment.index: \(notification.quickComment.index)") } /// 收到点对点已读回执 /// - Parameter readReceipts: 已读回执 - public func onReceiveP2PMessageReadReceipts(_ readReceipts: [V2NIMP2PMessageReadReceipt]) { + open func onReceiveP2PMessageReadReceipts(_ readReceipts: [V2NIMP2PMessageReadReceipt]) { NEALog.infoLog(ModuleName + " " + className(), desc: #function + ", readReceipts.count: \(readReceipts.count)") var reloadIndexPaths: [IndexPath] = [] for readReceipt in readReceipts { @@ -2500,7 +2508,7 @@ extension ChatViewModel: NEChatListener { /// 收到群已读回执 /// - Parameter readReceipts: 已读回执 - public func onReceiveTeamMessageReadReceipts(_ readReceipts: [V2NIMTeamMessageReadReceipt]) { + open func onReceiveTeamMessageReadReceipts(_ readReceipts: [V2NIMTeamMessageReadReceipt]) { NEALog.infoLog(ModuleName + " " + className(), desc: #function + ", readReceipts.count: \(readReceipts.count)") var reloadIndexPaths: [IndexPath] = [] for readReceipt in readReceipts { @@ -2531,7 +2539,7 @@ extension ChatViewModel: NEChatListener { // MARK: AI Listener extension ChatViewModel: V2NIMAIListener { - public func onProxyAIModelCall(_ data: V2NIMAIModelCallResult) { + open func onProxyAIModelCall(_ data: V2NIMAIModelCallResult) { if data.code == aiUserRequestSuccess { if data.requestId == translationlanguageRquestId { delegate?.didTranslateResult?(data.content.msg) @@ -2543,7 +2551,7 @@ extension ChatViewModel: V2NIMAIListener { /// 翻译 /// - Parameter 需要翻译文本 /// - Parameter 目标语言 - public func translateLanguage(_ sourceText: String, targetLanguage: String, _ completion: @escaping (NSError?) -> Void) { + open func translateLanguage(_ sourceText: String, targetLanguage: String, _ completion: @escaping (NSError?) -> Void) { NEALog.infoLog(className(), desc: #function + " ai translate source : \(sourceText)") let request = V2NIMProxyAIModelCallParams() diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/ViewModel/CollectionMessageViewModel.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/ViewModel/CollectionMessageViewModel.swift index d1e5ee1f..c62f5d33 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/ViewModel/CollectionMessageViewModel.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/ViewModel/CollectionMessageViewModel.swift @@ -25,7 +25,7 @@ class CollectionMessageViewModel: NSObject { /// 加载收藏数据 /// - Parameter completion: 完成回调 - public func loadData(_ completion: @escaping (NSError?, Bool) -> Void) { + open func loadData(_ completion: @escaping (NSError?, Bool) -> Void) { let option = V2NIMCollectionOption() if let model = collectionDatas.last, let anchor = model.collection { diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/ViewModel/P2PChatViewModel.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/ViewModel/P2PChatViewModel.swift index bd88ddfb..ccfb5c0f 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/ViewModel/P2PChatViewModel.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/ViewModel/P2PChatViewModel.swift @@ -11,12 +11,12 @@ import NIMSDK @objcMembers open class P2PChatViewModel: ChatViewModel { /// 重写初始化方法 - override init(conversationId: String) { + override public init(conversationId: String) { super.init(conversationId: conversationId) } /// 重写初始化方法 - override init(conversationId: String, anchor: V2NIMMessage?) { + override public init(conversationId: String, anchor: V2NIMMessage?) { super.init(conversationId: conversationId, anchor: anchor) } @@ -173,7 +173,7 @@ extension P2PChatViewModel: NENotiListener { /// 收到自定义系统通知回调 /// 用于展示对方输入状态 /// - Parameter customNotifications: 自定义系统通知 - public func onReceiveCustomNotifications(_ customNotifications: [V2NIMCustomNotification]) { + open func onReceiveCustomNotifications(_ customNotifications: [V2NIMCustomNotification]) { NEALog.infoLog( ModuleName + " " + className(), desc: #function + ", customNotifications.count:\(customNotifications.count)" diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/ViewModel/PinMessageViewModel.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/ViewModel/PinMessageViewModel.swift index 803ddaf7..3857e21d 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/ViewModel/PinMessageViewModel.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/ViewModel/PinMessageViewModel.swift @@ -202,13 +202,13 @@ open class PinMessageViewModel: NSObject, NEChatListener { /// 收到消息撤回回调 /// - Parameter revokeNotifications: 消息撤回通知数据 - public func onMessageRevokeNotifications(_ revokeNotifications: [V2NIMMessageRevokeNotification]) { + open func onMessageRevokeNotifications(_ revokeNotifications: [V2NIMMessageRevokeNotification]) { delegate?.tableViewReload(needLoad: true) } /// 消息pin状态回调通知 /// - Parameter pinNotification: 消息pin状态变化通知数据 - public func onMessagePinNotification(_ pinNotification: V2NIMMessagePinNotification) { + open func onMessagePinNotification(_ pinNotification: V2NIMMessagePinNotification) { switch pinNotification.pinState { case .MESSAGE_PIN_STEATE_NOT_PINNED: let messageRefer = pinNotification.pin?.messageRefer @@ -224,7 +224,7 @@ open class PinMessageViewModel: NSObject, NEChatListener { /// 消息被删除通知 /// - Parameter messageDeletedNotification: 被删除的消息列表 - public func onMessageDeletedNotifications(_ messageDeletedNotification: [V2NIMMessageDeletedNotification]) { + open func onMessageDeletedNotifications(_ messageDeletedNotification: [V2NIMMessageDeletedNotification]) { let messageRefers = messageDeletedNotification.map(\.messageRefer) onDeleteIndexPath(messageRefers) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/ViewModel/ReadViewModel.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/ViewModel/ReadViewModel.swift index 1bd8d32d..784e20de 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/ViewModel/ReadViewModel.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/ViewModel/ReadViewModel.swift @@ -22,7 +22,7 @@ open class ReadViewModel: NSObject { /// - message: 群消息 /// - teamId: 群 id /// - completion: 完成回调 - public func getTeamMessageReceiptDetail(_ message: V2NIMMessage, _ teamId: String, _ completion: @escaping (Error?) -> Void) { + open func getTeamMessageReceiptDetail(_ message: V2NIMMessage, _ teamId: String, _ completion: @escaping (Error?) -> Void) { chatRepo.getTeamMessageReceiptDetail(message: message, memberAccountIds: []) { [weak self] readReceiptDetail, error in guard let readReceiptDetail = readReceiptDetail else { completion(error) diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/ViewModel/TeamChatViewModel.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/ViewModel/TeamChatViewModel.swift index fd4bc1bc..b90296f8 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/ViewModel/TeamChatViewModel.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/ViewModel/TeamChatViewModel.swift @@ -22,11 +22,11 @@ open class TeamChatViewModel: ChatViewModel, NETeamListener { /// 当前成员的群成员对象类 public var teamMember: V2NIMTeamMember? - override init(conversationId: String) { + override public init(conversationId: String) { super.init(conversationId: conversationId) } - override init(conversationId: String, anchor: V2NIMMessage?) { + override public init(conversationId: String, anchor: V2NIMMessage?) { super.init(conversationId: conversationId, anchor: anchor) } @@ -278,7 +278,7 @@ open class TeamChatViewModel: ChatViewModel, NETeamListener { } /// 获取自己的群成员信息 - public func getTeamMember(_ completion: @escaping () -> Void) { + open func getTeamMember(_ completion: @escaping () -> Void) { if let teamMember = NETeamUserManager.shared.getTeamMemberInfo(IMKitClient.instance.account()) { self.teamMember = teamMember completion() @@ -372,7 +372,7 @@ open class TeamChatViewModel: ChatViewModel, NETeamListener { // MARK: - NETeamListener - public func onTeamDismissed(_ team: V2NIMTeam) { + open func onTeamDismissed(_ team: V2NIMTeam) { NEALog.infoLog(ModuleName + " " + className(), desc: #function + ", teamId: " + (team.teamId)) if sessionId == team.teamId { if let delegate = delegate as? TeamChatViewModelDelegate { @@ -387,7 +387,7 @@ open class TeamChatViewModel: ChatViewModel, NETeamListener { extension TeamChatViewModel: NETeamChatUserCacheListener { /// 群信息更新 /// - Parameter teamId: 群 id - public func onTeamInfoUpdate(_ teamId: String) { + open func onTeamInfoUpdate(_ teamId: String) { guard let team = NETeamUserManager.shared.getTeamInfo(), team.teamId == sessionId else { return } self.team = team @@ -400,7 +400,7 @@ extension TeamChatViewModel: NETeamChatUserCacheListener { /// 群成员更新 /// - Parameter accountId: 用户 id - public func onTeamMemberUpdate(_ accountId: String) { + open func onTeamMemberUpdate(_ accountId: String) { guard let teamMember = NETeamUserManager.shared.getTeamMemberInfo(accountId) else { return } if self.teamMember == nil || accountId == self.teamMember?.accountId { @@ -421,7 +421,7 @@ extension TeamChatViewModel: NETeamChatUserCacheListener { extension TeamChatViewModel: NEIMKitClientListener { /// 登录连接状态回调 /// - Parameter status: 连接状态 - public func onDataSync(_ type: V2NIMDataSyncType, state: V2NIMDataSyncState, error: V2NIMError?) { + open func onDataSync(_ type: V2NIMDataSyncType, state: V2NIMDataSyncState, error: V2NIMError?) { // 断网重连后,重新拉取群信息、自己的群成员信息 if type == .DATA_SYNC_TYPE_TEAM_MEMBER, state == .DATA_SYNC_STATE_COMPLETED { getTeamInfo(teamId: sessionId) { [weak self] error, team in diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/ViewModel/UserSettingViewModel.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/ViewModel/UserSettingViewModel.swift index 3120c258..7e890cc5 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/ViewModel/UserSettingViewModel.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/ViewModel/UserSettingViewModel.swift @@ -215,7 +215,7 @@ open class UserSettingViewModel: NSObject, NEConversationListener, AIUserPinList /// 会话变更回调 /// - Parameter conversations: 会话列表 - public func onConversationChanged(_ conversations: [V2NIMConversation]) { + open func onConversationChanged(_ conversations: [V2NIMConversation]) { for changeConversation in conversations { if let currentConversation = conversation, currentConversation.conversationId == changeConversation.conversationId { conversation = changeConversation @@ -226,7 +226,7 @@ open class UserSettingViewModel: NSObject, NEConversationListener, AIUserPinList } } - public func userInfoDidChange() { + open func userInfoDidChange() { getSectionDatas() delegate?.didNeedRefreshUI() } diff --git a/NEChatUIKit/NEChatUIKit/Classes/ChatConfig/ChatUIConfig.swift b/NEChatUIKit/NEChatUIKit/Classes/ChatConfig/ChatUIConfig.swift index 2f8c067f..3c324044 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/ChatConfig/ChatUIConfig.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/ChatConfig/ChatUIConfig.swift @@ -58,14 +58,14 @@ public class ChatUIConfig: NSObject { /// 设置消息可撤回时间 (单位:min) /// 周期为[2, 7*24*60] 分钟, 超过最大值, 修正为最大值, 最小值修正到2分钟 - public func setRevokeTimeGap(_ time: Int) { + open func setRevokeTimeGap(_ time: Int) { revokeTimeGap = max(time, 2) // >= 2 min revokeTimeGap = min(revokeTimeGap, 10080) // <= 7 d } /// 获取消息可撤回时间 (单位:min) /// 周期为[2, 7*24*60] 分钟 - public func getReeditTimeGap() -> Int { + open func getReeditTimeGap() -> Int { revokeTimeGap } } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Common/ChatConstant.swift b/NEChatUIKit/NEChatUIKit/Classes/Common/ChatConstant.swift index f4af75dc..315b06b7 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Common/ChatConstant.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Common/ChatConstant.swift @@ -63,9 +63,9 @@ public let ModuleName = "NEChatUIKit" // module 模块名称,用于日志输 // 支持的音频格式 public let file_audio_support: [String] = ["mp3", "aac", "wav", "wma", "flac"] // 支持的视频格式 -public let file_vedio_support: [String] = ["mp4", "avi", "wmv", "mpeg", "m4v", "mov", "asf", "flv", "f4v", "rmvb", "rm", "3gp"] +public let file_video_support: [String] = ["mp4", "avi", "wmv", "mpeg", "m4v", "mov", "asf", "flv", "f4v", "rmvb", "rm", "3gp"] // 支持的图片格式 -public let file_img_support: [String] = ["jpg", "jpeg", "png", "tiff", "heic"] +public let file_img_support: [String] = ["jpg", "jpeg", "png", "tiff", "heic", "gif"] // 支持的表格格式 public let file_xls_support: [String] = ["xls", "xlsx", "csv"] // 支持的文档格式 diff --git a/NEChatUIKit/NEChatUIKit/Classes/Common/NEChatUIKitClient.swift b/NEChatUIKit/NEChatUIKit/Classes/Common/NEChatUIKitClient.swift index 47e42289..578b1a08 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Common/NEChatUIKitClient.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Common/NEChatUIKitClient.swift @@ -14,7 +14,7 @@ open class NEChatUIKitClient: NSObject { private var customRegisterDic = [String: UITableViewCell.Type]() public var moreAction = [NEMoreItemModel]() - override init() { + override public init() { let photo = NEMoreItemModel() photo.image = UIImage.ne_imageNamed(name: "fun_chat_photo") photo.title = chatLocalizable("chat_photo") diff --git a/NEChatUIKit/NEChatUIKit/Classes/Common/NETranslateLanguageManager.swift b/NEChatUIKit/NEChatUIKit/Classes/Common/NETranslateLanguageManager.swift index f9fa88a3..e059ca61 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Common/NETranslateLanguageManager.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Common/NETranslateLanguageManager.swift @@ -20,7 +20,7 @@ open class NETranslateLanguageManager: NSObject { // var translationAIUser: V2NIMAIUser? -// public func getTranslationAIUser(_ completion: @escaping (V2NIMAIUser?) -> Void) { +// open func getTranslationAIUser(_ completion: @escaping (V2NIMAIUser?) -> Void) { // if translateAIUserAccountId.count <= 0 { // completion(nil) // } diff --git a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageAudioCell.swift b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageAudioCell.swift index 5d992bdf..305d9897 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageAudioCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageAudioCell.swift @@ -19,7 +19,7 @@ class FunCollectionMessageAudioCell: NEBaseCollectionMessageAudioCell { } /// 初始化的生命周期 - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageDefaultCell.swift b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageDefaultCell.swift index 8f687685..7da20e1c 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageDefaultCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageDefaultCell.swift @@ -19,7 +19,7 @@ class FunCollectionMessageDefaultCell: NEBaseCollectionMessageDefaultCell { } /// 初始化的生命周期 - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageFileCell.swift b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageFileCell.swift index 21d6ab6d..cefada44 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageFileCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageFileCell.swift @@ -19,7 +19,7 @@ class FunCollectionMessageFileCell: NEBaseCollectionMessageFileCell { } /// 初始化的生命周期 - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageImageCell.swift b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageImageCell.swift index 57abf5e9..ed4f9943 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageImageCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageImageCell.swift @@ -19,7 +19,7 @@ class FunCollectionMessageImageCell: NEBaseCollectionMessageImageCell { } /// 初始化的生命周期 - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageLocationCell.swift b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageLocationCell.swift index 029e7b11..6e8ecac3 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageLocationCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageLocationCell.swift @@ -19,7 +19,7 @@ class FunCollectionMessageLocationCell: NEBaseCollectionMessageLocationCell { } /// 初始化的生命周期 - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageMultiForwardCell.swift b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageMultiForwardCell.swift index 6588ac60..f7b13721 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageMultiForwardCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageMultiForwardCell.swift @@ -19,7 +19,7 @@ class FunCollectionMessageMultiForwardCell: NEBaseCollectionMessageMultiForwardC } /// 初始化的生命周期 - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageRichTextCell.swift b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageRichTextCell.swift index b8f99736..683e28c4 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageRichTextCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageRichTextCell.swift @@ -19,7 +19,7 @@ class FunCollectionMessageRichTextCell: NEBaseCollectionMessageRichTextCell { } /// 初始化的生命周期 - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageTextCell.swift b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageTextCell.swift index b09eeeb0..72908c10 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageTextCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageTextCell.swift @@ -19,7 +19,7 @@ class FunCollectionMessageTextCell: NEBaseCollectionMessageTextCell { } /// 初始化的生命周期 - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageVideoCell.swift b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageVideoCell.swift index 180a6766..f3328068 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageVideoCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/CollectionCell/FunCollectionMessageVideoCell.swift @@ -19,7 +19,7 @@ class FunCollectionMessageVideoCell: NEBaseCollectionMessageVideoCell { } /// 初始化的生命周期 - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/FunChatMessageCallCell.swift b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/FunChatMessageCallCell.swift index d3170224..cfd7a12f 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/FunChatMessageCallCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/FunChatMessageCallCell.swift @@ -8,7 +8,7 @@ import UIKit open class FunChatMessageCallCell: FunChatMessageBaseCell { public let contentLabelLeft = UILabel() public let contentLabelRight = UILabel() - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) commonUI() } diff --git a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/FunChatMessageFileCell.swift b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/FunChatMessageFileCell.swift index 6c5024c6..d99f47d2 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/FunChatMessageFileCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/FunChatMessageFileCell.swift @@ -244,7 +244,10 @@ open class FunChatMessageFileCell: FunChatMessageBaseCell { } } var imageName = "file_unknown" - let suffix = (fileObject.name as NSString).pathExtension.lowercased() + var suffix = (fileObject.name as NSString).pathExtension.lowercased() + if suffix.isEmpty, let ext = fileObject.ext { + suffix = ext[(ext.index(after: ext.startIndex)) ..< ext.endIndex].lowercased() + } switch suffix { case file_doc_support: imageName = "file_doc" @@ -258,7 +261,7 @@ open class FunChatMessageFileCell: FunChatMessageBaseCell { imageName = "file_txt" case file_audio_support: imageName = "file_audio" - case file_vedio_support: + case file_video_support: imageName = "file_vedio" case file_zip_support: imageName = "file_zip" @@ -276,16 +279,16 @@ open class FunChatMessageFileCell: FunChatMessageBaseCell { titleLabel.text = fileObject.name let size_B = Double(fileObject.size) - var size_str = String(format: "%.1f B", size_B) + var size_str = String(format: "%.2f B", size_B) if size_B > 1e3 { let size_KB = size_B / 1e3 - size_str = String(format: "%.1f KB", size_KB) + size_str = String(format: "%.2f KB", size_KB) if size_KB > 1e3 { let size_MB = size_KB / 1e3 - size_str = String(format: "%.1f MB", size_MB) + size_str = String(format: "%.2f MB", size_MB) if size_MB > 1e3 { let size_GB = size_KB / 1e6 - size_str = String(format: "%.1f GB", size_GB) + size_str = String(format: "%.2f GB", size_GB) } } } diff --git a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/FunChatMessageRevokeCell.swift b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/FunChatMessageRevokeCell.swift index 9d0e274b..ee5d2ddd 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/FunChatMessageRevokeCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/FunChatMessageRevokeCell.swift @@ -6,8 +6,27 @@ import UIKit @objcMembers open class FunChatMessageRevokeCell: FunChatMessageBaseCell { - public var revokeLabelLeft = UILabel() - public var revokeLabelRight = UILabel() + public lazy var revokeLabelLeft: UILabel = { + let label = UILabel() + label.translatesAutoresizingMaskIntoConstraints = false + label.textColor = UIColor.ne_greyText + label.textAlignment = .center + label.lineBreakMode = .byTruncatingMiddle + label.font = UIFont.systemFont(ofSize: 14.0) + label.accessibilityIdentifier = "id.messageText" + return label + }() + + public lazy var revokeLabelRight: UILabel = { + let label = UILabel() + label.translatesAutoresizingMaskIntoConstraints = false + label.textColor = UIColor.ne_greyText + label.textAlignment = .center + label.font = UIFont.systemFont(ofSize: 14.0) + label.accessibilityIdentifier = "id.messageText" + return label + }() + public var reeditButton = UIButton(type: .custom) var revokeLabelRightXAnchor: NSLayoutConstraint? @@ -21,12 +40,6 @@ open class FunChatMessageRevokeCell: FunChatMessageBaseCell { override open func commonUILeft() { super.commonUILeft() - revokeLabelLeft.translatesAutoresizingMaskIntoConstraints = false - revokeLabelLeft.textColor = UIColor.ne_greyText - revokeLabelLeft.textAlignment = .center - revokeLabelLeft.lineBreakMode = .byTruncatingMiddle - revokeLabelLeft.font = UIFont.systemFont(ofSize: 14.0) - revokeLabelLeft.accessibilityIdentifier = "id.messageText" contentView.addSubview(revokeLabelLeft) NSLayoutConstraint.activate([ revokeLabelLeft.leftAnchor.constraint(equalTo: contentView.leftAnchor, constant: 16), @@ -38,11 +51,6 @@ open class FunChatMessageRevokeCell: FunChatMessageBaseCell { override open func commonUIRight() { super.commonUIRight() - revokeLabelRight.translatesAutoresizingMaskIntoConstraints = false - revokeLabelRight.textColor = UIColor.ne_greyText - revokeLabelRight.textAlignment = .center - revokeLabelRight.font = UIFont.systemFont(ofSize: 14.0) - revokeLabelRight.accessibilityIdentifier = "id.messageText" contentView.addSubview(revokeLabelRight) revokeLabelRightXAnchor = revokeLabelRight.centerXAnchor.constraint(equalTo: contentView.centerXAnchor, constant: 0) revokeLabelRightXAnchor?.isActive = true diff --git a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/FunChatMessageTextCell.swift b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/FunChatMessageTextCell.swift index e3344e11..63412dbf 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/FunChatMessageTextCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/FunChatMessageTextCell.swift @@ -184,7 +184,7 @@ extension FunChatMessageTextCell: UITextViewDelegate { /// 选中范围变更 /// - Parameter textView: textview - public func textViewDidChangeSelection(_ textView: UITextView) { + open func textViewDidChangeSelection(_ textView: UITextView) { if textView.selectedRange.length == 0 { delegate?.didTextViewLoseFocus?(self, contentModel) } else { @@ -215,7 +215,7 @@ extension FunChatMessageTextCell: UITextViewDelegate { } // 禁用长按图片突出显示 - public func textView(_ textView: UITextView, shouldInteractWith textAttachment: NSTextAttachment, in characterRange: NSRange) -> Bool { + open func textView(_ textView: UITextView, shouldInteractWith textAttachment: NSTextAttachment, in characterRange: NSRange) -> Bool { selectAllRange() return false } diff --git a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunP2PChatViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunP2PChatViewController.swift index da376001..8a901a93 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunP2PChatViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunP2PChatViewController.swift @@ -113,7 +113,7 @@ open class FunP2PChatViewController: FunChatViewController { extension FunP2PChatViewController: NEContactListener { /// 好友信息缓存更新 /// - Parameter accountId: 用户 id - public func onContactChange(_ changeType: NEContactChangeType, _ contacts: [NEUserWithFriend]) { + open func onContactChange(_ changeType: NEContactChangeType, _ contacts: [NEUserWithFriend]) { for contact in contacts { if let accid = contact.user?.accountId, contact.user?.accountId == viewModel.sessionId { // 好友添加,则从 NEP2PChatUserCache 中移除信息缓存 @@ -137,7 +137,7 @@ extension FunP2PChatViewController: NEContactListener { extension FunP2PChatViewController: NEP2PChatUserCacheListener { /// 非好友单聊信息缓存更新 /// - Parameter accountId: 用户 id - public func onUserInfoUpdate(_ accountId: String) { + open func onUserInfoUpdate(_ accountId: String) { onUserOrFriendInfoChanged(accountId) } } diff --git a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunSelectLanguageViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunSelectLanguageViewController.swift index ea63cf33..5bdb4710 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunSelectLanguageViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunSelectLanguageViewController.swift @@ -24,23 +24,12 @@ open class FunSelectLanguageViewController: NEBaseSelectLanguageViewController { funBackButton.setImage(UIImage.ne_imageNamed(name: "arrowDown"), for: .normal) funBackButton.addTarget(self, action: #selector(cancelClick), for: .touchUpInside) view.addSubview(funBackButton) - - if #available(iOS 11.0, *) { - NSLayoutConstraint.activate([ - funBackButton.leadingAnchor.constraint(equalTo: self.view.leadingAnchor, constant: 16), - funBackButton.topAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.topAnchor), - funBackButton.widthAnchor.constraint(equalToConstant: 50), - funBackButton.heightAnchor.constraint(equalToConstant: 50), - ]) - } else { - // Fallback on earlier versions - NSLayoutConstraint.activate([ - funBackButton.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 16), - funBackButton.topAnchor.constraint(equalTo: view.topAnchor), - funBackButton.widthAnchor.constraint(equalToConstant: 50), - funBackButton.heightAnchor.constraint(equalToConstant: 50), - ]) - } + NSLayoutConstraint.activate([ + funBackButton.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 16), + funBackButton.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor), + funBackButton.widthAnchor.constraint(equalToConstant: 50), + funBackButton.heightAnchor.constraint(equalToConstant: 50), + ]) let funNavTitleLabel = UILabel() funNavTitleLabel.translatesAutoresizingMaskIntoConstraints = false diff --git a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunSelectUserViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunSelectUserViewController.swift index e3e5a306..120f2a29 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunSelectUserViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunSelectUserViewController.swift @@ -9,7 +9,7 @@ import UIKit @objcMembers open class FunSelectUserViewController: NEBaseSelectUserViewController { - override init(conversationId: String, showSelf: Bool = true, showTeamMembers: Bool = false) { + override public init(conversationId: String, showSelf: Bool = true, showTeamMembers: Bool = false) { super.init(conversationId: conversationId, showSelf: showSelf, showTeamMembers: showTeamMembers) className = "FunSelectUserViewController" } diff --git a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunTeamChatViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunTeamChatViewController.swift index 55dcf4e3..f8eb0cc9 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunTeamChatViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunTeamChatViewController.swift @@ -25,6 +25,8 @@ open class FunTeamChatViewController: FunChatViewController, TeamChatViewModelDe public init(sessionId: String) { let conversationId = V2NIMConversationIdUtil.teamConversationId(sessionId) ?? "" super.init(conversationId: conversationId) + viewModel = TeamChatViewModel(conversationId: conversationId, anchor: nil) + viewModel.delegate = self } public required init?(coder: NSCoder) { @@ -213,13 +215,13 @@ open class FunTeamChatViewController: FunChatViewController, TeamChatViewModelDe /// 群聊更新回调 /// - Parameter team: 群聊 - public func onTeamUpdate(team: V2NIMTeam) { + open func onTeamUpdate(team: V2NIMTeam) { updateTeamInfo(team: team) } /// 群成员更新回调 /// - Parameter teamMembers: 群成员列表 - public func onTeamMemberUpdate(_ teamMembers: [V2NIMTeamMember]) { + open func onTeamMemberUpdate(_ teamMembers: [V2NIMTeamMember]) { if let team = NETeamUserManager.shared.getTeamInfo() { setMute(team: team) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/FunUI/View/FunRecordAudioView.swift b/NEChatUIKit/NEChatUIKit/Classes/FunUI/View/FunRecordAudioView.swift index 1f929361..1c08d743 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/FunUI/View/FunRecordAudioView.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/FunUI/View/FunRecordAudioView.swift @@ -112,7 +112,7 @@ open class FunRecordAudioView: UIView { private var progressWidthConstraint: NSLayoutConstraint? - override init(frame: CGRect) { + override public init(frame: CGRect) { super.init(frame: frame) setupUI() } diff --git a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/ChatMessageCallCell.swift b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/ChatMessageCallCell.swift index 07d5208b..ec92a62d 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/ChatMessageCallCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/ChatMessageCallCell.swift @@ -32,7 +32,7 @@ open class ChatMessageCallCell: NormalChatMessageBaseCell { return label }() - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/ChatMessageFileCell.swift b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/ChatMessageFileCell.swift index d559210b..8ba77977 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/ChatMessageFileCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/ChatMessageFileCell.swift @@ -267,7 +267,10 @@ open class ChatMessageFileCell: NormalChatMessageBaseCell { } } var imageName = "file_unknown" - let suffix = (fileObject.name as NSString).pathExtension.lowercased() + var suffix = (fileObject.name as NSString).pathExtension.lowercased() + if suffix.isEmpty, let ext = fileObject.ext { + suffix = ext[(ext.index(after: ext.startIndex)) ..< ext.endIndex].lowercased() + } switch suffix { case file_doc_support: imageName = "file_doc" @@ -281,7 +284,7 @@ open class ChatMessageFileCell: NormalChatMessageBaseCell { imageName = "file_txt" case file_audio_support: imageName = "file_audio" - case file_vedio_support: + case file_video_support: imageName = "file_vedio" case file_zip_support: imageName = "file_zip" @@ -299,16 +302,16 @@ open class ChatMessageFileCell: NormalChatMessageBaseCell { titleLabel.text = fileObject.name let size_B = Double(fileObject.size) - var size_str = String(format: "%.1f B", size_B) + var size_str = String(format: "%.2f B", size_B) if size_B > 1e3 { let size_KB = size_B / 1e3 - size_str = String(format: "%.1f KB", size_KB) + size_str = String(format: "%.2f KB", size_KB) if size_KB > 1e3 { let size_MB = size_KB / 1e3 - size_str = String(format: "%.1f MB", size_MB) + size_str = String(format: "%.2f MB", size_MB) if size_MB > 1e3 { let size_GB = size_KB / 1e6 - size_str = String(format: "%.1f GB", size_GB) + size_str = String(format: "%.2f GB", size_GB) } } } diff --git a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/ChatMessageRevokeCell.swift b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/ChatMessageRevokeCell.swift index 47533307..6678a11b 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/ChatMessageRevokeCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/ChatMessageRevokeCell.swift @@ -7,8 +7,26 @@ import UIKit @objcMembers open class ChatMessageRevokeCell: NormalChatMessageBaseCell { - public var revokeLabelLeft = UILabel() - public var revokeLabelRight = UILabel() + public lazy var revokeLabelLeft: UILabel = { + let label = UILabel() + label.translatesAutoresizingMaskIntoConstraints = false + label.text = chatLocalizable("message_recalled") + label.textColor = UIColor.ne_greyText + label.font = UIFont.systemFont(ofSize: 16.0) + label.accessibilityIdentifier = "id.messageText" + return label + }() + + public lazy var revokeLabelRight: UILabel = { + let label = UILabel() + label.translatesAutoresizingMaskIntoConstraints = false + label.text = chatLocalizable("message_recalled") + label.textColor = UIColor.ne_greyText + label.font = UIFont.systemFont(ofSize: 16.0) + label.accessibilityIdentifier = "id.messageText" + return label + }() + public var reeditButton = UIButton(type: .custom) public var reeditButtonW: NSLayoutConstraint? override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { @@ -21,10 +39,6 @@ open class ChatMessageRevokeCell: NormalChatMessageBaseCell { } override open func commonUILeft() { - revokeLabelLeft.translatesAutoresizingMaskIntoConstraints = false - revokeLabelLeft.textColor = UIColor.ne_greyText - revokeLabelLeft.font = UIFont.systemFont(ofSize: 16.0) - revokeLabelLeft.accessibilityIdentifier = "id.messageText" bubbleImageLeft.addSubview(revokeLabelLeft) NSLayoutConstraint.activate([ revokeLabelLeft.leftAnchor.constraint(equalTo: bubbleImageLeft.leftAnchor, constant: 16), @@ -35,10 +49,6 @@ open class ChatMessageRevokeCell: NormalChatMessageBaseCell { } override open func commonUIRight() { - revokeLabelRight.translatesAutoresizingMaskIntoConstraints = false - revokeLabelRight.textColor = UIColor.ne_greyText - revokeLabelRight.font = UIFont.systemFont(ofSize: 16.0) - revokeLabelRight.accessibilityIdentifier = "id.messageText" bubbleImageRight.addSubview(revokeLabelRight) NSLayoutConstraint.activate([ revokeLabelRight.leftAnchor.constraint(equalTo: bubbleImageRight.leftAnchor, constant: 16), @@ -107,8 +117,6 @@ open class ChatMessageRevokeCell: NormalChatMessageBaseCell { } super.setModel(model, isSend) - let revokeLabel = isSend ? revokeLabelRight : revokeLabelLeft - revokeLabel.text = chatLocalizable("message_recalled") } func reeditEvent(button: UIButton) { diff --git a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/ChatMessageTextCell.swift b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/ChatMessageTextCell.swift index 5a0e21be..6b6fe389 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/ChatMessageTextCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/ChatMessageTextCell.swift @@ -189,7 +189,7 @@ extension ChatMessageTextCell: UITextViewDelegate { /// 选中范围变更 /// - Parameter textView: textview - public func textViewDidChangeSelection(_ textView: UITextView) { + open func textViewDidChangeSelection(_ textView: UITextView) { if textView.selectedRange.length == 0 { delegate?.didTextViewLoseFocus?(self, contentModel) } else { @@ -214,7 +214,7 @@ extension ChatMessageTextCell: UITextViewDelegate { } // 禁用长按图片突出显示 - public func textView(_ textView: UITextView, shouldInteractWith textAttachment: NSTextAttachment, in characterRange: NSRange) -> Bool { + open func textView(_ textView: UITextView, shouldInteractWith textAttachment: NSTextAttachment, in characterRange: NSRange) -> Bool { selectAllRange() return false } diff --git a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageAudioCell.swift b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageAudioCell.swift index 26084b66..636bb8bb 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageAudioCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageAudioCell.swift @@ -19,7 +19,7 @@ class CollectionMessageAudioCell: NEBaseCollectionMessageAudioCell { } /// 初始化的生命周期 - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageDefaultCell.swift b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageDefaultCell.swift index 23a5b109..43524c53 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageDefaultCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageDefaultCell.swift @@ -19,7 +19,7 @@ class CollectionMessageDefaultCell: NEBaseCollectionMessageDefaultCell { } /// 初始化的生命周期 - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageFileCell.swift b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageFileCell.swift index d777556d..bd877859 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageFileCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageFileCell.swift @@ -19,7 +19,7 @@ class CollectionMessageFileCell: NEBaseCollectionMessageFileCell { } /// 初始化的生命周期 - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageImageCell.swift b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageImageCell.swift index 1eeb9291..08b9ac65 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageImageCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageImageCell.swift @@ -19,7 +19,7 @@ class CollectionMessageImageCell: NEBaseCollectionMessageImageCell { } /// 初始化的生命周期 - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageLocationCell.swift b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageLocationCell.swift index b8b684b2..7000c629 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageLocationCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageLocationCell.swift @@ -19,7 +19,7 @@ class CollectionMessageLocationCell: NEBaseCollectionMessageLocationCell { } /// 初始化的生命周期 - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageMultiForwardCell.swift b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageMultiForwardCell.swift index b6e9a1a1..b73db796 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageMultiForwardCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageMultiForwardCell.swift @@ -19,7 +19,7 @@ class CollectionMessageMultiForwardCell: NEBaseCollectionMessageMultiForwardCell } /// 初始化的生命周期 - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageRichTextCell.swift b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageRichTextCell.swift index 612b4ad5..0b24ba2b 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageRichTextCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageRichTextCell.swift @@ -19,7 +19,7 @@ class CollectionMessageRichTextCell: NEBaseCollectionMessageRichTextCell { } /// 初始化的生命周期 - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageTextCell.swift b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageTextCell.swift index be3632d1..74457906 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageTextCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageTextCell.swift @@ -19,7 +19,7 @@ class CollectionMessageTextCell: NEBaseCollectionMessageTextCell { } /// 初始化的生命周期 - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageVideoCell.swift b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageVideoCell.swift index 67eb1a55..93ecdae6 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageVideoCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/CollectionCell/CollectionMessageVideoCell.swift @@ -19,7 +19,7 @@ class CollectionMessageVideoCell: NEBaseCollectionMessageVideoCell { } /// 初始化的生命周期 - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/P2PChatViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/P2PChatViewController.swift index 231ee075..ecc1930e 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/P2PChatViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/P2PChatViewController.swift @@ -118,7 +118,7 @@ open class P2PChatViewController: NormalChatViewController { extension P2PChatViewController: NEContactListener { /// 好友信息缓存更新 /// - Parameter accountId: 用户 id - public func onContactChange(_ changeType: NEContactChangeType, _ contacts: [NEUserWithFriend]) { + open func onContactChange(_ changeType: NEContactChangeType, _ contacts: [NEUserWithFriend]) { for contact in contacts { if let accid = contact.user?.accountId, contact.user?.accountId == viewModel.sessionId { // 好友添加,则从 NEP2PChatUserCache 中移除信息缓存 @@ -142,7 +142,7 @@ extension P2PChatViewController: NEContactListener { extension P2PChatViewController: NEP2PChatUserCacheListener { /// 非好友单聊信息缓存更新 /// - Parameter accountId: 用户 id - public func onUserInfoUpdate(_ accountId: String) { + open func onUserInfoUpdate(_ accountId: String) { onUserOrFriendInfoChanged(accountId) } } diff --git a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/ReadViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/ReadViewController.swift index 971b1c90..a19fdfe5 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/ReadViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/ReadViewController.swift @@ -10,7 +10,7 @@ import UIKit @objcMembers open class ReadViewController: NEBaseReadViewController { - override init(message: V2NIMMessage, teamId: String) { + override public init(message: V2NIMMessage, teamId: String) { super.init(message: message, teamId: teamId) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/SelectLanguageViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/SelectLanguageViewController.swift index 216e59f6..326d2684 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/SelectLanguageViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/SelectLanguageViewController.swift @@ -25,22 +25,12 @@ open class SelectLanguageViewController: NEBaseSelectLanguageViewController { backButton.titleLabel?.textColor = .ne_greyText backButton.titleLabel?.font = UIFont.systemFont(ofSize: 18.0) view.addSubview(backButton) - - if #available(iOS 11.0, *) { - NSLayoutConstraint.activate([ - backButton.leadingAnchor.constraint(equalTo: self.view.leadingAnchor, constant: 16), - backButton.topAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.topAnchor), - backButton.widthAnchor.constraint(equalToConstant: 50), - backButton.heightAnchor.constraint(equalToConstant: 50), - ]) - } else { - NSLayoutConstraint.activate([ - backButton.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 16), - backButton.topAnchor.constraint(equalTo: view.topAnchor), - backButton.widthAnchor.constraint(equalToConstant: 50), - backButton.heightAnchor.constraint(equalToConstant: 50), - ]) - } + NSLayoutConstraint.activate([ + backButton.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 16), + backButton.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor), + backButton.widthAnchor.constraint(equalToConstant: 50), + backButton.heightAnchor.constraint(equalToConstant: 50), + ]) let navTitleLabel = UILabel() navTitleLabel.translatesAutoresizingMaskIntoConstraints = false diff --git a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/SelectUserViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/SelectUserViewController.swift index c8201851..9fb3d904 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/SelectUserViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/SelectUserViewController.swift @@ -9,7 +9,7 @@ import UIKit @objcMembers open class SelectUserViewController: NEBaseSelectUserViewController { - override init(conversationId: String, showSelf: Bool = true, showTeamMembers: Bool = false) { + override public init(conversationId: String, showSelf: Bool = true, showTeamMembers: Bool = false) { super.init(conversationId: conversationId, showSelf: showSelf, showTeamMembers: showTeamMembers) className = "SelectUserViewController" } diff --git a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/TeamChatViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/TeamChatViewController.swift index a27b5469..8d072c06 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/TeamChatViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/TeamChatViewController.swift @@ -27,6 +27,8 @@ open class TeamChatViewController: NormalChatViewController, TeamChatViewModelDe public init(sessionId: String) { let conversationId = V2NIMConversationIdUtil.teamConversationId(sessionId) ?? "" super.init(conversationId: conversationId) + viewModel = TeamChatViewModel(conversationId: conversationId, anchor: nil) + viewModel.delegate = self } public required init?(coder: NSCoder) { @@ -215,13 +217,13 @@ open class TeamChatViewController: NormalChatViewController, TeamChatViewModelDe /// 群聊更新回调 /// - Parameter team: 群聊 - public func onTeamUpdate(team: V2NIMTeam) { + open func onTeamUpdate(team: V2NIMTeam) { updateTeamInfo(team: team) } /// 群成员更新回调 /// - Parameter teamMembers: 群成员列表 - public func onTeamMemberUpdate(_ teamMembers: [V2NIMTeamMember]) { + open func onTeamMemberUpdate(_ teamMembers: [V2NIMTeamMember]) { if let team = NETeamUserManager.shared.getTeamInfo() { setMute(team: team) } diff --git a/NEContactUIKit/NEContactUIKit.podspec b/NEContactUIKit/NEContactUIKit.podspec index 064ab96b..87e11841 100644 --- a/NEContactUIKit/NEContactUIKit.podspec +++ b/NEContactUIKit/NEContactUIKit.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'NEContactUIKit' - s.version = '10.5.0' + s.version = '10.5.1' s.summary = 'Netease XKit' # This description is used to generate tags and improve search results. @@ -33,6 +33,6 @@ Pod::Spec.new do |s| s.source_files = 'NEContactUIKit/Classes/**/*' s.resource = 'NEContactUIKit/Assets/**/*' s.dependency 'NEChatKit' - s.dependency 'NECommonUIKit', '9.7.4' + s.dependency 'NECommonUIKit' s.dependency 'MJRefresh' end diff --git a/NEContactUIKit/NEContactUIKit/Classes/AIRobot/AIUserViewModel.swift b/NEContactUIKit/NEContactUIKit/Classes/AIRobot/AIUserViewModel.swift index 93af2330..406ddfc9 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/AIRobot/AIUserViewModel.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/AIRobot/AIUserViewModel.swift @@ -14,7 +14,7 @@ open class AIUserViewModel: NSObject { var searchDatas = [NEAIUserModel]() /// 获取数字人 - public func getAIUsers(_ completion: @escaping (NSError?) -> Void) { + open func getAIUsers(_ completion: @escaping (NSError?) -> Void) { AIRepo.shared.getAIUserList { [weak self] users, error in users?.forEach { aiUser in let model = NEAIUserModel() diff --git a/NEContactUIKit/NEContactUIKit/Classes/AIRobot/NEBaseAIUserController.swift b/NEContactUIKit/NEContactUIKit/Classes/AIRobot/NEBaseAIUserController.swift index 6140ac91..5535ff30 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/AIRobot/NEBaseAIUserController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/AIRobot/NEBaseAIUserController.swift @@ -8,7 +8,7 @@ import NECoreKit import UIKit @objcMembers -open class NEBaseAIUserController: NEBaseViewController, UITableViewDelegate, UITableViewDataSource { +open class NEBaseAIUserController: NEContactBaseViewController, UITableViewDelegate, UITableViewDataSource { let viewModel = AIUserViewModel() /// 输入框 @@ -42,11 +42,10 @@ open class NEBaseAIUserController: NEBaseViewController, UITableViewDelegate, UI UIView(frame: CGRect(x: 0, y: 0, width: view.frame.size.width, height: 12)) tableView.keyboardDismissMode = .onDrag - if #available(iOS 11.0, *) { - tableView.estimatedRowHeight = 0 - tableView.estimatedSectionHeaderHeight = 0 - tableView.estimatedSectionFooterHeight = 0 - } + tableView.estimatedRowHeight = 0 + tableView.estimatedSectionHeaderHeight = 0 + tableView.estimatedSectionFooterHeight = 0 + if #available(iOS 15.0, *) { tableView.sectionHeaderTopPadding = 0.0 } @@ -159,7 +158,7 @@ open class NEBaseAIUserController: NEBaseViewController, UITableViewDelegate, UI 0 } - public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + open func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { let info = viewModel.datas[indexPath.row] Router.shared.use( ContactUserInfoPageRouter, diff --git a/NEContactUIKit/NEContactUIKit/Classes/AIRobot/NEBaseAIUserListCell.swift b/NEContactUIKit/NEContactUIKit/Classes/AIRobot/NEBaseAIUserListCell.swift index e100cbf3..76d970ce 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/AIRobot/NEBaseAIUserListCell.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/AIRobot/NEBaseAIUserListCell.swift @@ -31,7 +31,7 @@ open class NEBaseAIUserListCell: UITableViewCell { return label }() - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) selectionStyle = .none setupAIUserListCellUI() diff --git a/NEContactUIKit/NEContactUIKit/Classes/Base/NEContactLoaderService.swift b/NEContactUIKit/NEContactUIKit/Classes/Base/NEContactLoaderService.swift index 0595064d..6ce16b01 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Base/NEContactLoaderService.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Base/NEContactLoaderService.swift @@ -15,7 +15,7 @@ public class NEContactLoaderService: NSObject { /// 初始化方法 /// 此方法会在模块被加载时调用 - public func setupInit() { + open func setupInit() { ChatKitClient.shared.registerInit(NEContactService.shared) } } diff --git a/NEContactUIKit/NEContactUIKit/Classes/Base/NEContactService.swift b/NEContactUIKit/NEContactUIKit/Classes/Base/NEContactService.swift index 9d12f0e8..e790af40 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Base/NEContactService.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Base/NEContactService.swift @@ -15,13 +15,13 @@ public class NEContactService: NSObject, ChatServiceDelegate { /// 注册 NEContactUIKit 初始化协议 /// - Parameter params: 初始化参数 - public func setupInit(_ params: [String: Any]?) { + open func setupInit(_ params: [String: Any]?) { registerRouter(params) } /// 注册路由 /// - Parameter param: 参数 - public func registerRouter(_ param: [String: Any]?) { + open func registerRouter(_ param: [String: Any]?) { if let isFun = param?["isFun"] as? Bool, isFun { ContactRouter.registerFun() } else { diff --git a/NEContactUIKit/NEContactUIKit/Classes/BlackList/Cell/NEBaseBlackListCell.swift b/NEContactUIKit/NEContactUIKit/Classes/BlackList/Cell/NEBaseBlackListCell.swift index 58f4a143..fe52774f 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/BlackList/Cell/NEBaseBlackListCell.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/BlackList/Cell/NEBaseBlackListCell.swift @@ -24,7 +24,7 @@ open class NEBaseBlackListCell: NEBaseTeamTableViewCell { return view }() - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEContactUIKit/NEContactUIKit/Classes/BlackList/ViewController/NEBaseBlackListViewController.swift b/NEContactUIKit/NEContactUIKit/Classes/BlackList/ViewController/NEBaseBlackListViewController.swift index 5544b1c6..50d8e810 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/BlackList/ViewController/NEBaseBlackListViewController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/BlackList/ViewController/NEBaseBlackListViewController.swift @@ -40,11 +40,10 @@ open class NEBaseBlackListViewController: NEContactBaseViewController, UITableVi tableView.tableHeaderView = headView tableView.keyboardDismissMode = .onDrag - if #available(iOS 11.0, *) { - tableView.estimatedRowHeight = 0 - tableView.estimatedSectionHeaderHeight = 0 - tableView.estimatedSectionFooterHeight = 0 - } + tableView.estimatedRowHeight = 0 + tableView.estimatedSectionHeaderHeight = 0 + tableView.estimatedSectionFooterHeight = 0 + if #available(iOS 15.0, *) { tableView.sectionHeaderTopPadding = 0.0 } @@ -172,7 +171,7 @@ open class NEBaseBlackListViewController: NEContactBaseViewController, UITableVi // MARK: BlackListViewModelDelegate /// 重新加载表格 - public func tableViewReload() { + open func tableViewReload() { tableView.reloadData() } } diff --git a/NEContactUIKit/NEContactUIKit/Classes/BlackList/ViewModel/BlackListViewModel.swift b/NEContactUIKit/NEContactUIKit/Classes/BlackList/ViewModel/BlackListViewModel.swift index 7f835a16..ce0d23a5 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/BlackList/ViewModel/BlackListViewModel.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/BlackList/ViewModel/BlackListViewModel.swift @@ -17,7 +17,7 @@ open class BlackListViewModel: NSObject { public var blockList = [NEUserWithFriend]() public weak var delegate: BlackListViewModelDelegate? - override init() { + override public init() { super.init() NEALog.infoLog(ModuleName + " " + className(), desc: #function) contactRepo.addContactListener(self) @@ -83,7 +83,7 @@ open class BlackListViewModel: NSObject { extension BlackListViewModel: NEContactListener { /// 黑名单移除回调 (非好友) /// - Parameter accountId: 移除黑名单用户账号ID - public func onBlockListRemoved(_ accountId: String) { + open func onBlockListRemoved(_ accountId: String) { for (index, friendUser) in blockList.enumerated() { // 移除黑名单 if friendUser.user?.accountId == accountId { @@ -95,7 +95,7 @@ extension BlackListViewModel: NEContactListener { /// 好友信息缓存更新 /// - Parameter accountId: 用户 id - public func onContactChange(_ changeType: NEContactChangeType, _ contacts: [NEUserWithFriend]) { + open func onContactChange(_ changeType: NEContactChangeType, _ contacts: [NEUserWithFriend]) { for contact in contacts { // 添加黑名单 if changeType == .addBlock, diff --git a/NEContactUIKit/NEContactUIKit/Classes/FunUI/Cell/FunSelectedListCell.swift b/NEContactUIKit/NEContactUIKit/Classes/FunUI/Cell/FunSelectedListCell.swift index c485e9e1..e542a33a 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/FunUI/Cell/FunSelectedListCell.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/FunUI/Cell/FunSelectedListCell.swift @@ -10,7 +10,7 @@ import UIKit @objcMembers open class FunSelectedListCell: NEBaseSelectedListCell { /// 重写初始化方法 - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEContactUIKit/NEContactUIKit/Classes/FunUI/ViewController/FunContactSelectedViewController.swift b/NEContactUIKit/NEContactUIKit/Classes/FunUI/ViewController/FunContactSelectedViewController.swift index 9d128191..3c0a3e93 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/FunUI/ViewController/FunContactSelectedViewController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/FunUI/ViewController/FunContactSelectedViewController.swift @@ -9,7 +9,7 @@ import UIKit /// 人员选择页面 - 通用版 @objcMembers open class FunContactSelectedViewController: NEBaseContactSelectedViewController { - override init(filterUsers: Set? = nil) { + override public init(filterUsers: Set? = nil) { super.init(filterUsers: filterUsers) customCells = [ContactCellType.ContactPerson.rawValue: FunContactSelectedCell.self] view.backgroundColor = .funContactBackgroundColor diff --git a/NEContactUIKit/NEContactUIKit/Classes/FunUI/ViewController/FunMultiSelectViewController.swift b/NEContactUIKit/NEContactUIKit/Classes/FunUI/ViewController/FunMultiSelectViewController.swift index 3c4ecb52..9b978f97 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/FunUI/ViewController/FunMultiSelectViewController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/FunUI/ViewController/FunMultiSelectViewController.swift @@ -12,7 +12,7 @@ import UIKit /// 转发 - 选择页面 - 通用版 @objcMembers open class FunMultiSelectViewController: NEBaseMultiSelectViewController { - override init(filterUsers: Set? = nil) { + override public init(filterUsers: Set? = nil) { super.init(filterUsers: filterUsers) themeColor = .funContactThemeColor titleText = localizable("select") @@ -106,7 +106,7 @@ open class FunMultiSelectViewController: NEBaseMultiSelectViewController { // MARK: - UIScrollViewDelegate /// 重写 tableView 开始滚动事件,更新搜索框 leftView 位置 - override public func scrollViewWillBeginDragging(_ scrollView: UIScrollView) { + override open func scrollViewWillBeginDragging(_ scrollView: UIScrollView) { super.scrollViewWillBeginDragging(scrollView) setSearchTextFieldLeftView() } diff --git a/NEContactUIKit/NEContactUIKit/Classes/FunUI/ViewController/FunMultiSelectedViewController.swift b/NEContactUIKit/NEContactUIKit/Classes/FunUI/ViewController/FunMultiSelectedViewController.swift index 9eca399c..c82d330d 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/FunUI/ViewController/FunMultiSelectedViewController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/FunUI/ViewController/FunMultiSelectedViewController.swift @@ -10,7 +10,7 @@ import UIKit /// 转发多选-已选页面-通用版 @objcMembers open class FunMultiSelectedViewController: NEBaseMultiSelectedViewController { - override init(selectedArray: [MultiSelectModel] = [MultiSelectModel]()) { + override public init(selectedArray: [MultiSelectModel] = [MultiSelectModel]()) { super.init(selectedArray: selectedArray) } diff --git a/NEContactUIKit/NEContactUIKit/Classes/Model/ContactSection.swift b/NEContactUIKit/NEContactUIKit/Classes/Model/ContactSection.swift index 46fe8c81..696764a1 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Model/ContactSection.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Model/ContactSection.swift @@ -16,7 +16,7 @@ import NECoreIM2Kit open class ContactSection { public var initial: String public var contacts: Array = [ContactInfo]() - init(initial: String, contacts: [ContactInfo]) { + public init(initial: String, contacts: [ContactInfo]) { self.initial = initial self.contacts = contacts } diff --git a/NEContactUIKit/NEContactUIKit/Classes/Model/NEFusionContactCellModel.swift b/NEContactUIKit/NEContactUIKit/Classes/Model/NEFusionContactCellModel.swift index c7724e04..c24d85f4 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Model/NEFusionContactCellModel.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Model/NEFusionContactCellModel.swift @@ -17,7 +17,7 @@ open class NEFusionContactCellModel: NSObject { public var aiUser: V2NIMAIUser? /// 获取accid - public func getAccountId() -> String { + open func getAccountId() -> String { if let aiAccountId = aiUser?.accountId { return aiAccountId } else if let uid = user?.user?.accountId { @@ -27,7 +27,7 @@ open class NEFusionContactCellModel: NSObject { } /// 获取显示名称 - public func getShowName() -> String { + open func getShowName() -> String { if let name = user?.showName() { if name.count > 0 { return name diff --git a/NEContactUIKit/NEContactUIKit/Classes/Model/NENotification.swift b/NEContactUIKit/NEContactUIKit/Classes/Model/NENotification.swift index b3a2a6b2..df489d87 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Model/NENotification.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Model/NENotification.swift @@ -35,8 +35,8 @@ public class NENotification: NSObject { } // 是否是同一申请 - public func isEqualTo(_ noti: V2NIMFriendAddApplication, - _ compareStatus: Bool = true) -> Bool { + open func isEqualTo(_ noti: V2NIMFriendAddApplication, + _ compareStatus: Bool = true) -> Bool { if v2Notification.applicantAccountId == noti.applicantAccountId, v2Notification.recipientAccountId == noti.recipientAccountId { if compareStatus { diff --git a/NEContactUIKit/NEContactUIKit/Classes/Multiselect/Cell/NEBaseSelectedListCell.swift b/NEContactUIKit/NEContactUIKit/Classes/Multiselect/Cell/NEBaseSelectedListCell.swift index c42d8a95..199c3144 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Multiselect/Cell/NEBaseSelectedListCell.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Multiselect/Cell/NEBaseSelectedListCell.swift @@ -25,6 +25,7 @@ open class NEBaseSelectedListCell: NEBaseSelectCell { button.translatesAutoresizingMaskIntoConstraints = false button.setImage(UIImage.ne_imageNamed(name: "remove"), for: .normal) button.addTarget(self, action: #selector(removeButtonAction), for: .touchUpInside) + button.accessibilityIdentifier = "id.remove" return button }() @@ -38,7 +39,7 @@ open class NEBaseSelectedListCell: NEBaseSelectCell { public var bottomLineLeftConstraint: NSLayoutConstraint? // 分隔线左边约束 - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEContactUIKit/NEContactUIKit/Classes/Multiselect/ViewController/NEBaseMultiSelectViewController.swift b/NEContactUIKit/NEContactUIKit/Classes/Multiselect/ViewController/NEBaseMultiSelectViewController.swift index addf33c9..a8579306 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Multiselect/ViewController/NEBaseMultiSelectViewController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Multiselect/ViewController/NEBaseMultiSelectViewController.swift @@ -32,7 +32,7 @@ open class NEBaseMultiSelectViewController: NEContactBaseViewController, UIColle public var titleText = localizable("select") // 标题文案 public var sureButtonText = commonLocalizable("sure") // 确定按钮文案 - init(filterUsers: Set? = nil) { + public init(filterUsers: Set? = nil) { super.init(nibName: nil, bundle: nil) self.filterUsers = filterUsers } @@ -500,11 +500,10 @@ open class NEBaseMultiSelectViewController: NEContactBaseViewController, UIColle tableView.separatorStyle = .none tableView.keyboardDismissMode = .onDrag - if #available(iOS 11.0, *) { - tableView.estimatedRowHeight = 0 - tableView.estimatedSectionHeaderHeight = 0 - tableView.estimatedSectionFooterHeight = 0 - } + tableView.estimatedRowHeight = 0 + tableView.estimatedSectionHeaderHeight = 0 + tableView.estimatedSectionFooterHeight = 0 + if #available(iOS 15.0, *) { tableView.sectionHeaderTopPadding = 0.0 } @@ -523,11 +522,10 @@ open class NEBaseMultiSelectViewController: NEContactBaseViewController, UIColle tableView.isHidden = true tableView.keyboardDismissMode = .onDrag - if #available(iOS 11.0, *) { - tableView.estimatedRowHeight = 0 - tableView.estimatedSectionHeaderHeight = 0 - tableView.estimatedSectionFooterHeight = 0 - } + tableView.estimatedRowHeight = 0 + tableView.estimatedSectionHeaderHeight = 0 + tableView.estimatedSectionFooterHeight = 0 + if #available(iOS 15.0, *) { tableView.sectionHeaderTopPadding = 0.0 } @@ -546,11 +544,10 @@ open class NEBaseMultiSelectViewController: NEContactBaseViewController, UIColle tableView.isHidden = true tableView.keyboardDismissMode = .onDrag - if #available(iOS 11.0, *) { - tableView.estimatedRowHeight = 0 - tableView.estimatedSectionHeaderHeight = 0 - tableView.estimatedSectionFooterHeight = 0 - } + tableView.estimatedRowHeight = 0 + tableView.estimatedSectionHeaderHeight = 0 + tableView.estimatedSectionFooterHeight = 0 + if #available(iOS 15.0, *) { tableView.sectionHeaderTopPadding = 0.0 } @@ -836,7 +833,7 @@ open class NEBaseMultiSelectViewController: NEContactBaseViewController, UIColle /// 监听滚动 /// - Parameter scrollView: 滚动视图 - public func scrollViewWillBeginDragging(_ scrollView: UIScrollView) { + open func scrollViewWillBeginDragging(_ scrollView: UIScrollView) { // 滚动时收起搜索键盘 view.endEditing(true) } @@ -967,7 +964,7 @@ open class NEBaseMultiSelectViewController: NEContactBaseViewController, UIColle extension NEBaseMultiSelectViewController: NEBaseMultiSelectedViewControllerDelegate { /// 移除按钮点击事件 /// - Parameter model: 数据模型 - public func removeButtonAction(_ model: MultiSelectModel?) { + open func removeButtonAction(_ model: MultiSelectModel?) { if let m = model { didUnselectContact(m) } diff --git a/NEContactUIKit/NEContactUIKit/Classes/Multiselect/ViewController/NEBaseMultiSelectedViewController.swift b/NEContactUIKit/NEContactUIKit/Classes/Multiselect/ViewController/NEBaseMultiSelectedViewController.swift index 16b150dc..0cf72f97 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Multiselect/ViewController/NEBaseMultiSelectedViewController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Multiselect/ViewController/NEBaseMultiSelectedViewController.swift @@ -21,7 +21,7 @@ open class NEBaseMultiSelectedViewController: NEContactBaseViewController, UITab public var tableViewTopAnchor: NSLayoutConstraint? // tableView的top约束 public weak var delegate: NEBaseMultiSelectedViewControllerDelegate? - init(selectedArray: [MultiSelectModel] = [MultiSelectModel]()) { + public init(selectedArray: [MultiSelectModel] = [MultiSelectModel]()) { self.selectedArray = selectedArray super.init(nibName: nil, bundle: nil) } @@ -109,11 +109,10 @@ open class NEBaseMultiSelectedViewController: NEContactBaseViewController, UITab tableView.dataSource = self tableView.keyboardDismissMode = .onDrag - if #available(iOS 11.0, *) { - tableView.estimatedRowHeight = 0 - tableView.estimatedSectionHeaderHeight = 0 - tableView.estimatedSectionFooterHeight = 0 - } + tableView.estimatedRowHeight = 0 + tableView.estimatedSectionHeaderHeight = 0 + tableView.estimatedSectionFooterHeight = 0 + if #available(iOS 15.0, *) { tableView.sectionHeaderTopPadding = 0.0 } @@ -141,7 +140,7 @@ open class NEBaseMultiSelectedViewController: NEContactBaseViewController, UITab return cell } - public func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { + open func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { 62 } diff --git a/NEContactUIKit/NEContactUIKit/Classes/Multiselect/ViewModel/MultiSelectViewModel.swift b/NEContactUIKit/NEContactUIKit/Classes/Multiselect/ViewModel/MultiSelectViewModel.swift index 6b8b5acf..8418dcfa 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Multiselect/ViewModel/MultiSelectViewModel.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Multiselect/ViewModel/MultiSelectViewModel.swift @@ -19,7 +19,7 @@ open class MultiSelectViewModel: ContactViewModel { public var sessions = [MultiSelectModel]() // 当前展示列表 /// 初始化 - init() { + public init() { super.init(contactHeaders: nil) } diff --git a/NEContactUIKit/NEContactUIKit/Classes/NormalUI/ViewController/MultiSelectViewController.swift b/NEContactUIKit/NEContactUIKit/Classes/NormalUI/ViewController/MultiSelectViewController.swift index e9ef4137..c632c77a 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/NormalUI/ViewController/MultiSelectViewController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/NormalUI/ViewController/MultiSelectViewController.swift @@ -11,7 +11,7 @@ import UIKit /// 转发 - 选择页面 - 协同版 @objcMembers open class MultiSelectViewController: NEBaseMultiSelectViewController { - override init(filterUsers: Set? = nil) { + override public init(filterUsers: Set? = nil) { super.init(filterUsers: filterUsers) searchTextField.backgroundColor = .searchTextFeildBackColor diff --git a/NEContactUIKit/NEContactUIKit/Classes/NormalUI/ViewController/MultiSelectedViewController.swift b/NEContactUIKit/NEContactUIKit/Classes/NormalUI/ViewController/MultiSelectedViewController.swift index 90ba3f9f..922f7d97 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/NormalUI/ViewController/MultiSelectedViewController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/NormalUI/ViewController/MultiSelectedViewController.swift @@ -10,7 +10,7 @@ import UIKit /// 转发多选-已选页面-协同版 @objcMembers open class MultiSelectedViewController: NEBaseMultiSelectedViewController { - override init(selectedArray: [MultiSelectModel] = [MultiSelectModel]()) { + override public init(selectedArray: [MultiSelectModel] = [MultiSelectModel]()) { super.init(selectedArray: selectedArray) } diff --git a/NEContactUIKit/NEContactUIKit/Classes/Team/Cell/NEBaseTeamTableViewCell.swift b/NEContactUIKit/NEContactUIKit/Classes/Team/Cell/NEBaseTeamTableViewCell.swift index ea71d49c..59b7676a 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Team/Cell/NEBaseTeamTableViewCell.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Team/Cell/NEBaseTeamTableViewCell.swift @@ -44,7 +44,7 @@ open class NEBaseTeamTableViewCell: UITableViewCell { return arrow }() - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) commonUI() } diff --git a/NEContactUIKit/NEContactUIKit/Classes/Team/ViewController/NEBaseTeamListViewController.swift b/NEContactUIKit/NEContactUIKit/Classes/Team/ViewController/NEBaseTeamListViewController.swift index 3da6aab0..ccbc617d 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Team/ViewController/NEBaseTeamListViewController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Team/ViewController/NEBaseTeamListViewController.swift @@ -22,11 +22,10 @@ open class NEBaseTeamListViewController: NEContactBaseViewController, UITableVie tableView.tableHeaderView = UIView(frame: CGRect(x: 0, y: 0, width: 0, height: 0.1)) tableView.keyboardDismissMode = .onDrag - if #available(iOS 11.0, *) { - tableView.estimatedRowHeight = 0 - tableView.estimatedSectionHeaderHeight = 0 - tableView.estimatedSectionFooterHeight = 0 - } + tableView.estimatedRowHeight = 0 + tableView.estimatedSectionHeaderHeight = 0 + tableView.estimatedSectionFooterHeight = 0 + if #available(iOS 15.0, *) { tableView.sectionHeaderTopPadding = 0.0 } diff --git a/NEContactUIKit/NEContactUIKit/Classes/Team/ViewModel/TeamListViewModel.swift b/NEContactUIKit/NEContactUIKit/Classes/Team/ViewModel/TeamListViewModel.swift index 231fcce9..9577b166 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Team/ViewModel/TeamListViewModel.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Team/ViewModel/TeamListViewModel.swift @@ -39,12 +39,12 @@ open class TeamListViewModel: NSObject, NETeamListener { // MARK: NIMTeamManagerDelegate - public func onTeamAdded(_ team: V2NIMTeam) { + open func onTeamAdded(_ team: V2NIMTeam) { teamList.insert(NETeam(v2teamInfo: team), at: 0) refresh() } - public func onTeamUpdated(_ team: V2NIMTeam) { + open func onTeamUpdated(_ team: V2NIMTeam) { for (i, t) in teamList.enumerated() { if t.teamId == team.teamId { teamList[i] = NETeam(v2teamInfo: team) @@ -54,7 +54,7 @@ open class TeamListViewModel: NSObject, NETeamListener { } } - public func onTeamRemoved(_ team: V2NIMTeam) { + open func onTeamRemoved(_ team: V2NIMTeam) { for (i, t) in teamList.enumerated() { if t.teamId == team.teamId { teamList.remove(at: i) @@ -66,23 +66,23 @@ open class TeamListViewModel: NSObject, NETeamListener { // MARK: - V2NIMTeamListener - public func onTeamCreated(_ team: V2NIMTeam) { + open func onTeamCreated(_ team: V2NIMTeam) { onTeamAdded(team) } - public func onTeamJoined(_ team: V2NIMTeam) { + open func onTeamJoined(_ team: V2NIMTeam) { onTeamAdded(team) } - public func onTeamInfoUpdated(_ team: V2NIMTeam) { + open func onTeamInfoUpdated(_ team: V2NIMTeam) { onTeamUpdated(team) } - public func onTeamLeft(_ team: V2NIMTeam, isKicked: Bool) { + open func onTeamLeft(_ team: V2NIMTeam, isKicked: Bool) { onTeamRemoved(team) } - public func onTeamDismissed(_ team: V2NIMTeam) { + open func onTeamDismissed(_ team: V2NIMTeam) { onTeamRemoved(team) } } diff --git a/NEContactUIKit/NEContactUIKit/Classes/UserInfo/Views/CenterTextCell.swift b/NEContactUIKit/NEContactUIKit/Classes/UserInfo/Views/CenterTextCell.swift index be8f59a0..6bcee351 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/UserInfo/Views/CenterTextCell.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/UserInfo/Views/CenterTextCell.swift @@ -9,7 +9,7 @@ import UIKit open class CenterTextCell: UITableViewCell { public var titleLabel: UILabel = .init() public var line = UIView() - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) selectionStyle = .none titleLabel.font = UIFont.systemFont(ofSize: 16) diff --git a/NEContactUIKit/NEContactUIKit/Classes/UserInfo/Views/ContactBaseTextCell.swift b/NEContactUIKit/NEContactUIKit/Classes/UserInfo/Views/ContactBaseTextCell.swift index 5587825a..d70911fe 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/UserInfo/Views/ContactBaseTextCell.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/UserInfo/Views/ContactBaseTextCell.swift @@ -10,7 +10,7 @@ open class ContactBaseTextCell: UITableViewCell { public var titleLabel: UILabel = .init() public var line = UIView() - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) selectionStyle = .none titleLabel.translatesAutoresizingMaskIntoConstraints = false diff --git a/NEContactUIKit/NEContactUIKit/Classes/UserInfo/Views/TextWithDetailTextCell.swift b/NEContactUIKit/NEContactUIKit/Classes/UserInfo/Views/TextWithDetailTextCell.swift index 2843416e..62dd1bf9 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/UserInfo/Views/TextWithDetailTextCell.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/UserInfo/Views/TextWithDetailTextCell.swift @@ -9,7 +9,7 @@ import UIKit open class TextWithDetailTextCell: ContactBaseTextCell { public var detailTitleLabel = UILabel() - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) detailTitleLabel.translatesAutoresizingMaskIntoConstraints = false detailTitleLabel.font = UIFont.systemFont(ofSize: 12) diff --git a/NEContactUIKit/NEContactUIKit/Classes/UserInfo/Views/TextWithRightArrowCell.swift b/NEContactUIKit/NEContactUIKit/Classes/UserInfo/Views/TextWithRightArrowCell.swift index c05fb79b..a6903fe5 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/UserInfo/Views/TextWithRightArrowCell.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/UserInfo/Views/TextWithRightArrowCell.swift @@ -9,7 +9,7 @@ import UIKit open class TextWithRightArrowCell: ContactBaseTextCell { public var arrowImageView = UIImageView(image: UIImage.ne_imageNamed(name: "arrowRight")) - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) arrowImageView.translatesAutoresizingMaskIntoConstraints = false arrowImageView.contentMode = .center diff --git a/NEContactUIKit/NEContactUIKit/Classes/UserInfo/Views/TextWithSwitchCell.swift b/NEContactUIKit/NEContactUIKit/Classes/UserInfo/Views/TextWithSwitchCell.swift index e82df8fe..862b7877 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/UserInfo/Views/TextWithSwitchCell.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/UserInfo/Views/TextWithSwitchCell.swift @@ -10,7 +10,7 @@ public typealias ValueChangeBlock = (_ title: String?, _ value: Bool) -> Void open class TextWithSwitchCell: ContactBaseTextCell { public var block: ValueChangeBlock? public var switchButton = UISwitch() - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) switchButton.translatesAutoresizingMaskIntoConstraints = false switchButton.onTintColor = UIColor(hexString: "#337EFF") diff --git a/NEContactUIKit/NEContactUIKit/Classes/Validation/Controller/NEBaseValidationMessageViewController.swift b/NEContactUIKit/NEContactUIKit/Classes/Validation/Controller/NEBaseValidationMessageViewController.swift index 50c7addc..070a5476 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Validation/Controller/NEBaseValidationMessageViewController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Validation/Controller/NEBaseValidationMessageViewController.swift @@ -56,11 +56,10 @@ open class NEBaseValidationMessageViewController: NEContactBaseViewController { tableView.backgroundColor = .clear tableView.keyboardDismissMode = .onDrag - if #available(iOS 11.0, *) { - tableView.estimatedRowHeight = 0 - tableView.estimatedSectionHeaderHeight = 0 - tableView.estimatedSectionFooterHeight = 0 - } + tableView.estimatedRowHeight = 0 + tableView.estimatedSectionHeaderHeight = 0 + tableView.estimatedSectionFooterHeight = 0 + if #available(iOS 15.0, *) { tableView.sectionHeaderTopPadding = 0.0 } @@ -156,7 +155,7 @@ extension NEBaseValidationMessageViewController: UITableViewDelegate, UITableVie // MARK: - ValidationMessageViewModelDelegate extension NEBaseValidationMessageViewController: ValidationMessageViewModelDelegate { - public func tableviewReload() { + open func tableviewReload() { tableView.reloadData() emptyView.isHidden = viewModel.friendAddApplications.count > 0 } diff --git a/NEContactUIKit/NEContactUIKit/Classes/Validation/ViewModel/ValidationMessageViewModel.swift b/NEContactUIKit/NEContactUIKit/Classes/Validation/ViewModel/ValidationMessageViewModel.swift index 02a2119c..050d61c5 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Validation/ViewModel/ValidationMessageViewModel.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Validation/ViewModel/ValidationMessageViewModel.swift @@ -20,7 +20,7 @@ open class ValidationMessageViewModel: NSObject, NEContactListener { var finished: Bool = false // 是否还有数据 var pageMaxLimit: UInt = 100 // 查询的每页数量 - override init() { + override public init() { super.init() contactRepo.addContactListener(self) } @@ -227,7 +227,7 @@ open class ValidationMessageViewModel: NSObject, NEContactListener { /// 收到好友添加申请回调 /// - Parameter application: 申请添加好友信息 - public func onFriendAddApplication(_ application: V2NIMFriendAddApplication) { + open func onFriendAddApplication(_ application: V2NIMFriendAddApplication) { NEALog.infoLog(ModuleName + " " + className(), desc: #function) convertToValidationMessage(application, true) { error in if let err = error { @@ -238,7 +238,7 @@ open class ValidationMessageViewModel: NSObject, NEContactListener { /// 好友添加申请被拒绝回调 /// - Parameter rejectionInfo: 申请添加好友拒绝信息 - public func onFriendAddRejected(_ rejectionInfo: V2NIMFriendAddApplication) { + open func onFriendAddRejected(_ rejectionInfo: V2NIMFriendAddApplication) { NEALog.infoLog(ModuleName + " " + className(), desc: #function) for (index, item) in friendAddApplications.enumerated() { diff --git a/NEContactUIKit/NEContactUIKit/Classes/Validation/Views/NEBaseValidationCell.swift b/NEContactUIKit/NEContactUIKit/Classes/Validation/Views/NEBaseValidationCell.swift index 20204282..77e657a0 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Validation/Views/NEBaseValidationCell.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Validation/Views/NEBaseValidationCell.swift @@ -24,7 +24,7 @@ open class NEBaseValidationCell: NEBaseContactViewCell { public var titleLabelRightMargin: NSLayoutConstraint? let line = UIView() - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) setupUI() } diff --git a/NEContactUIKit/NEContactUIKit/Classes/ViewModel/ContactViewModel.swift b/NEContactUIKit/NEContactUIKit/Classes/ViewModel/ContactViewModel.swift index 045a0c06..21380c4d 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/ViewModel/ContactViewModel.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/ViewModel/ContactViewModel.swift @@ -32,7 +32,7 @@ open class ContactViewModel: NSObject { } var refresh: RefreshBlock? - init(contactHeaders: [ContactHeadItem]?) { + public init(contactHeaders: [ContactHeadItem]?) { super.init() NEALog.infoLog( ModuleName + " " + className(), @@ -226,7 +226,7 @@ open class ContactViewModel: NSObject { extension ContactViewModel: NEContactListener { /// 好友信息缓存更新 /// - Parameter accountId: 用户 id - public func onContactChange(_ changeType: NEContactChangeType, _ contacts: [NEUserWithFriend]) { + open func onContactChange(_ changeType: NEContactChangeType, _ contacts: [NEUserWithFriend]) { for contact in contacts { if let accid = contact.user?.accountId, !NEFriendUserCache.shared.isBlockAccount(accid) { @@ -258,7 +258,7 @@ extension ContactViewModel: NEContactListener { /// 好友添加回调 /// - Parameter friendInfo: 好友信息 - public func onFriendAdded(_ friendInfo: V2NIMFriend) { + open func onFriendAdded(_ friendInfo: V2NIMFriend) { loadData { [weak self] _, _ in self?.delegate?.reloadTableView() } @@ -269,7 +269,7 @@ extension ContactViewModel: NEContactListener { /// - Parameters: /// - accountId: 删除的好友账号ID /// - deletionType: 好友删除的类型 - public func onFriendDeleted(_ accountId: String, deletionType: V2NIMFriendDeletionType) { + open func onFriendDeleted(_ accountId: String, deletionType: V2NIMFriendDeletionType) { if NEFriendUserCache.shared.isBlockAccount(accountId) { return } @@ -279,26 +279,26 @@ extension ContactViewModel: NEContactListener { /// 收到好友添加申请回调 /// - Parameter application: 申请添加好友信息 - public func onFriendAddApplication(_ application: V2NIMFriendAddApplication) { + open func onFriendAddApplication(_ application: V2NIMFriendAddApplication) { getAddApplicationUnreadCount(nil) } /// 好友添加申请被拒绝回调 /// - Parameter rejectionInfo: 申请添加好友拒绝信息 - public func onFriendAddRejected(_ rejectionInfo: V2NIMFriendAddApplication) { + open func onFriendAddRejected(_ rejectionInfo: V2NIMFriendAddApplication) { getAddApplicationUnreadCount(nil) } /// 黑名单添加回调 /// - Parameter user: 用户信息 - public func onBlockListAdded(_ user: V2NIMUser) { + open func onBlockListAdded(_ user: V2NIMUser) { guard let accountId = user.accountId else { return } removeFromContacts(accountId) } /// 黑名单移除回调 /// - Parameter accountId: 用户 Id - public func onBlockListRemoved(_ accountId: String) { + open func onBlockListRemoved(_ accountId: String) { NEFriendUserCache.shared.removeBlockAccount(accountId) if NEFriendUserCache.shared.isFriend(accountId) { loadData { [weak self] _, _ in @@ -312,7 +312,7 @@ extension ContactViewModel: NEContactListener { extension ContactViewModel: NEEventListener { /// 订阅在线状态 - public func subscribeOnlineStatus() { + open func subscribeOnlineStatus() { var subscribeList: [String] = [] for section in contacts { for contact in section.contacts { @@ -330,7 +330,7 @@ extension ContactViewModel: NEEventListener { } /// 取消订阅 - public func unsubscribeOnlineStatus() { + open func unsubscribeOnlineStatus() { var subscribeList: [String] = [] for section in contacts { for contact in section.contacts { @@ -345,7 +345,7 @@ extension ContactViewModel: NEEventListener { } } - public func onRecvSubscribeEvents(_ event: [NIMSubscribeEvent]) { + open func onRecvSubscribeEvents(_ event: [NIMSubscribeEvent]) { NEALog.infoLog(className(), desc: #function + " event count : \(event.count)") for e in event { print("event from : \(e.from ?? "") event value : \(e.value) event type : \(e.type)") diff --git a/NEContactUIKit/NEContactUIKit/Classes/Views/Cell/NEBaseContactUnCheckCell.swift b/NEContactUIKit/NEContactUIKit/Classes/Views/Cell/NEBaseContactUnCheckCell.swift index 4b45552c..23fb79aa 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Views/Cell/NEBaseContactUnCheckCell.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Views/Cell/NEBaseContactUnCheckCell.swift @@ -7,7 +7,7 @@ import UIKit @objcMembers open class NEBaseContactUnCheckCell: UICollectionViewCell { - override init(frame: CGRect) { + override public init(frame: CGRect) { super.init(frame: frame) setupUI() } diff --git a/NEContactUIKit/NEContactUIKit/Classes/Views/ContactHeadItem.swift b/NEContactUIKit/NEContactUIKit/Classes/Views/ContactHeadItem.swift index c8be407c..8a387cd9 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Views/ContactHeadItem.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Views/ContactHeadItem.swift @@ -12,7 +12,7 @@ open class ContactHeadItem { public var color = UIColor(hexString: "#60CFA7") public var router: String - init(name: String, imageName: String?, router: String, color: UIColor) { + public init(name: String, imageName: String?, router: String, color: UIColor) { self.name = name self.imageName = imageName self.router = router diff --git a/NEContactUIKit/NEContactUIKit/Classes/Views/ContactSectionView.swift b/NEContactUIKit/NEContactUIKit/Classes/Views/ContactSectionView.swift index 146911a8..be55fe9f 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Views/ContactSectionView.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Views/ContactSectionView.swift @@ -10,7 +10,7 @@ open class ContactSectionView: UITableViewHeaderFooterView { public var titleLabel = UILabel() var line = UIView() - override init(reuseIdentifier: String?) { + override public init(reuseIdentifier: String?) { super.init(reuseIdentifier: reuseIdentifier) commonUI() } diff --git a/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactSelectedPageController.swift b/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactSelectedPageController.swift index 212b439c..e4cf9b22 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactSelectedPageController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactSelectedPageController.swift @@ -268,15 +268,15 @@ open class NEBaseContactSelectedPageController: NEContactBaseViewController, Fus // MARK: Collection View Delegate - public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + open func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { selectArray.count } - public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + open func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { UICollectionViewCell() } - public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { + open func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { let model = selectArray[indexPath.row] didUnselect(model) } diff --git a/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactSelectedViewController.swift b/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactSelectedViewController.swift index 41c420e9..bf9bca81 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactSelectedViewController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactSelectedViewController.swift @@ -65,11 +65,10 @@ open class NEBaseContactSelectedViewController: NEContactBaseViewController, UIC tableView.contentInset = .init(top: -10, left: 0, bottom: 0, right: 0) tableView.keyboardDismissMode = .onDrag - if #available(iOS 11.0, *) { - tableView.estimatedRowHeight = 0 - tableView.estimatedSectionHeaderHeight = 0 - tableView.estimatedSectionFooterHeight = 0 - } + tableView.estimatedRowHeight = 0 + tableView.estimatedSectionHeaderHeight = 0 + tableView.estimatedSectionFooterHeight = 0 + if #available(iOS 15.0, *) { tableView.sectionHeaderTopPadding = 0.0 } @@ -78,7 +77,7 @@ open class NEBaseContactSelectedViewController: NEContactBaseViewController, UIC var tableViewTopAnchor: NSLayoutConstraint? - init(filterUsers: Set? = nil) { + public init(filterUsers: Set? = nil) { super.init(nibName: nil, bundle: nil) self.filterUsers = filterUsers } diff --git a/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactUserViewController.swift b/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactUserViewController.swift index 147f61c0..6ba12e64 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactUserViewController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactUserViewController.swift @@ -97,11 +97,10 @@ open class NEBaseContactUserViewController: NEContactBaseViewController, UITable tableView.dataSource = self tableView.keyboardDismissMode = .onDrag - if #available(iOS 11.0, *) { - tableView.estimatedRowHeight = 0 - tableView.estimatedSectionHeaderHeight = 0 - tableView.estimatedSectionFooterHeight = 0 - } + tableView.estimatedRowHeight = 0 + tableView.estimatedSectionHeaderHeight = 0 + tableView.estimatedSectionFooterHeight = 0 + if #available(iOS 15.0, *) { tableView.sectionHeaderTopPadding = 0.0 } @@ -486,7 +485,7 @@ open class NEBaseContactUserViewController: NEContactBaseViewController, UITable extension NEBaseContactUserViewController: NEContactListener { /// 好友信息缓存更新 /// - Parameter accountId: 用户 id - public func onContactChange(_ changeType: NEContactChangeType, _ contacts: [NEUserWithFriend]) { + open func onContactChange(_ changeType: NEContactChangeType, _ contacts: [NEUserWithFriend]) { for contact in contacts { if contact.user?.accountId == uid { user = contact diff --git a/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactViewController.swift b/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactViewController.swift index ef069d02..d9e023ab 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactViewController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactViewController.swift @@ -113,11 +113,10 @@ open class NEBaseContactViewController: UIViewController, UITableViewDelegate, U tableView.tableHeaderView = UIView(frame: CGRect(x: 0, y: 0, width: 0, height: 0.1)) tableView.keyboardDismissMode = .onDrag - if #available(iOS 11.0, *) { - tableView.estimatedRowHeight = 0 - tableView.estimatedSectionHeaderHeight = 0 - tableView.estimatedSectionFooterHeight = 0 - } + tableView.estimatedRowHeight = 0 + tableView.estimatedSectionHeaderHeight = 0 + tableView.estimatedSectionFooterHeight = 0 + if #available(iOS 15.0, *) { tableView.sectionHeaderTopPadding = 0.0 } @@ -410,7 +409,7 @@ open class NEBaseContactViewController: UIViewController, UITableViewDelegate, U emptyView.isHidden = viewModel.getFriendSections().count > 0 } - public func reloadTableView() { + open func reloadTableView() { didRefreshTable() } } diff --git a/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseFusionContactSelectedController.swift b/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseFusionContactSelectedController.swift index f14b1bb7..3449e41c 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseFusionContactSelectedController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseFusionContactSelectedController.swift @@ -63,11 +63,10 @@ open class NEBaseFusionContactSelectedController: UIViewController, UITableViewD tableView.separatorStyle = .none tableView.keyboardDismissMode = .onDrag - if #available(iOS 11.0, *) { - tableView.estimatedRowHeight = 0 - tableView.estimatedSectionHeaderHeight = 0 - tableView.estimatedSectionFooterHeight = 0 - } + tableView.estimatedRowHeight = 0 + tableView.estimatedSectionHeaderHeight = 0 + tableView.estimatedSectionFooterHeight = 0 + if #available(iOS 15.0, *) { tableView.sectionHeaderTopPadding = 0.0 } @@ -191,7 +190,7 @@ open class NEBaseFusionContactSelectedController: UIViewController, UITableViewD /// 外部触发反选操作 /// - Parameter model: 数据模型 - public func unselectModel(_ model: NEFusionContactCellModel) { + open func unselectModel(_ model: NEFusionContactCellModel) { for memberModel in viewModel.memberDatas { if memberModel.getAccountId() == model.getAccountId() { memberModel.selected = false diff --git a/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseUserInfoHeaderView.swift b/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseUserInfoHeaderView.swift index 8c58a125..4bb6c90f 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseUserInfoHeaderView.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseUserInfoHeaderView.swift @@ -63,7 +63,7 @@ open class NEBaseUserInfoHeaderView: UIView { return view }() - override init(frame: CGRect) { + override public init(frame: CGRect) { super.init(frame: frame) commonUI() } diff --git a/NEConversationUIKit/NEConversationUIKit.podspec b/NEConversationUIKit/NEConversationUIKit.podspec index b0055bc6..c235400f 100644 --- a/NEConversationUIKit/NEConversationUIKit.podspec +++ b/NEConversationUIKit/NEConversationUIKit.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'NEConversationUIKit' - s.version = '10.5.0' + s.version = '10.5.1' s.summary = 'Netease XKit' # This description is used to generate tags and improve search results. @@ -38,7 +38,7 @@ TODO: Add long description of the pod here. 'BUILD_LIBRARY_FOR_DISTRIBUTION' => 'YES' } - s.dependency 'NECommonUIKit', '9.7.4' + s.dependency 'NECommonUIKit' s.dependency 'NEChatKit' s.dependency 'MJRefresh' end diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/Common/ConversationDeduplicationHelper.swift b/NEConversationUIKit/NEConversationUIKit/Classes/Common/ConversationDeduplicationHelper.swift index 12a37b1a..c655ff0e 100644 --- a/NEConversationUIKit/NEConversationUIKit/Classes/Common/ConversationDeduplicationHelper.swift +++ b/NEConversationUIKit/NEConversationUIKit/Classes/Common/ConversationDeduplicationHelper.swift @@ -24,22 +24,22 @@ public class ConversationDeduplicationHelper: NSObject, NEIMKitClientListener { IMKitClient.instance.removeLoginListener(self) } - public func onLoginStatus(_ status: V2NIMLoginStatus) { + open func onLoginStatus(_ status: V2NIMLoginStatus) { if status == .LOGIN_STATUS_LOGOUT { clearCache() } } - public func onKickedOffline(_ detail: V2NIMKickedOfflineDetail) { + open func onKickedOffline(_ detail: V2NIMKickedOfflineDetail) { clearCache() } - public func clearCache() { + open func clearCache() { revokeMessageIds.removeAll() } // 是否已经保存过此撤回消息,防止重复保存本地撤回记录 - public func isRevokeMessageSaved(messageId: String) -> Bool { + open func isRevokeMessageSaved(messageId: String) -> Bool { if revokeMessageIds.contains(messageId) { return true } diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/Common/NEConversationLoaderService.swift b/NEConversationUIKit/NEConversationUIKit/Classes/Common/NEConversationLoaderService.swift index 91e5e59d..2dc4b24c 100644 --- a/NEConversationUIKit/NEConversationUIKit/Classes/Common/NEConversationLoaderService.swift +++ b/NEConversationUIKit/NEConversationUIKit/Classes/Common/NEConversationLoaderService.swift @@ -15,7 +15,7 @@ public class NEConversationLoaderService: NSObject { /// 初始化方法 /// 此方法会在模块被加载时调用 - public func setupInit() { + open func setupInit() { ChatKitClient.shared.registerInit(NEConversationService.shared) } } diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/Common/NEConversationService.swift b/NEConversationUIKit/NEConversationUIKit/Classes/Common/NEConversationService.swift index b4771cf5..c0f65a3d 100644 --- a/NEConversationUIKit/NEConversationUIKit/Classes/Common/NEConversationService.swift +++ b/NEConversationUIKit/NEConversationUIKit/Classes/Common/NEConversationService.swift @@ -15,13 +15,13 @@ public class NEConversationService: NSObject, ChatServiceDelegate { /// 注册 NEConversationUIKit 初始化协议 /// - Parameter params: 初始化参数 - public func setupInit(_ params: [String: Any]?) { + open func setupInit(_ params: [String: Any]?) { registerRouter(params) } /// 注册路由 /// - Parameter param: 参数 - public func registerRouter(_ param: [String: Any]?) { + open func registerRouter(_ param: [String: Any]?) { // @功能初始化 if IMKitConfigCenter.shared.enableAtMessage { NEAtMessageManager.setupInstance() diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Cell/NEBaseConversationSearchCell.swift b/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Cell/NEBaseConversationSearchCell.swift index 6b2f0dab..6cd735d1 100644 --- a/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Cell/NEBaseConversationSearchCell.swift +++ b/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Cell/NEBaseConversationSearchCell.swift @@ -7,7 +7,7 @@ import UIKit @objcMembers open class NEBaseConversationSearchCell: TextBaseCell { - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBaseConversationController.swift b/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBaseConversationController.swift index c2f89eb4..44716cbb 100644 --- a/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBaseConversationController.swift +++ b/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBaseConversationController.swift @@ -184,11 +184,10 @@ open class NEBaseConversationController: UIViewController, UIGestureRecognizerDe tableView.tableHeaderView = UIView(frame: CGRect(x: 0, y: 0, width: 0, height: 0.1)) tableView.keyboardDismissMode = .onDrag - if #available(iOS 11.0, *) { - tableView.estimatedRowHeight = 0 - tableView.estimatedSectionHeaderHeight = 0 - tableView.estimatedSectionFooterHeight = 0 - } + tableView.estimatedRowHeight = 0 + tableView.estimatedSectionHeaderHeight = 0 + tableView.estimatedSectionFooterHeight = 0 + if #available(iOS 15.0, *) { tableView.sectionHeaderTopPadding = 0.0 } @@ -601,7 +600,7 @@ extension NEBaseConversationController: TabNavigationViewDelegate { } extension NEBaseConversationController: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout { - public func numberOfSections(in collectionView: UICollectionView) -> Int { + open func numberOfSections(in collectionView: UICollectionView) -> Int { 1 } @@ -643,7 +642,7 @@ extension NEBaseConversationController: UICollectionViewDelegate, UICollectionVi } extension NEBaseConversationController: UITableViewDelegate, UITableViewDataSource { - public func numberOfSections(in tableView: UITableView) -> Int { + open func numberOfSections(in tableView: UITableView) -> Int { 2 } @@ -970,7 +969,7 @@ extension NEBaseConversationController: ConversationViewModelDelegate { } /// 由于数据变更可能导致底部有更多数据,此方法重新使列表加载更多能力开启 - public func loadMoreStateChange(_ finish: Bool) { + open func loadMoreStateChange(_ finish: Bool) { if finish { tableView.mj_footer = nil } else { diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBaseConversationSearchController.swift b/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBaseConversationSearchController.swift index 856dfeeb..8ea9d64a 100644 --- a/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBaseConversationSearchController.swift +++ b/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBaseConversationSearchController.swift @@ -28,11 +28,10 @@ open class NEBaseConversationSearchController: NEConversationBaseViewController, tableView.tableHeaderView = UIView(frame: CGRect(x: 0, y: 0, width: 0, height: 0.1)) tableView.keyboardDismissMode = .onDrag - if #available(iOS 11.0, *) { - tableView.estimatedRowHeight = 0 - tableView.estimatedSectionHeaderHeight = 0 - tableView.estimatedSectionFooterHeight = 0 - } + tableView.estimatedRowHeight = 0 + tableView.estimatedSectionHeaderHeight = 0 + tableView.estimatedSectionFooterHeight = 0 + if #available(iOS 15.0, *) { tableView.sectionHeaderTopPadding = 0.0 } diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBasePopListView.swift b/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBasePopListView.swift index 47bb6739..e0eb6cda 100644 --- a/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBasePopListView.swift +++ b/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBasePopListView.swift @@ -36,7 +36,7 @@ open class NEBasePopListView: UIView { } } - override init(frame: CGRect) { + override public init(frame: CGRect) { super.init(frame: frame) if let useSystemNav = NEConfigManager.instance.getParameter(key: useSystemNav) as? Bool, useSystemNav { topConstant = 10 diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/ViewModel/ConversationSearchViewModel.swift b/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/ViewModel/ConversationSearchViewModel.swift index 30beb204..023d7369 100644 --- a/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/ViewModel/ConversationSearchViewModel.swift +++ b/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/ViewModel/ConversationSearchViewModel.swift @@ -134,7 +134,7 @@ open class ConversationSearchViewModel: NSObject, NETeamListener, NEIMKitClientL /// 群信息更新回调 /// - Parameter team: 群 - public func onTeamInfoUpdated(_ team: V2NIMTeam) { + open func onTeamInfoUpdated(_ team: V2NIMTeam) { if let model = teamDic[team.teamId] { model.team = team } else { @@ -145,19 +145,19 @@ open class ConversationSearchViewModel: NSObject, NETeamListener, NEIMKitClientL /// 加入群回调 /// - Parameters: /// - team: 群 - public func onTeamJoined(_ team: V2NIMTeam) { + open func onTeamJoined(_ team: V2NIMTeam) { addTeam(team) } /// 创建群回调 /// - Parameter team: 群 - public func onTeamCreated(_ team: V2NIMTeam) { + open func onTeamCreated(_ team: V2NIMTeam) { addTeam(team) } /// 群解散回调 /// - Parameter team: 群 - public func onTeamDismissed(_ team: V2NIMTeam) { + open func onTeamDismissed(_ team: V2NIMTeam) { removeTeam(team) } @@ -165,7 +165,7 @@ open class ConversationSearchViewModel: NSObject, NETeamListener, NEIMKitClientL /// - Parameters: /// - team: 群 /// - isKicked: 是否被踢 - public func onTeamLeft(_ team: V2NIMTeam, isKicked: Bool) { + open func onTeamLeft(_ team: V2NIMTeam, isKicked: Bool) { removeTeam(team) } @@ -184,7 +184,7 @@ open class ConversationSearchViewModel: NSObject, NETeamListener, NEIMKitClientL } /// 群数据同步完成回调 - public func onTeamSyncFinished() { + open func onTeamSyncFinished() { NEALog.infoLog(className(), desc: #function + ", onTeamSyncFinished get search data") weak var weakSelf = self getSearchData(true) { @@ -198,7 +198,7 @@ open class ConversationSearchViewModel: NSObject, NETeamListener, NEIMKitClientL extension ConversationSearchViewModel: NEContactListener { /// 好友信息缓存更新 /// - Parameter accountId: 用户 id - public func onContactChange(_ changeType: NEContactChangeType, _ contacts: [NEUserWithFriend]) { + open func onContactChange(_ changeType: NEContactChangeType, _ contacts: [NEUserWithFriend]) { guard changeType == .update else { return } diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/ViewModel/ConversationViewModel.swift b/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/ViewModel/ConversationViewModel.swift index 53561fe5..d81b6d38 100644 --- a/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/ViewModel/ConversationViewModel.swift +++ b/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/ViewModel/ConversationViewModel.swift @@ -189,16 +189,16 @@ open class ConversationViewModel: NSObject, NEConversationListener, NETeamListen delegate?.reloadTableView() } - public func updateUserInfo(_ model: NEConversationListModel, _ user: NEUserWithFriend, _ conversation: V2NIMConversation) { + open func updateUserInfo(_ model: NEConversationListModel, _ user: NEUserWithFriend, _ conversation: V2NIMConversation) { model.conversation = conversation } - public func updateTeamInfo(_ model: NEConversationListModel, _ team: V2NIMTeam, _ conversation: V2NIMConversation) { + open func updateTeamInfo(_ model: NEConversationListModel, _ team: V2NIMTeam, _ conversation: V2NIMConversation) { model.conversation = conversation } /// 处理置顶变更逻辑 - public func filterStickTopData(_ conversations: [V2NIMConversation]) { + open func filterStickTopData(_ conversations: [V2NIMConversation]) { // 记录置顶 var changeTostickTopSet = Set() // 记录移除置顶 @@ -238,7 +238,7 @@ open class ConversationViewModel: NSObject, NEConversationListener, NETeamListen } // 创建会话回调 - public func onConversationCreated(_ conversation: V2NIMConversation) { + open func onConversationCreated(_ conversation: V2NIMConversation) { NEALog.infoLog(ModuleName + " " + className, desc: #function + ", did add session targetId:" + conversation.conversationId) if checkDismissTeamNoti(conversation) { return @@ -250,7 +250,7 @@ open class ConversationViewModel: NSObject, NEConversationListener, NETeamListen /// 会话变更 /// - Parameter conversations 会话列表 - public func onConversationChanged(_ conversations: [V2NIMConversation]) { + open func onConversationChanged(_ conversations: [V2NIMConversation]) { // 置顶逻辑处理 filterStickTopData(conversations) @@ -272,7 +272,7 @@ open class ConversationViewModel: NSObject, NEConversationListener, NETeamListen /// 会话删除 /// - Parameter conversationIds: 会话id列表 - public func onConversationDeleted(_ conversationIds: [String]) { + open func onConversationDeleted(_ conversationIds: [String]) { var removeFlagSet = Set() for id in conversationIds { removeFlagSet.insert(id) @@ -295,7 +295,7 @@ open class ConversationViewModel: NSObject, NEConversationListener, NETeamListen /// 检查会话是否包含解散通知的变更 /// - Parameter conversation: 会话 - public func checkDismissTeamNoti(_ conversation: V2NIMConversation) -> Bool { + open func checkDismissTeamNoti(_ conversation: V2NIMConversation) -> Bool { if IMKitConfigCenter.shared.enabledismissTeamDeleteConversation == false { return false } @@ -367,7 +367,7 @@ open class ConversationViewModel: NSObject, NEConversationListener, NETeamListen /// 撤回通知监听 /// - Parameter revokeNotifications: 撤回通知列表 - public func onMessageRevokeNotifications(_ revokeNotifications: [V2NIMMessageRevokeNotification]) { + open func onMessageRevokeNotifications(_ revokeNotifications: [V2NIMMessageRevokeNotification]) { NEALog.infoLog(ModuleName + " " + className(), desc: #function + "onMessageRevokeNotifications ids: \(revokeNotifications.map { $0.messageRefer?.messageServerId })") for messageRevoke in revokeNotifications { @@ -390,7 +390,7 @@ open class ConversationViewModel: NSObject, NEConversationListener, NETeamListen /// 收到点对点已读回执 /// - Parameter readReceipts: 已读回执 - public func onReceiveP2PMessageReadReceipts(_ readReceipts: [V2NIMP2PMessageReadReceipt]) { + open func onReceiveP2PMessageReadReceipts(_ readReceipts: [V2NIMP2PMessageReadReceipt]) { NEALog.infoLog(ModuleName + " " + className, desc: #function + "onReceive p2p readReceipts count: \(readReceipts.count)") for receipt in readReceipts { if let cid = receipt.conversationId { @@ -404,13 +404,13 @@ open class ConversationViewModel: NSObject, NEConversationListener, NETeamListen /// 加入群回调 /// - Parameter team: 群信息 - public func onTeamJoined(_ team: V2NIMTeam) {} + open func onTeamJoined(_ team: V2NIMTeam) {} /// 建群回调 /// - Parameter team: 群信息 - public func onTeamCreated(_ team: V2NIMTeam) {} + open func onTeamCreated(_ team: V2NIMTeam) {} - public func onTeamLeft(_ team: V2NIMTeam, isKicked: Bool) { + open func onTeamLeft(_ team: V2NIMTeam, isKicked: Bool) { NEALog.infoLog(className(), desc: "conversation onTeamLeft team id: \(team.teamId) team name : \(team.name) isKicked : \(isKicked)") if let cid = V2NIMConversationIdUtil.teamConversationId(team.teamId) { didDeleteConversation(cid) @@ -419,7 +419,7 @@ open class ConversationViewModel: NSObject, NEConversationListener, NETeamListen /// 群解散回调 /// - Parameter team: 群信息 - public func onTeamDismissed(_ team: V2NIMTeam) { + open func onTeamDismissed(_ team: V2NIMTeam) { NEALog.infoLog(className(), desc: "onTeamDismissed team id : \(team.teamId) team name: \(team.name)") if IMKitConfigCenter.shared.enabledismissTeamDeleteConversation { if let cid = V2NIMConversationIdUtil.teamConversationId(team.teamId) { @@ -454,12 +454,12 @@ open class ConversationViewModel: NSObject, NEConversationListener, NETeamListen } } - public func onConversationSyncFinished() { + open func onConversationSyncFinished() { NEALog.infoLog(className(), desc: "onConversationSyncFinished") delegate?.reloadTableView() } - public func onDataSync(_ type: V2NIMDataSyncType, state: V2NIMDataSyncState, error: V2NIMError?) { + open func onDataSync(_ type: V2NIMDataSyncType, state: V2NIMDataSyncState, error: V2NIMError?) { if type == .DATA_SYNC_TYPE_MAIN, state == .DATA_SYNC_STATE_COMPLETED { /// 设置同步完成标识 syncFinished = true @@ -479,7 +479,7 @@ open class ConversationViewModel: NSObject, NEConversationListener, NETeamListen } /// 发生重连的情况重新获取数据 - public func retrieveConversationDatas() { + open func retrieveConversationDatas() { var limit = 0 if conversationDic.count > page { limit = conversationDic.count @@ -508,33 +508,33 @@ open class ConversationViewModel: NSObject, NEConversationListener, NETeamListen } } - public func onFriendDeleted(_ accountId: String, deletionType: V2NIMFriendDeletionType) { + open func onFriendDeleted(_ accountId: String, deletionType: V2NIMFriendDeletionType) { delegate?.reloadTableView() } - public func onTeamSyncFinished() { + open func onTeamSyncFinished() { delegate?.reloadTableView() } - public func onConversationSyncFailed(_ error: V2NIMError) { + open func onConversationSyncFailed(_ error: V2NIMError) { NEALog.infoLog(className(), desc: "onConversationSyncFailed : \(error.desc)") } /// 好友信息缓存更新 /// - Parameter accountId: 用户 id - public func onFriendInfoChanged(_ friendInfo: V2NIMFriend) { + open func onFriendInfoChanged(_ friendInfo: V2NIMFriend) { NEALog.infoLog(className(), desc: "onFriendInfoUpdate : \(String(describing: friendInfo.accountId))") delegate?.reloadTableView() } // MARK: Pin Manager Listener - public func userInfoDidChange() { + open func userInfoDidChange() { NEALog.infoLog(className(), desc: #function + "" + "conversaion view model userInfoDidChange") getAIUserList() } - public func onAIUserChanged(aiUsers: [V2NIMAIUser]) { + open func onAIUserChanged(aiUsers: [V2NIMAIUser]) { aiUserListData.removeAll() weak var weakSelf = self for aiUser in aiUsers { diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/Manager/NEAtMessageManager.swift b/NEConversationUIKit/NEConversationUIKit/Classes/Manager/NEAtMessageManager.swift index 3504e09c..29335de9 100644 --- a/NEConversationUIKit/NEConversationUIKit/Classes/Manager/NEAtMessageManager.swift +++ b/NEConversationUIKit/NEConversationUIKit/Classes/Manager/NEAtMessageManager.swift @@ -52,7 +52,7 @@ open class NEAtMessageManager: NSObject, NEIMKitClientListener, NEChatListener { /// 登录状态变更 /// - Parameter status: 登录状态 - public func onLoginStatus(_ status: V2NIMLoginStatus) { + open func onLoginStatus(_ status: V2NIMLoginStatus) { if status == .LOGIN_STATUS_LOGINED { NEALog.infoLog(className(), desc: "login ok") currentAccid = IMKitClient.instance.account() @@ -69,7 +69,7 @@ open class NEAtMessageManager: NSObject, NEIMKitClientListener, NEChatListener { /// - Parameter type: 同步类型 /// - Parameter state: 同步状态 /// - Parameter error: 错误信息 - public func onDataSync(_ type: V2NIMDataSyncType, state: V2NIMDataSyncState, error: V2NIMError?) { + open func onDataSync(_ type: V2NIMDataSyncType, state: V2NIMDataSyncState, error: V2NIMError?) { if state == .DATA_SYNC_STATE_COMPLETED { if currentAccid.count <= 0 { currentAccid = IMKitClient.instance.account() @@ -441,7 +441,7 @@ open class NEAtMessageManager: NSObject, NEIMKitClientListener, NEChatListener { /// 撤回消息回调 /// - Parameter revokeNotifications: 撤回通知 - public func onMessageRevokeNotifications(_ revokeNotifications: [V2NIMMessageRevokeNotification]) { + open func onMessageRevokeNotifications(_ revokeNotifications: [V2NIMMessageRevokeNotification]) { var messageRefers = [V2NIMMessageRefer]() for notification in revokeNotifications { if let messageRefer = notification.messageRefer { @@ -504,7 +504,7 @@ open class NEAtMessageManager: NSObject, NEIMKitClientListener, NEChatListener { /// 收到消息回调 /// - Parameter messages: 消息列表 - public func onReceiveMessages(_ messages: [V2NIMMessage]) { + open func onReceiveMessages(_ messages: [V2NIMMessage]) { filterAtMessage(messages: messages) } } diff --git a/NEMapKit/NEMapKit.podspec b/NEMapKit/NEMapKit.podspec index 8aa1a056..728c4299 100644 --- a/NEMapKit/NEMapKit.podspec +++ b/NEMapKit/NEMapKit.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'NEMapKit' - s.version = '10.5.0' + s.version = '10.5.1' s.summary = 'Netease XKit' # This description is used to generate tags and improve search results. diff --git a/NEMapKit/NEMapKit/Assets/en.lproj/Localizable.strings b/NEMapKit/NEMapKit/Assets/en.lproj/Localizable.strings deleted file mode 100644 index f3789504..00000000 --- a/NEMapKit/NEMapKit/Assets/en.lproj/Localizable.strings +++ /dev/null @@ -1,9 +0,0 @@ - -"gaode_map"="高德 Map"; -"tencent_map"="腾讯 Map"; -"cancel"="cancel"; -"search_cancel"="cancel"; -"send"="send"; -"search_result_empty"="Not found"; -"search_place"="Search Location"; -"no_location"="Please select the location you want to send"; diff --git a/NEMapKit/NEMapKit/Assets/zh-Hans.lproj/Localizable.strings b/NEMapKit/NEMapKit/Assets/zh-Hans.lproj/Localizable.strings deleted file mode 100644 index 3b873609..00000000 --- a/NEMapKit/NEMapKit/Assets/zh-Hans.lproj/Localizable.strings +++ /dev/null @@ -1,10 +0,0 @@ - -"gaode_map"="高德地图"; -"tencent_map"="腾讯地图"; -"cancel"="取消"; -"search_cancel"="取消"; -"send"="发送"; -"search_result_empty"="未找到你要搜的地址"; -"search_place"="搜索地点"; -"no_location"="请选择你要发送的位置信息"; - diff --git a/NEMapKit/NEMapKit/Classes/Controller/NELocationViewController.swift b/NEMapKit/NEMapKit/Classes/Controller/NELocationViewController.swift index bc8373b2..2f07b7ab 100644 --- a/NEMapKit/NEMapKit/Classes/Controller/NELocationViewController.swift +++ b/NEMapKit/NEMapKit/Classes/Controller/NELocationViewController.swift @@ -50,7 +50,7 @@ open class NELocationViewController: UIViewController, NELocationBottomViewDeleg let button = ExpandButton() button.translatesAutoresizingMaskIntoConstraints = false button.setTitleColor(.white, for: .normal) - button.setTitle(mapLocalizable("cancel"), for: .normal) + button.setTitle(commonLocalizable("cancel"), for: .normal) button.titleLabel?.font = UIFont.systemFont(ofSize: 16) button.addTarget(self, action: #selector(cancelBtnClick), for: .touchUpInside) return button @@ -60,7 +60,7 @@ open class NELocationViewController: UIViewController, NELocationBottomViewDeleg lazy var searchCancelButton: ExpandButton = { let button = ExpandButton() button.translatesAutoresizingMaskIntoConstraints = false - button.setTitle(mapLocalizable("search_cancel"), for: .normal) + button.setTitle(commonLocalizable("cancel"), for: .normal) button.setTitleColor(UIColor.ne_emptyTitleColor, for: .normal) button.titleLabel?.font = UIFont.systemFont(ofSize: 14.0) button.addTarget(self, action: #selector(cancelSearch), for: .touchUpInside) diff --git a/NETeamUIKit/NETeamUIKit.podspec b/NETeamUIKit/NETeamUIKit.podspec index fc6a264c..e3d20817 100644 --- a/NETeamUIKit/NETeamUIKit.podspec +++ b/NETeamUIKit/NETeamUIKit.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'NETeamUIKit' - s.version = '10.5.0' + s.version = '10.5.1' s.summary = 'Netease XKit' # This description is used to generate tags and improve search results. diff --git a/NETeamUIKit/NETeamUIKit/Classes/Common/NETeamBaseViewController.swift b/NETeamUIKit/NETeamUIKit/Classes/Common/NETeamBaseViewController.swift new file mode 100644 index 00000000..ef736f6c --- /dev/null +++ b/NETeamUIKit/NETeamUIKit/Classes/Common/NETeamBaseViewController.swift @@ -0,0 +1,113 @@ + +// Copyright (c) 2022 NetEase, Inc. All rights reserved. +// Use of this source code is governed by a MIT license that can be +// found in the LICENSE file. + +import NECommonKit +import UIKit + +/// UI 模块 ViewController 基类 +@objcMembers +open class NETeamBaseViewController: UIViewController, UIGestureRecognizerDelegate { + public var topConstant: CGFloat = 0 { + didSet { + navigationViewHeightAnchor?.constant = topConstant + } + } + + // 自定义导航栏高度布局约束 + public var navigationViewHeightAnchor: NSLayoutConstraint? + + // 自定义导航栏 + public let navigationView = NENavigationView() + + override open var title: String? { + get { + super.title + } + + set { + super.title = newValue + navigationView.navTitle.text = newValue + } + } + + override public init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { + super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) + } + + public required init?(coder: NSCoder) { + super.init(coder: coder) + } + + override open func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + + if let useSystemNav = NEConfigManager.instance.getParameter(key: useSystemNav) as? Bool, useSystemNav { + navigationController?.isNavigationBarHidden = false + navigationView.removeFromSuperview() + setupBackUI() + } else { + navigationController?.isNavigationBarHidden = true + } + } + + override open func viewDidLoad() { + super.viewDidLoad() + view.backgroundColor = .white + + if let useSystemNav = NEConfigManager.instance.getParameter(key: useSystemNav) as? Bool, useSystemNav { + topConstant = NEConstant.navigationAndStatusHeight + } else { + topConstant = NEConstant.navigationAndStatusHeight + navigationView.translatesAutoresizingMaskIntoConstraints = false + navigationView.addBackButtonTarget(target: self, selector: #selector(backEvent)) + navigationView.addMoreButtonTarget(target: self, selector: #selector(toSetting)) + + view.addSubview(navigationView) + navigationViewHeightAnchor = navigationView.heightAnchor.constraint(equalToConstant: topConstant) + navigationViewHeightAnchor?.isActive = true + NSLayoutConstraint.activate([ + navigationView.leftAnchor.constraint(equalTo: view.leftAnchor), + navigationView.rightAnchor.constraint(equalTo: view.rightAnchor), + navigationView.topAnchor.constraint(equalTo: view.topAnchor), + ]) + } + } + + private func setupBackUI() { + let image = coreLoader.loadImage("backArrow")?.withRenderingMode(.alwaysOriginal) + let backItem = UIBarButtonItem( + image: image, + style: .plain, + target: self, + action: #selector(backEvent) + ) + backItem.accessibilityIdentifier = "id.backArrow" + + navigationItem.leftBarButtonItem = backItem + navigationController?.navigationBar.topItem?.backBarButtonItem = UIBarButtonItem() + navigationController?.navigationBar.topItem?.backBarButtonItem?.tintColor = .ne_darkText + } + + open func backEvent() { + navigationController?.popViewController(animated: true) + } + + open func toSetting() { + // 子类重写 + } + + open func addLeftSwipeDismissGesture() { + // 侧滑返回(根视图) + let gestureRecognizer = UIScreenEdgePanGestureRecognizer(target: self, action: #selector(swipeDismiss)) + gestureRecognizer.edges = .left + view.addGestureRecognizer(gestureRecognizer) + } + + func swipeDismiss(_ gestureRecognizer: UIScreenEdgePanGestureRecognizer) { + if gestureRecognizer.state == .ended { + navigationController?.dismiss(animated: true, completion: nil) + } + } +} diff --git a/NETeamUIKit/NETeamUIKit/Classes/Common/NETeamLoaderService.swift b/NETeamUIKit/NETeamUIKit/Classes/Common/NETeamLoaderService.swift index fbedd9ec..0bed69e3 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Common/NETeamLoaderService.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Common/NETeamLoaderService.swift @@ -15,7 +15,7 @@ public class NETeamLoaderService: NSObject { /// 初始化方法 /// 此方法会在模块被加载时调用 - public func setupInit() { + open func setupInit() { ChatKitClient.shared.registerInit(NETeamService.shared) } } diff --git a/NETeamUIKit/NETeamUIKit/Classes/Common/NETeamService.swift b/NETeamUIKit/NETeamUIKit/Classes/Common/NETeamService.swift index af64a325..2d14c630 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Common/NETeamService.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Common/NETeamService.swift @@ -14,13 +14,13 @@ public class NETeamService: NSObject, ChatServiceDelegate { /// 注册 NETeamUIKit 初始化协议 /// - Parameter params: 初始化参数 - public func setupInit(_ params: [String: Any]?) { + open func setupInit(_ params: [String: Any]?) { registerRouter(params) } /// 注册路由 /// - Parameter param: 参数 - public func registerRouter(_ param: [String: Any]?) { + open func registerRouter(_ param: [String: Any]?) { if let isFun = param?["isFun"] as? Bool, isFun { TeamRouter.registerFun() } else { diff --git a/NETeamUIKit/NETeamUIKit/Classes/FunUI/Cell/FunTeamArrowSettingCell.swift b/NETeamUIKit/NETeamUIKit/Classes/FunUI/Cell/FunTeamArrowSettingCell.swift index 84376b62..cf720281 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/FunUI/Cell/FunTeamArrowSettingCell.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/FunUI/Cell/FunTeamArrowSettingCell.swift @@ -6,7 +6,7 @@ import UIKit @objcMembers open class FunTeamArrowSettingCell: NEBaseTeamArrowSettingCell { - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) edgeInset = .zero } diff --git a/NETeamUIKit/NETeamUIKit/Classes/FunUI/Cell/FunTeamSettingHeaderCell.swift b/NETeamUIKit/NETeamUIKit/Classes/FunUI/Cell/FunTeamSettingHeaderCell.swift index da5aa492..dc88e553 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/FunUI/Cell/FunTeamSettingHeaderCell.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/FunUI/Cell/FunTeamSettingHeaderCell.swift @@ -7,7 +7,7 @@ import UIKit @objcMembers open class FunTeamSettingHeaderCell: NEBaseTeamSettingHeaderCell { - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) edgeInset = .zero } diff --git a/NETeamUIKit/NETeamUIKit/Classes/FunUI/Cell/FunTeamSettingSelectCell.swift b/NETeamUIKit/NETeamUIKit/Classes/FunUI/Cell/FunTeamSettingSelectCell.swift index f73b7af6..f5c1973d 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/FunUI/Cell/FunTeamSettingSelectCell.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/FunUI/Cell/FunTeamSettingSelectCell.swift @@ -6,7 +6,7 @@ import UIKit @objcMembers open class FunTeamSettingSelectCell: NEBaseTeamSettingSelectCell { - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) edgeInset = .zero } diff --git a/NETeamUIKit/NETeamUIKit/Classes/FunUI/Cell/FunTeamSettingSwitchCell.swift b/NETeamUIKit/NETeamUIKit/Classes/FunUI/Cell/FunTeamSettingSwitchCell.swift index 681ad4ca..458f5dff 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/FunUI/Cell/FunTeamSettingSwitchCell.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/FunUI/Cell/FunTeamSettingSwitchCell.swift @@ -6,7 +6,7 @@ import UIKit @objcMembers open class FunTeamSettingSwitchCell: NEBaseTeamSettingSwitchCell { - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) edgeInset = .zero } diff --git a/NETeamUIKit/NETeamUIKit/Classes/FunUI/Controller/FunTeamInfoViewController.swift b/NETeamUIKit/NETeamUIKit/Classes/FunUI/Controller/FunTeamInfoViewController.swift index 9e399574..b3e5aa58 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/FunUI/Controller/FunTeamInfoViewController.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/FunUI/Controller/FunTeamInfoViewController.swift @@ -7,7 +7,7 @@ import UIKit @objcMembers open class FunTeamInfoViewController: NEBaseTeamInfoViewController { - override init(team: V2NIMTeam?) { + override public init(team: V2NIMTeam?) { super.init(team: team) registerCellDic = [ SettingCellType.SettingArrowCell.rawValue: FunTeamArrowSettingCell.self, diff --git a/NETeamUIKit/NETeamUIKit/Classes/FunUI/Controller/FunTeamManagerListController.swift b/NETeamUIKit/NETeamUIKit/Classes/FunUI/Controller/FunTeamManagerListController.swift index 0c0eeb52..4cea9777 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/FunUI/Controller/FunTeamManagerListController.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/FunUI/Controller/FunTeamManagerListController.swift @@ -7,7 +7,7 @@ import UIKit @objcMembers open class FunTeamManagerListController: NEBaseTeamManagerListController { - override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { + override public init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) // key 值 为 tableview section 对应的值 cellClassDic = [0: FunTeamArrowSettingCell.self, 1: FunTeamManagerMemberCell.self] diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/Common/NETeamMemberCache.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/Common/NETeamMemberCache.swift index e0436ffe..a8ea8470 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/Common/NETeamMemberCache.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/Common/NETeamMemberCache.swift @@ -57,13 +57,13 @@ open class NETeamMemberCache: NSObject, NETeamListener, NEIMKitClientListener, N /// 添加缓存监听 /// - Parameter listener: 缓存监听 - public func addTeamCacheListener(_ listener: NETeamMemberCacheListener) { + open func addTeamCacheListener(_ listener: NETeamMemberCacheListener) { teamMemberCacheMultiDelegate.addDelegate(listener) } /// 移除缓存监听 /// - Parameter listener: 缓存监听 - public func removeTeamCacheListener(_ listener: NETeamMemberCacheListener) { + open func removeTeamCacheListener(_ listener: NETeamMemberCacheListener) { teamMemberCacheMultiDelegate.removeDelegate(listener) } @@ -91,7 +91,7 @@ open class NETeamMemberCache: NSObject, NETeamListener, NEIMKitClientListener, N /// 设置缓存(对一个新群设置缓存会移除之前群的缓存,单例只保存一个群的成员缓存) /// - Parameter teamId: 群id /// - Parameter members: 群成员数据对象列表 - public func setCacheMembers(_ teamId: String, _ members: [NETeamMemberInfoModel]) { + open func setCacheMembers(_ teamId: String, _ members: [NETeamMemberInfoModel]) { cacheDic.removeAll() currentTeamId = teamId endTimer() @@ -105,7 +105,7 @@ open class NETeamMemberCache: NSObject, NETeamListener, NEIMKitClientListener, N /// 获取缓存 /// - Parameter teamId: 群id /// - returns 群成员缓存数据(可能为空) - public func getTeamMemberCache(_ teamId: String) -> [NETeamMemberInfoModel]? { + open func getTeamMemberCache(_ teamId: String) -> [NETeamMemberInfoModel]? { if currentTeamId == teamId { var allCacheMembers = Array(cacheDic.values) allCacheMembers.sort { model1, model2 in @@ -122,7 +122,7 @@ open class NETeamMemberCache: NSObject, NETeamListener, NEIMKitClientListener, N } /// 判断是否是当前群成员 - public func isCurrentMember(_ accountId: String) -> Bool { + open func isCurrentMember(_ accountId: String) -> Bool { if cacheDic[accountId] != nil { return true } else { @@ -132,7 +132,7 @@ open class NETeamMemberCache: NSObject, NETeamListener, NEIMKitClientListener, N /// 好友信息更新 /// - Parameter friendInfo: 好友信息 - public func onFriendInfoChanged(_ friendInfo: V2NIMFriend) { + open func onFriendInfoChanged(_ friendInfo: V2NIMFriend) { if let account = friendInfo.accountId, let model = cacheDic[account] { model.nimUser = NEUserWithFriend(friend: friendInfo) updateFinish() @@ -141,7 +141,7 @@ open class NETeamMemberCache: NSObject, NETeamListener, NEIMKitClientListener, N /// 用户信息变更 /// - Parameter users: 变更用户 - public func onUserProfileChanged(_ users: [V2NIMUser]) { + open func onUserProfileChanged(_ users: [V2NIMUser]) { NEALog.infoLog(className(), desc: #function + " onUserProfileChanged count : \(users.count)") var needUpdate = false for user in users { @@ -158,7 +158,7 @@ open class NETeamMemberCache: NSObject, NETeamListener, NEIMKitClientListener, N /// 好友删除 /// - parameter accountId: 账号id /// - parameter deletionType: 删除类型 - public func onFriendDeleted(_ accountId: String, deletionType: V2NIMFriendDeletionType) { + open func onFriendDeleted(_ accountId: String, deletionType: V2NIMFriendDeletionType) { if let model = cacheDic[accountId] { model.nimUser?.friend = nil } @@ -166,14 +166,14 @@ open class NETeamMemberCache: NSObject, NETeamListener, NEIMKitClientListener, N /// 登录状态改变 /// - Parameter status: 登录状态枚举 - public func onLoginStatus(_ status: V2NIMLoginStatus) { + open func onLoginStatus(_ status: V2NIMLoginStatus) { if status == .LOGIN_STATUS_LOGOUT { clearCache() } } /// 加入回调 - public func onTeamJoined(_ team: V2NIMTeam) { + open func onTeamJoined(_ team: V2NIMTeam) { if team.teamId == currentTeamId { clearCache() updateFinish() @@ -182,32 +182,32 @@ open class NETeamMemberCache: NSObject, NETeamListener, NEIMKitClientListener, N /// 群成员离开回调 /// - Parameter teamMembers: 群成员 - public func onTeamMemberLeft(_ teamMembers: [V2NIMTeamMember]) { + open func onTeamMemberLeft(_ teamMembers: [V2NIMTeamMember]) { onMemberDidRemove(teamMembers) } /// 群成员被踢回调 /// - Parameter operatorAccountId: 操作者id /// - Parameter teamMembers: 群成员 - public func onTeamMemberKicked(_ operatorAccountId: String, teamMembers: [V2NIMTeamMember]) { + open func onTeamMemberKicked(_ operatorAccountId: String, teamMembers: [V2NIMTeamMember]) { onMemberDidRemove(teamMembers) } /// 群成员加入回调 /// - Parameter teamMembers: 群成员 - public func onTeamMemberJoined(_ teamMembers: [V2NIMTeamMember]) { + open func onTeamMemberJoined(_ teamMembers: [V2NIMTeamMember]) { onMemberDidAdd(teamMembers) } /// 群成员更新回调 /// - Parameter teamMembers: 群成员列表 - public func onTeamMemberInfoUpdated(_ teamMembers: [V2NIMTeamMember]) { + open func onTeamMemberInfoUpdated(_ teamMembers: [V2NIMTeamMember]) { onMemberDidChanged(teamMembers) } /// 群聊解散回调 /// - Parameter team: 群对象 - public func onTeamDismissed(_ team: V2NIMTeam) { + open func onTeamDismissed(_ team: V2NIMTeam) { if team.teamId == currentTeamId { clearCache() } @@ -267,14 +267,14 @@ open class NETeamMemberCache: NSObject, NETeamListener, NEIMKitClientListener, N } /// 清除缓存 - public func clearCache() { + open func clearCache() { currentTeamId = "" cacheDic.removeAll() endTimer() } /// 定时移除缓存 - public func triggerClearCache() { + open func triggerClearCache() { NEALog.infoLog(className(), desc: "triggerClearCache") clearCache() } @@ -290,7 +290,7 @@ open class NETeamMemberCache: NSObject, NETeamListener, NEIMKitClientListener, N timer = nil } - public func updateFinish() { + open func updateFinish() { teamMemberCacheMultiDelegate |> { delegate in delegate.memberCacheDidChange?() } @@ -300,9 +300,9 @@ open class NETeamMemberCache: NSObject, NETeamListener, NEIMKitClientListener, N /// - Parameter teamId: 群id /// - Parameter queryType: 查询类型 /// - Parameter completion: 完成后的回调 - public func getAllTeamMemberInfos(_ teamId: String, - _ queryType: V2NIMTeamMemberRoleQueryType, - _ completion: @escaping (NSError?, NETeamInfoModel?) -> Void) { + open func getAllTeamMemberInfos(_ teamId: String, + _ queryType: V2NIMTeamMemberRoleQueryType, + _ completion: @escaping (NSError?, NETeamInfoModel?) -> Void) { NEALog.infoLog(ModuleName + " " + className(), desc: #function + ", teamid:\(teamId)") var memberLists = [V2NIMTeamMember]() weak var weakSelf = self @@ -323,7 +323,7 @@ open class NETeamMemberCache: NSObject, NETeamListener, NEIMKitClientListener, N /// 获取群成员(使用最大分页参数,防止触发频控) /// - Parameter teamId: 群ID /// - Parameter completion: 完成回调 - public func getAllTeamMemberWithMaxLimit(_ teamId: String, _ nextToken: String? = nil, _ memberList: inout [V2NIMTeamMember], _ queryType: V2NIMTeamMemberRoleQueryType, _ completion: @escaping ([V2NIMTeamMember]?, NSError?) -> Void) { + open func getAllTeamMemberWithMaxLimit(_ teamId: String, _ nextToken: String? = nil, _ memberList: inout [V2NIMTeamMember], _ queryType: V2NIMTeamMemberRoleQueryType, _ completion: @escaping ([V2NIMTeamMember]?, NSError?) -> Void) { NEALog.infoLog(className(), desc: #function + " teamId : \(teamId)") let option = V2NIMTeamMemberQueryOption() option.direction = .QUERY_DIRECTION_ASC @@ -407,7 +407,7 @@ open class NETeamMemberCache: NSObject, NETeamListener, NEIMKitClientListener, N } /// 群信息同步完成回调 - public func onTeamSyncFinished() { + open func onTeamSyncFinished() { NEALog.infoLog(className(), desc: #function + " onTeamSyncFinished call back happen") clearCache() updateFinish() diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamAvatarViewController.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamAvatarViewController.swift index 7bce0612..82c4b355 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamAvatarViewController.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamAvatarViewController.swift @@ -8,7 +8,7 @@ import NIMSDK import UIKit @objcMembers -open class NEBaseTeamAvatarViewController: NEBaseViewController, UICollectionViewDelegate, +open class NEBaseTeamAvatarViewController: NETeamBaseViewController, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, UINavigationControllerDelegate, UIImagePickerControllerDelegate { public typealias SaveCompletion = () -> Void public var block: SaveCompletion? diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamHistoryMessageController.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamHistoryMessageController.swift index 1a9b408e..a674fecd 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamHistoryMessageController.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamHistoryMessageController.swift @@ -8,7 +8,7 @@ import NIMSDK import UIKit @objcMembers -open class NEBaseTeamHistoryMessageController: NEBaseViewController, UITextFieldDelegate, +open class NEBaseTeamHistoryMessageController: NETeamBaseViewController, UITextFieldDelegate, UITableViewDelegate, UITableViewDataSource { public let viewModel = TeamHistoryMessageViewModel() @@ -34,11 +34,10 @@ open class NEBaseTeamHistoryMessageController: NEBaseViewController, UITextField tableView.sectionFooterHeight = 0 tableView.keyboardDismissMode = .onDrag - if #available(iOS 11.0, *) { - tableView.estimatedRowHeight = 0 - tableView.estimatedSectionHeaderHeight = 0 - tableView.estimatedSectionFooterHeight = 0 - } + tableView.estimatedRowHeight = 0 + tableView.estimatedSectionHeaderHeight = 0 + tableView.estimatedSectionFooterHeight = 0 + if #available(iOS 15.0, *) { tableView.sectionHeaderTopPadding = 0.0 } @@ -172,7 +171,7 @@ open class NEBaseTeamHistoryMessageController: NEBaseViewController, UITextField } /// 监听键盘搜索按钮点击 - public func textFieldShouldReturn(_ textField: UITextField) -> Bool { + open func textFieldShouldReturn(_ textField: UITextField) -> Bool { if NEChatDetectNetworkTool.shareInstance.manager?.isReachable == false { showToast(commonLocalizable("network_error")) return false diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamInfoViewController.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamInfoViewController.swift index 049043b6..cd42e706 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamInfoViewController.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamInfoViewController.swift @@ -8,7 +8,7 @@ import NIMSDK import UIKit @objcMembers -open class NEBaseTeamInfoViewController: NEBaseViewController, UITableViewDelegate, +open class NEBaseTeamInfoViewController: NETeamBaseViewController, UITableViewDelegate, UITableViewDataSource, NETeamInfoDelegate { public let viewModel = TeamInfoViewModel() @@ -26,18 +26,17 @@ open class NEBaseTeamInfoViewController: NEBaseViewController, UITableViewDelega tableView.sectionHeaderHeight = 0 tableView.keyboardDismissMode = .onDrag - if #available(iOS 11.0, *) { - tableView.estimatedRowHeight = 0 - tableView.estimatedSectionHeaderHeight = 0 - tableView.estimatedSectionFooterHeight = 0 - } + tableView.estimatedRowHeight = 0 + tableView.estimatedSectionHeaderHeight = 0 + tableView.estimatedSectionFooterHeight = 0 + if #available(iOS 15.0, *) { tableView.sectionHeaderTopPadding = 0.0 } return tableView }() - init(team: V2NIMTeam?) { + public init(team: V2NIMTeam?) { super.init(nibName: nil, bundle: nil) self.team = team } @@ -100,7 +99,7 @@ open class NEBaseTeamInfoViewController: NEBaseViewController, UITableViewDelega return model.rowHeight } - public func teamInfoDidUpdate(_ t: V2NIMTeam) { + open func teamInfoDidUpdate(_ t: V2NIMTeam) { team = t contentTableView.reloadData() } diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamIntroduceViewController.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamIntroduceViewController.swift index de45dc34..60533ee4 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamIntroduceViewController.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamIntroduceViewController.swift @@ -8,7 +8,7 @@ import NIMSDK import UIKit @objcMembers -open class NEBaseTeamIntroduceViewController: NEBaseViewController, UITextViewDelegate { +open class NEBaseTeamIntroduceViewController: NETeamBaseViewController, UITextViewDelegate { public var team: V2NIMTeam? public let textLimit = 100 public let backView = UIView() @@ -166,7 +166,7 @@ open class NEBaseTeamIntroduceViewController: NEBaseViewController, UITextViewDe /// - Parameter textView: 文本控件对象 /// - Parameter range: 变更范围 /// - Parameter text: 变更内容 - public func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { + open func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { if !text.isEmpty { let finalStr = (textView.text as NSString).replacingCharacters(in: range, with: text) if finalStr.utf16.count > textLimit { diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamManagerController.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamManagerController.swift index d2decf1b..d184be13 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamManagerController.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamManagerController.swift @@ -8,7 +8,7 @@ import NIMSDK import UIKit @objcMembers -open class NEBaseTeamManagerController: NEBaseViewController, UITableViewDelegate, UITableViewDataSource, TeamManagerViewModelDelegate { +open class NEBaseTeamManagerController: NETeamBaseViewController, UITableViewDelegate, UITableViewDataSource, TeamManagerViewModelDelegate { public let viewModel = TeamManagerViewModel() /// UI样式注册(用户可以自定义) @@ -29,11 +29,10 @@ open class NEBaseTeamManagerController: NEBaseViewController, UITableViewDelegat UIView(frame: CGRect(x: 0, y: 0, width: view.frame.size.width, height: 12)) tableView.keyboardDismissMode = .onDrag - if #available(iOS 11.0, *) { - tableView.estimatedRowHeight = 0 - tableView.estimatedSectionHeaderHeight = 0 - tableView.estimatedSectionFooterHeight = 0 - } + tableView.estimatedRowHeight = 0 + tableView.estimatedSectionHeaderHeight = 0 + tableView.estimatedSectionFooterHeight = 0 + if #available(iOS 15.0, *) { tableView.sectionHeaderTopPadding = 0.0 } diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamManagerListController.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamManagerListController.swift index 293f6a31..396f4b21 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamManagerListController.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamManagerListController.swift @@ -8,7 +8,7 @@ import NECommonUIKit import UIKit @objcMembers -open class NEBaseTeamManagerListController: NEBaseViewController, UITableViewDelegate, UITableViewDataSource, TeamMemberCellDelegate, TeamManagerListViewModelDelegate { +open class NEBaseTeamManagerListController: NETeamBaseViewController, UITableViewDelegate, UITableViewDataSource, TeamMemberCellDelegate, TeamManagerListViewModelDelegate { public var teamId: String? let viewmodel = TeamManagerListViewModel() @@ -28,11 +28,10 @@ open class NEBaseTeamManagerListController: NEBaseViewController, UITableViewDel UIView(frame: CGRect(x: 0, y: 0, width: view.frame.size.width, height: 12)) tableView.keyboardDismissMode = .onDrag - if #available(iOS 11.0, *) { - tableView.estimatedRowHeight = 0 - tableView.estimatedSectionHeaderHeight = 0 - tableView.estimatedSectionFooterHeight = 0 - } + tableView.estimatedRowHeight = 0 + tableView.estimatedSectionHeaderHeight = 0 + tableView.estimatedSectionFooterHeight = 0 + if #available(iOS 15.0, *) { tableView.sectionHeaderTopPadding = 0.0 } diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamMemberSelectController.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamMemberSelectController.swift index 63940690..ae3c73b8 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamMemberSelectController.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamMemberSelectController.swift @@ -8,7 +8,7 @@ import UIKit public typealias NESelectTeamMemberBlock = ([NETeamMemberInfoModel]) -> Void @objcMembers -open class NEBaseTeamMemberSelectController: NEBaseViewController, UITableViewDelegate, UITableViewDataSource, UITextFieldDelegate, TeamMemberSelectViewModelDelegate { +open class NEBaseTeamMemberSelectController: NETeamBaseViewController, UITableViewDelegate, UITableViewDataSource, UITextFieldDelegate, TeamMemberSelectViewModelDelegate { public var selectMemberBlock: NESelectTeamMemberBlock? let viewModel = TeamMemberSelectViewModel() @@ -48,11 +48,10 @@ open class NEBaseTeamMemberSelectController: NEBaseViewController, UITableViewDe UIView(frame: CGRect(x: 0, y: 0, width: view.frame.size.width, height: 12)) tableView.keyboardDismissMode = .onDrag - if #available(iOS 11.0, *) { - tableView.estimatedRowHeight = 0 - tableView.estimatedSectionHeaderHeight = 0 - tableView.estimatedSectionFooterHeight = 0 - } + tableView.estimatedRowHeight = 0 + tableView.estimatedSectionHeaderHeight = 0 + tableView.estimatedSectionFooterHeight = 0 + if #available(iOS 15.0, *) { tableView.sectionHeaderTopPadding = 0.0 } diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamMembersController.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamMembersController.swift index 22180fef..1769d348 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamMembersController.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamMembersController.swift @@ -11,7 +11,7 @@ import NIMSDK import UIKit @objcMembers -open class NEBaseTeamMembersController: NEBaseViewController, UITableViewDelegate, +open class NEBaseTeamMembersController: NETeamBaseViewController, UITableViewDelegate, UITableViewDataSource, TeamMemberCellDelegate, TeamMembersViewModelDelegate { /// 群id public var teamId: String? @@ -62,11 +62,10 @@ open class NEBaseTeamMembersController: NEBaseViewController, UITableViewDelegat UIView(frame: CGRect(x: 0, y: 0, width: view.frame.size.width, height: 12)) tableView.keyboardDismissMode = .onDrag - if #available(iOS 11.0, *) { - tableView.estimatedRowHeight = 0 - tableView.estimatedSectionHeaderHeight = 0 - tableView.estimatedSectionFooterHeight = 0 - } + tableView.estimatedRowHeight = 0 + tableView.estimatedSectionHeaderHeight = 0 + tableView.estimatedSectionFooterHeight = 0 + if #available(iOS 15.0, *) { tableView.sectionHeaderTopPadding = 0.0 } diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamNameViewController.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamNameViewController.swift index c46a4991..8ed78ed7 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamNameViewController.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamNameViewController.swift @@ -8,7 +8,7 @@ import NIMSDK import UIKit @objcMembers -open class NEBaseTeamNameViewController: NEBaseViewController, UITextViewDelegate { +open class NEBaseTeamNameViewController: NETeamBaseViewController, UITextViewDelegate { /// 群对象 public var team: V2NIMTeam? /// 修改类型 @@ -240,7 +240,7 @@ open class NEBaseTeamNameViewController: NEBaseViewController, UITextViewDelegat /// - Parameter textView: 文本控件对象 /// - Parameter range: 变更范围 /// - Parameter text: 变更内容 - public func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { + open func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { if !text.isEmpty { let finalStr = (textView.text as NSString).replacingCharacters(in: range, with: text) if finalStr.utf16.count > textLimit { diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamSettingViewController.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamSettingViewController.swift index 05de7853..3c733f50 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamSettingViewController.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamSettingViewController.swift @@ -9,7 +9,7 @@ import NIMSDK import UIKit @objcMembers -open class NEBaseTeamSettingViewController: NEBaseViewController, UICollectionViewDelegate, +open class NEBaseTeamSettingViewController: NETeamBaseViewController, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, UITableViewDataSource, UITableViewDelegate, TeamSettingViewModelDelegate { /// 数据管理类 @@ -45,11 +45,10 @@ open class NEBaseTeamSettingViewController: NEBaseViewController, UICollectionVi UIView(frame: CGRect(x: 0, y: 0, width: view.frame.size.width, height: 12)) tableView.keyboardDismissMode = .onDrag - if #available(iOS 11.0, *) { - tableView.estimatedRowHeight = 0 - tableView.estimatedSectionHeaderHeight = 0 - tableView.estimatedSectionFooterHeight = 0 - } + tableView.estimatedRowHeight = 0 + tableView.estimatedSectionHeaderHeight = 0 + tableView.estimatedSectionFooterHeight = 0 + if #available(iOS 15.0, *) { tableView.sectionHeaderTopPadding = 0.0 } @@ -189,7 +188,7 @@ open class NEBaseTeamSettingViewController: NEBaseViewController, UICollectionVi } /// 获取群设置数据 - public func requestSettingData(_ tid: String, _ member: V2NIMTeamMember) { + open func requestSettingData(_ tid: String, _ member: V2NIMTeamMember) { weak var weakSelf = self viewModel.getTeamWithMembers(tid) { error in NEALog.infoLog( @@ -228,7 +227,7 @@ open class NEBaseTeamSettingViewController: NEBaseViewController, UICollectionVi } /// 有数据返回之后重新刷新UI - public func resetupUI() { + open func resetupUI() { reloadSectionData() contentTableView.tableHeaderView = getHeaderView() contentTableView.tableFooterView = getFooterView() @@ -536,14 +535,14 @@ open class NEBaseTeamSettingViewController: NEBaseViewController, UICollectionVi } } - public func didClickMark() { + open func didClickMark() { if let tid = teamId { let conversationId = V2NIMConversationIdUtil.teamConversationId(tid) Router.shared.use(PushPinMessageVCRouter, parameters: ["nav": navigationController as Any, "conversationId": conversationId as Any], closure: nil) } } - public func didError(_ error: NSError) { + open func didError(_ error: NSError) { if error.code == protocolSendFailed { showToast(commonLocalizable("network_error")) } else { @@ -551,12 +550,12 @@ open class NEBaseTeamSettingViewController: NEBaseViewController, UICollectionVi } } - public func didShowNoNetworkToast() { + open func didShowNoNetworkToast() { showToast(commonLocalizable("network_error")) } /// 通知页面刷新回调 - public func didNeedRefreshUI() { + open func didNeedRefreshUI() { reloadSectionData() contentTableView.reloadData() refreshMemberCount() diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseHistoryMessageCell.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseHistoryMessageCell.swift index 93abb2ae..14e66da7 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseHistoryMessageCell.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseHistoryMessageCell.swift @@ -66,7 +66,7 @@ open class NEBaseHistoryMessageCell: UITableViewCell { return label }() - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) setupSubviews() } @@ -106,7 +106,7 @@ open class NEBaseHistoryMessageCell: UITableViewCell { /// - Parameter maxWidth: 最大宽度 /// - Parameter importantText: 关键字段 /// - Parameter fullText: 全文本 - public func truncateTextForLabel(_ label: UILabel, _ maxWidth: CGFloat, _ importantText: String, _ fullText: String) { + open func truncateTextForLabel(_ label: UILabel, _ maxWidth: CGFloat, _ importantText: String, _ fullText: String) { guard let font = label.font else { return } diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamArrowSettingCell.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamArrowSettingCell.swift index e5553638..a1e33503 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamArrowSettingCell.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamArrowSettingCell.swift @@ -7,7 +7,7 @@ import UIKit @objcMembers open class NEBaseTeamArrowSettingCell: NEBaseTeamSettingCell { - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) selectionStyle = .none setupUI() diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamMemberCell.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamMemberCell.swift index fcedc0de..05ea557e 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamMemberCell.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamMemberCell.swift @@ -72,7 +72,7 @@ open class NEBaseTeamMemberCell: UITableViewCell { return button }() - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) selectionStyle = .none setupUI() diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamSettingCell.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamSettingCell.swift index 14ee89c1..277d564f 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamSettingCell.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamSettingCell.swift @@ -36,7 +36,7 @@ open class NEBaseTeamSettingCell: CornerCell { return imageView }() - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) selectionStyle = .none contentView.backgroundColor = .clear diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamSettingHeaderCell.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamSettingHeaderCell.swift index b86c4f95..20c25429 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamSettingHeaderCell.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamSettingHeaderCell.swift @@ -15,7 +15,7 @@ open class NEBaseTeamSettingHeaderCell: NEBaseTeamSettingCell { return header }() - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) selectionStyle = .none setupUI() diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamSettingSelectCell.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamSettingSelectCell.swift index 20945da9..c189d049 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamSettingSelectCell.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamSettingSelectCell.swift @@ -16,7 +16,7 @@ open class NEBaseTeamSettingSelectCell: NEBaseTeamSettingCell { return label }() - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) selectionStyle = .none setupUI() diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamSettingSwitchCell.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamSettingSwitchCell.swift index 9da995f9..6391688b 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamSettingSwitchCell.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamSettingSwitchCell.swift @@ -14,7 +14,7 @@ open class NEBaseTeamSettingSwitchCell: NEBaseTeamSettingCell { return q }() - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) selectionStyle = .none setupUI() diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/View/TeamSettingSubtitleCell.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/View/TeamSettingSubtitleCell.swift index 8d67f245..39e669d6 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/View/TeamSettingSubtitleCell.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/View/TeamSettingSubtitleCell.swift @@ -20,7 +20,7 @@ open class TeamSettingSubtitleCell: NEBaseTeamSettingCell { return label }() - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) selectionStyle = .none setupUI() diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamAvatarViewModel.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamAvatarViewModel.swift index e7a8e18c..c212be8e 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamAvatarViewModel.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamAvatarViewModel.swift @@ -30,10 +30,10 @@ open class TeamAvatarViewModel: NSObject { /// - Parameter teamId : 群组ID /// - Parameter antispamConfig: 反垃圾配置 /// - Parameter completion: 完成后的回调 - public func updateTeamAvatar(_ url: String, - _ teamId: String, - _ antispamConfig: V2NIMAntispamConfig?, - _ completion: @escaping (NSError?) -> Void) { + open func updateTeamAvatar(_ url: String, + _ teamId: String, + _ antispamConfig: V2NIMAntispamConfig?, + _ completion: @escaping (NSError?) -> Void) { NEALog.infoLog(ModuleName + " " + className(), desc: #function + ", url:\(url)") teamRepo.updateTeamIcon(teamId, .TEAM_TYPE_NORMAL, url) { error in completion(error) @@ -43,8 +43,8 @@ open class TeamAvatarViewModel: NSObject { /// 创建文件上传任务 /// - Parameter filePath 文件路径 /// - Parameter sceneName 场景名 - public func createTask(_ filePath: String, - _ sceneName: String? = nil) -> V2NIMUploadFileTask { + open func createTask(_ filePath: String, + _ sceneName: String? = nil) -> V2NIMUploadFileTask { ResourceRepo.shared.createUploadFileTask(filePath, sceneName) } @@ -52,9 +52,9 @@ open class TeamAvatarViewModel: NSObject { /// - Parameter filepath: 上传文件路径 /// - Parameter progress: 进度回调 /// - Parameter completion: 完成回调 - public func uploadImageFile(_ fileTask: V2NIMUploadFileTask, - _ progress: ((Float) -> Void)?, - _ completion: ((String?, NSError?) -> Void)?) { + open func uploadImageFile(_ fileTask: V2NIMUploadFileTask, + _ progress: ((Float) -> Void)?, + _ completion: ((String?, NSError?) -> Void)?) { NEALog.infoLog(ModuleName + " " + className(), desc: #function + ", taskId:\(fileTask.taskId)") ResourceRepo.shared.upload(fileTask, progress, completion) } diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamHistoryMessageViewModel.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamHistoryMessageViewModel.swift index 0eef8ae0..0f40036c 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamHistoryMessageViewModel.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamHistoryMessageViewModel.swift @@ -38,7 +38,7 @@ open class TeamHistoryMessageViewModel: NSObject, NETeamListener { } /// 设置从上一个页面传入的成员 - public func setupCache() { + open func setupCache() { teamInfoModel?.users.forEach { member in if let accountId = member.teamMember?.accountId { memberModelCacheDic[accountId] = member @@ -122,7 +122,7 @@ open class TeamHistoryMessageViewModel: NSObject, NETeamListener { } /// 获取消息对应的用户信息 - public func bindMessageUserInfo(_ messages: [HistoryMessageModel], _ infoDic: [String: NETeamMemberInfoModel]) { + open func bindMessageUserInfo(_ messages: [HistoryMessageModel], _ infoDic: [String: NETeamMemberInfoModel]) { for message in messages { if let uid = ChatMessageHelper.getSenderId(message.imMessage) { if let member = infoDic[uid] { @@ -135,7 +135,7 @@ open class TeamHistoryMessageViewModel: NSObject, NETeamListener { } /// 获取群信息 - public func getTeamInfo(_ teamId: String?, _ completion: @escaping (V2NIMTeam?, NSError?) -> Void) { + open func getTeamInfo(_ teamId: String?, _ completion: @escaping (V2NIMTeam?, NSError?) -> Void) { guard let tid = teamId else { return } @@ -148,7 +148,7 @@ open class TeamHistoryMessageViewModel: NSObject, NETeamListener { /// - Parameter teamId: 群id /// - Parameter accounts: 群成员id列表 /// - Parameter completion: 完成回调 - public func getSearchMessageMembers(_ teamId: String, _ accounts: [String], _ completion: @escaping (NSError?, [NETeamMemberInfoModel]?) -> Void) { + open func getSearchMessageMembers(_ teamId: String, _ accounts: [String], _ completion: @escaping (NSError?, [NETeamMemberInfoModel]?) -> Void) { weak var weakSelf = self teamRepo.getTeamMemberListByIds(teamId, .TEAM_TYPE_NORMAL, accounts) { members, error in if let err = error { @@ -172,7 +172,7 @@ open class TeamHistoryMessageViewModel: NSObject, NETeamListener { /// 根据成员信息获取用户信息 /// - Parameter members: 群成员列表 /// - Parameter completion: 完成回调 - public func getUsersInfo(_ members: [V2NIMTeamMember], _ completion: @escaping (NSError?, [NETeamMemberInfoModel]?) -> Void) { + open func getUsersInfo(_ members: [V2NIMTeamMember], _ completion: @escaping (NSError?, [NETeamMemberInfoModel]?) -> Void) { var memberModels = [NETeamMemberInfoModel]() var accids = [String]() @@ -210,7 +210,7 @@ open class TeamHistoryMessageViewModel: NSObject, NETeamListener { /// 群成员变更回调 /// - parameter teamMembers: 群成员信息对象列表 - public func onTeamMemberInfoUpdated(_ teamMembers: [V2NIMTeamMember]) { + open func onTeamMemberInfoUpdated(_ teamMembers: [V2NIMTeamMember]) { guard let currentTeamId = teamInfoModel?.team?.teamId else { return } @@ -232,7 +232,7 @@ open class TeamHistoryMessageViewModel: NSObject, NETeamListener { extension TeamHistoryMessageViewModel: NEContactListener { /// 好友信息缓存更新 /// - Parameter accountId: 用户 id - public func onContactChange(_ changeType: NEContactChangeType, _ contacts: [NEUserWithFriend]) { + open func onContactChange(_ changeType: NEContactChangeType, _ contacts: [NEUserWithFriend]) { for contact in contacts { if let accid = contact.user?.accountId, memberModelCacheDic[accid] != nil { diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamInfoViewModel.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamInfoViewModel.swift index ea415ad3..ed3187b3 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamInfoViewModel.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamInfoViewModel.swift @@ -67,7 +67,7 @@ open class TeamInfoViewModel: NSObject, NETeamListener { /// 群信息更新 /// - Parameter team: 群 - public func onTeamInfoUpdated(_ team: V2NIMTeam) { + open func onTeamInfoUpdated(_ team: V2NIMTeam) { if let teamId = v2Team?.teamId, teamId == team.teamId { getData(team) delegate?.teamInfoDidUpdate(team) diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamIntroduceViewModel.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamIntroduceViewModel.swift index 42ca279f..92d912b5 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamIntroduceViewModel.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamIntroduceViewModel.swift @@ -30,8 +30,8 @@ open class TeamIntroduceViewModel: NSObject { /// - Parameter teamId: 群组ID /// - Parameter introduce: 群介绍 /// - Parameter completion: 完成后的回调 - public func updateTeamIntroduce(_ teamId: String, _ introduce: String, - _ completion: @escaping (NSError?) -> Void) { + open func updateTeamIntroduce(_ teamId: String, _ introduce: String, + _ completion: @escaping (NSError?) -> Void) { teamRepo.updateTeamIntroduce(teamId, .TEAM_TYPE_NORMAL, introduce) { error in completion(error) } diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamManagerListViewModel.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamManagerListViewModel.swift index 8a644f4f..676d2d30 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamManagerListViewModel.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamManagerListViewModel.swift @@ -132,28 +132,28 @@ open class TeamManagerListViewModel: NSObject, NETeamListener { /// 群成员离开 /// - Parameter teamMembers: 群成员 - public func onTeamMemberLeft(_ teamMembers: [V2NIMTeamMember]) { + open func onTeamMemberLeft(_ teamMembers: [V2NIMTeamMember]) { onTeamMemberChanged(teamMembers) } /// 群成员被踢 /// - Parameter operatorAccountId: 操作者id /// - Parameter teamMembers: 群成员 - public func onTeamMemberKicked(_ operatorAccountId: String, teamMembers: [V2NIMTeamMember]) { + open func onTeamMemberKicked(_ operatorAccountId: String, teamMembers: [V2NIMTeamMember]) { onTeamMemberChanged(teamMembers) } /// 群成员加入 /// - Parameter teamMembers: 群成员 - public func onTeamMemberJoined(_ teamMembers: [V2NIMTeamMember]) { + open func onTeamMemberJoined(_ teamMembers: [V2NIMTeamMember]) { onTeamMemberChanged(teamMembers) } - public func onTeamMemberInfoUpdated(_ teamMembers: [V2NIMTeamMember]) { + open func onTeamMemberInfoUpdated(_ teamMembers: [V2NIMTeamMember]) { onTeamMemberChanged(teamMembers) } - public func onTeamLeft(_ team: V2NIMTeam, isKicked: Bool) {} + open func onTeamLeft(_ team: V2NIMTeam, isKicked: Bool) {} /// 群信息更新 /// - Parameter team: 群对象 @@ -348,7 +348,7 @@ open class TeamManagerListViewModel: NSObject, NETeamListener { extension TeamManagerListViewModel: NEContactListener { /// 好友信息缓存更新 /// - Parameter accountId: 用户 id - public func onContactChange(_ changeType: NEContactChangeType, _ contacts: [NEUserWithFriend]) { + open func onContactChange(_ changeType: NEContactChangeType, _ contacts: [NEUserWithFriend]) { for contact in contacts { for memberInfo in managers { if memberInfo.teamMember?.accountId == contact.user?.accountId { diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamManagerViewModel.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamManagerViewModel.swift index 2f31612e..170f087a 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamManagerViewModel.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamManagerViewModel.swift @@ -309,19 +309,19 @@ open class TeamManagerViewModel: NSObject, NETeamListener { /// 群成员离开 /// - Parameter teamMembers: 群成员 - public func onTeamMemberLeft(_ teamMembers: [V2NIMTeamMember]) { + open func onTeamMemberLeft(_ teamMembers: [V2NIMTeamMember]) { onTeamMemberChanged(teamMembers) } /// 群成员加入 /// - Parameter operatorAccountId: 操作者 /// - Parameter teamMembers: 群成员 - public func onTeamMemberKicked(_ operatorAccountId: String, teamMembers: [V2NIMTeamMember]) { + open func onTeamMemberKicked(_ operatorAccountId: String, teamMembers: [V2NIMTeamMember]) { onTeamMemberChanged(teamMembers) } /// 群信息更新 - public func onTeamInfoUpdated(_ team: V2NIMTeam) { + open func onTeamInfoUpdated(_ team: V2NIMTeam) { updateTeamInfo(team.teamId) } @@ -329,8 +329,8 @@ open class TeamManagerViewModel: NSObject, NETeamListener { /// - Parameter teamId : 群组ID /// - Parameter mode : 群信息修改权限 /// - Parameter completion: 完成后的回调 - public func updateTeamInfoPrivilege(_ teamId: String, _ mode: V2NIMTeamUpdateInfoMode, - _ completion: @escaping (NSError?, V2NIMTeam?) -> Void) { + open func updateTeamInfoPrivilege(_ teamId: String, _ mode: V2NIMTeamUpdateInfoMode, + _ completion: @escaping (NSError?, V2NIMTeam?) -> Void) { NEALog.infoLog(ModuleName + " " + className(), desc: #function + ", mode:\(mode.rawValue)") teamRepo.updateTeamInfoMode(teamId, .TEAM_TYPE_NORMAL, mode) { error, team in completion(error, team) @@ -341,8 +341,8 @@ open class TeamManagerViewModel: NSObject, NETeamListener { /// - Parameter teamId: 群组ID /// - Parameter mode: 邀请模式 /// - Parameter completion: 完成后的回调 - public func updateInviteMode(_ teamId: String, _ mode: V2NIMTeamInviteMode, - _ completion: @escaping (NSError?, V2NIMTeam?) -> Void) { + open func updateInviteMode(_ teamId: String, _ mode: V2NIMTeamInviteMode, + _ completion: @escaping (NSError?, V2NIMTeam?) -> Void) { NEALog.infoLog(ModuleName + " " + className(), desc: #function + ", mode:\(mode.rawValue)") teamRepo.updateInviteMode(teamId, .TEAM_TYPE_NORMAL, mode) { error, team in completion(error, team) @@ -367,7 +367,7 @@ open class TeamManagerViewModel: NSObject, NETeamListener { } } - public func onTeamMemberInfoUpdated(_ teamMembers: [V2NIMTeamMember]) { + open func onTeamMemberInfoUpdated(_ teamMembers: [V2NIMTeamMember]) { print("team manage onTeamMemberInfoUpdated") onTeamMemberChanged(teamMembers) } diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamMemberSelectViewModel.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamMemberSelectViewModel.swift index 28bcb73c..9cb66b0d 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamMemberSelectViewModel.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamMemberSelectViewModel.swift @@ -30,7 +30,7 @@ class TeamMemberSelectViewModel: NSObject, NETeamListener, NETeamMemberCacheList /// 管理员account id 存放 var managerSet = Set() - override init() { + override public init() { super.init() teamRepo.addTeamListener(self) NETeamMemberCache.shared.addTeamCacheListener(self) @@ -223,26 +223,26 @@ class TeamMemberSelectViewModel: NSObject, NETeamListener, NETeamMemberCacheList /// 群成员离开回调 /// - Parameter teamMembers: 群成员 - public func onTeamMemberLeft(_ teamMembers: [V2NIMTeamMember]) { + open func onTeamMemberLeft(_ teamMembers: [V2NIMTeamMember]) { onTeamMemberChanged(teamMembers) } /// 群成员被踢回调 /// - Parameter operatorAccountId: 操作者id /// - Parameter teamMembers: 群成员 - public func onTeamMemberKicked(_ operatorAccountId: String, teamMembers: [V2NIMTeamMember]) { + open func onTeamMemberKicked(_ operatorAccountId: String, teamMembers: [V2NIMTeamMember]) { onTeamMemberChanged(teamMembers) } /// 群成员加入回调 /// - Parameter teamMembers: 群成员 - public func onTeamMemberJoined(_ teamMembers: [V2NIMTeamMember]) { + open func onTeamMemberJoined(_ teamMembers: [V2NIMTeamMember]) { onTeamMemberChanged(teamMembers) } /// 群成员更新回调 /// - Parameter teamMembers: 群成员列表 - public func onTeamMemberInfoUpdated(_ teamMembers: [V2NIMTeamMember]) { + open func onTeamMemberInfoUpdated(_ teamMembers: [V2NIMTeamMember]) { onTeamMemberChanged(teamMembers) } diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamMembersViewModel.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamMembersViewModel.swift index 86866d35..25fe81a5 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamMembersViewModel.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamMembersViewModel.swift @@ -31,7 +31,7 @@ class TeamMembersViewModel: NSObject, NETeamListener, NEConversationListener, NE /// 在线状态记录 var onLineEventDic = [String: NIMSubscribeEvent]() - override init() { + override public init() { super.init() teamRepo.addTeamListener(self) ConversationRepo.shared.addConversationListener(self) @@ -138,7 +138,7 @@ class TeamMembersViewModel: NSObject, NETeamListener, NEConversationListener, NE /// 判断离开用户是不是当前搜索展示用户 /// - Parameter teamMembers: 群成员信息 - public func removeSearchData(_ teamMembers: [V2NIMTeamMember]) { + open func removeSearchData(_ teamMembers: [V2NIMTeamMember]) { if searchDatas.count <= 0 { return } diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamSettingViewModel.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamSettingViewModel.swift index 2fc8926e..0ebebe97 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamSettingViewModel.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamSettingViewModel.swift @@ -365,9 +365,9 @@ open class TeamSettingViewModel: NSObject, NETeamListener, NEConversationListene /// - Parameter teamId: 群id /// - Parameter queryType: 查询类型 /// - Parameter completion: 完成后的回调 - public func getAllTeamMemberInfos(_ teamId: String, - _ queryType: V2NIMTeamMemberRoleQueryType, - _ completion: @escaping (NSError?) -> Void) { + open func getAllTeamMemberInfos(_ teamId: String, + _ queryType: V2NIMTeamMemberRoleQueryType, + _ completion: @escaping (NSError?) -> Void) { NEALog.infoLog(ModuleName + " " + className(), desc: #function + ", teamid:\(teamId)") if NETeamMemberCache.shared.getTeamMemberCache(teamId) != nil { NETeamMemberCache.shared.endTimer() @@ -433,7 +433,7 @@ open class TeamSettingViewModel: NSObject, NETeamListener, NEConversationListene } /// 根据成员信息获取用户信息 - public func getUserInfo(_ members: [V2NIMTeamMember], _ completion: @escaping (NSError?, [NETeamMemberInfoModel]?) -> Void) { + open func getUserInfo(_ members: [V2NIMTeamMember], _ completion: @escaping (NSError?, [NETeamMemberInfoModel]?) -> Void) { var accids = [String]() var memberModels = [NETeamMemberInfoModel]() for member in members { @@ -471,7 +471,7 @@ open class TeamSettingViewModel: NSObject, NETeamListener, NEConversationListene /// 解散群聊 /// - Parameter teamId : 群id /// - Parameter completion: 完成回调 - public func dismissTeam(_ teamId: String, _ completion: @escaping (NSError?) -> Void) { + open func dismissTeam(_ teamId: String, _ completion: @escaping (NSError?) -> Void) { NEALog.infoLog(ModuleName + " " + className, desc: #function + ", teamId:\(teamId)") teamRepo.dismissTeam(teamId, .TEAM_TYPE_NORMAL, completion) } @@ -600,7 +600,7 @@ open class TeamSettingViewModel: NSObject, NETeamListener, NEConversationListene /// 群信息更改回调 /// - Parameter team: 群信息类 - public func onTeamInfoUpdated(_ team: V2NIMTeam) { + open func onTeamInfoUpdated(_ team: V2NIMTeam) { if let tid = teamInfoModel?.team?.teamId, tid == team.teamId { teamInfoModel?.team = team getData() @@ -610,25 +610,25 @@ open class TeamSettingViewModel: NSObject, NETeamListener, NEConversationListene /// 群成员离开回调 /// - Parameter teamMembers: 群成员 - public func onTeamMemberLeft(_ teamMembers: [V2NIMTeamMember]) { + open func onTeamMemberLeft(_ teamMembers: [V2NIMTeamMember]) { onTeamMemberChanged(teamMembers) } /// 群成员被踢回调 /// - Parameter operatorAccountId: 操作者id /// - Parameter teamMembers: 群成员 - public func onTeamMemberKicked(_ operatorAccountId: String, teamMembers: [V2NIMTeamMember]) { + open func onTeamMemberKicked(_ operatorAccountId: String, teamMembers: [V2NIMTeamMember]) { onTeamMemberChanged(teamMembers) } /// 群成员加入回调 /// - Parameter teamMembers: 群成员 - public func onTeamMemberJoined(_ teamMembers: [V2NIMTeamMember]) { + open func onTeamMemberJoined(_ teamMembers: [V2NIMTeamMember]) { onTeamMemberChanged(teamMembers) } /// 群信息同步完成回调 - public func onTeamSyncFinished() { + open func onTeamSyncFinished() { NEALog.infoLog(className(), desc: #function + " team setting viewmo model onTeamSyncFinished ") if let tid = teamInfoModel?.team?.teamId { weak var weakSelf = self @@ -645,7 +645,7 @@ open class TeamSettingViewModel: NSObject, NETeamListener, NEConversationListene /// 群成员更新回调 /// - Parameter teamMembers: 群成员列表 - public func onTeamMemberInfoUpdated(_ teamMembers: [V2NIMTeamMember]) { + open func onTeamMemberInfoUpdated(_ teamMembers: [V2NIMTeamMember]) { weak var weakSelf = self for member in teamMembers { if let currentTid = teamInfoModel?.team?.teamId, currentTid == member.teamId, member.accountId == IMKitClient.instance.account() { @@ -660,7 +660,7 @@ open class TeamSettingViewModel: NSObject, NETeamListener, NEConversationListene /// 离开群回调 /// - Parameter teamMembers: 群成员 /// - Parameter team: 群信息 - public func onTeamLeft(_ team: V2NIMTeam, isKicked: Bool) {} + open func onTeamLeft(_ team: V2NIMTeam, isKicked: Bool) {} /// 群成员变更统一处理 /// - Parameter teamMembers: 群成员 @@ -703,7 +703,7 @@ open class TeamSettingViewModel: NSObject, NETeamListener, NEConversationListene /// 会话变更 /// - Parameter conversations: 会话 - public func onConversationChanged(_ conversations: [V2NIMConversation]) { + open func onConversationChanged(_ conversations: [V2NIMConversation]) { if let currentConversation = conversation { for changeConversation in conversations { if currentConversation.conversationId == changeConversation.conversationId { diff --git a/Podfile b/Podfile index c344c9f6..f750c167 100644 --- a/Podfile +++ b/Podfile @@ -7,16 +7,16 @@ target 'app' do use_frameworks! # 基础库 - pod 'NEChatKit', '10.5.0' + pod 'NEChatKit', '10.5.1' # UI 组件,依次为通讯录组件、会话列表组件、会话(聊天)组件、群相关设置组件 - pod 'NEChatUIKit', '10.5.0' - pod 'NEContactUIKit', '10.5.0' - pod 'NEConversationUIKit', '10.5.0' - pod 'NETeamUIKit', '10.5.0' + pod 'NEChatUIKit', '10.5.1' + pod 'NEContactUIKit', '10.5.1' + pod 'NEConversationUIKit', '10.5.1' + pod 'NETeamUIKit', '10.5.1' # 扩展库 - 地理位置组件 - pod 'NEMapKit', '10.5.0' + pod 'NEMapKit', '10.5.1' # 扩展库 - AI 划词搜索 pod 'NEAISearchKit', '1.0.4'