From f80daeb5b60450cab8eea2c7afd859b11fa5acda Mon Sep 17 00:00:00 2001 From: zsw666 <1176766775@qq.com> Date: Thu, 26 Dec 2024 13:59:01 +0800 Subject: [PATCH 1/3] NEAISearchKit v1.0.5 (#416) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add sample code * update Podfile * v10.4.0 * v10.4.1 * fix NEMapKit.podspec * update Podfile * update NETeamUIKit.podspec * v10.5.0 * 优化登录登出体验 * v10.5.1 * NEAISearchKit v1.0.5 --- NEAISearchKit/NEAISearchKit.podspec | 4 +- Podfile | 18 ++++----- app.xcodeproj/project.pbxproj | 4 +- app/Custom/CustomChatCell.swift | 2 +- app/Custom/CustomConfig.swift | 4 +- app/Custom/CustomContactTableViewCell.swift | 2 +- app/Custom/CustomContactViewController.swift | 8 ++-- app/Custom/CustomConversationController.swift | 4 +- app/Main/NENavigationController.swift | 4 +- app/Main/NETabBarController.swift | 2 +- app/Main/UIStyleManager.swift | 6 +-- app/Main/ViewController.swift | 38 +++++-------------- app/Manager/IMSDKConfigManager.swift | 4 +- .../IMSDKConfigViewController.swift | 19 +++++----- .../IntroduceBrandViewController.swift | 9 ++--- .../Controller/LanguageViewController.swift | 9 ++--- .../MessageRemindViewController.swift | 9 ++--- .../Controller/NEAboutWebViewController.swift | 2 +- .../Controller/NENodeViewController.swift | 9 ++--- .../Controller/PersonInfoViewController.swift | 35 +++++++++-------- app/Mine/Controller/PocLoginController.swift | 10 ++--- .../StyleSelectionViewController.swift | 10 ++--- app/Mine/Model/CustomSettingCellModel.swift | 2 +- app/Mine/View/BirthdayDatePickerView.swift | 2 +- app/Mine/View/NodeSelectCell.swift | 4 +- app/Mine/View/VersionCell.swift | 2 +- app/Mine/ViewModel/MeViewModel.swift | 2 +- app/Mine/ViewModel/MineSettingViewModel.swift | 2 +- app/Mine/ViewModel/NodeViewModel.swift | 2 +- 29 files changed, 102 insertions(+), 126 deletions(-) diff --git a/NEAISearchKit/NEAISearchKit.podspec b/NEAISearchKit/NEAISearchKit.podspec index bcddd182..a2eb9d23 100644 --- a/NEAISearchKit/NEAISearchKit.podspec +++ b/NEAISearchKit/NEAISearchKit.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'NEAISearchKit' - s.version = '1.0.4' + s.version = '1.0.5' s.summary = 'Netease XKit' # This description is used to generate tags and improve search results. @@ -38,6 +38,6 @@ TODO: Add long description of the pod here. s.resource = 'NEAISearchKit/Assets/**/*' s.dependency 'NEChatKit' - s.dependency 'NECommonUIKit', '9.7.4' + s.dependency 'NECommonUIKit' end diff --git a/Podfile b/Podfile index f750c167..60ff742c 100644 --- a/Podfile +++ b/Podfile @@ -19,11 +19,11 @@ target 'app' do pod 'NEMapKit', '10.5.1' # 扩展库 - AI 划词搜索 - pod 'NEAISearchKit', '1.0.4' + pod 'NEAISearchKit', '1.0.5' # 扩展库 - 呼叫组件 pod 'NERtcCallKit/NOS_Special', '3.1.0' - pod 'NERtcCallUIKit/NOS_Special', '3.1.0' + pod 'NERtcCallUIKit/NOS_Special', '3.1.0' # 扩展库,依次为 RTC 音视频基础组件、RTC 音视频神经网络组件(使用背景虚化功能需要集成)、RTC 音视频背景分割组件(使用背景虚化功能需要集成) pod 'NERtcSDK/RtcBasic', '5.6.33' @@ -32,13 +32,13 @@ target 'app' do # 如果需要查看UI部分源码请注释掉以上在线依赖,打开下面的本地依赖 -# 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' +# 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 diff --git a/app.xcodeproj/project.pbxproj b/app.xcodeproj/project.pbxproj index 6dd7076e..b81724a6 100644 --- a/app.xcodeproj/project.pbxproj +++ b/app.xcodeproj/project.pbxproj @@ -715,7 +715,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 10.4.0; + MARKETING_VERSION = 10.5.1; PRODUCT_BUNDLE_IDENTIFIER = com.netease.yunxin.app.im; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -764,7 +764,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 10.4.0; + MARKETING_VERSION = 10.5.1; PRODUCT_BUNDLE_IDENTIFIER = com.netease.yunxin.app.im; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = inHouseYunxin; diff --git a/app/Custom/CustomChatCell.swift b/app/Custom/CustomChatCell.swift index d564e2a3..6c3b3e32 100644 --- a/app/Custom/CustomChatCell.swift +++ b/app/Custom/CustomChatCell.swift @@ -23,7 +23,7 @@ class CustomChatCell: NEChatBaseCell { super.init(coder: coder) } - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) selectionStyle = .none backgroundColor = .lightGray diff --git a/app/Custom/CustomConfig.swift b/app/Custom/CustomConfig.swift index 42c7270e..e19cd4f9 100644 --- a/app/Custom/CustomConfig.swift +++ b/app/Custom/CustomConfig.swift @@ -12,7 +12,7 @@ public class CustomConfig { public static let shared = CustomConfig() /// 通过配置项实现 UI 自定义,该方式不需要继承自 ChatViewController - public func configChatUIKit() { + open func configChatUIKit() { ChatUIConfig.shared.messageProperties.avatarType = .cycle ChatUIConfig.shared.messageProperties.avatarCornerRadius = 8.0 ChatUIConfig.shared.messageProperties.signalBgColor = UIColor.yellow @@ -151,7 +151,7 @@ public class CustomConfig { } /// 通过配置项实现自定义,该方式不需要继承自 ContactViewController - public func configContactUIKit() { + open func configContactUIKit() { /* UI 属性自定义 */ diff --git a/app/Custom/CustomContactTableViewCell.swift b/app/Custom/CustomContactTableViewCell.swift index 8b56d6e0..dc62b22d 100644 --- a/app/Custom/CustomContactTableViewCell.swift +++ b/app/Custom/CustomContactTableViewCell.swift @@ -30,7 +30,7 @@ public class CustomContactTableViewCell: ContactTableViewCell { } // 根据数据模型设置 cell 内容 - override public func setModel(_ model: ContactInfo) { + override open func setModel(_ model: ContactInfo) { super.setModel(model) onlineView.isHidden = false } diff --git a/app/Custom/CustomContactViewController.swift b/app/Custom/CustomContactViewController.swift index fc41cd9b..fd0216e6 100644 --- a/app/Custom/CustomContactViewController.swift +++ b/app/Custom/CustomContactViewController.swift @@ -24,7 +24,7 @@ public class CustomContactViewController: ContactViewController, NEBaseContactVi super.init(coder: coder) } - override public func viewDidLoad() { + override open func viewDidLoad() { // 通过重写实现自定义,该方式需要继承自 ChatViewController // customByOverread() @@ -45,19 +45,19 @@ public class CustomContactViewController: ContactViewController, NEBaseContactVi } // 通过继承方式重写次最右侧按钮点击事件, 这种方式会覆盖配置项中的点击事件 - override public func searchAction() { + override open func searchAction() { bodyTopViewHeight = 80 bodyBottomViewHeight = 80 } // 通过继承方式重写最右侧按钮点击事件, 这种方式会覆盖配置项中的点击事件 - override public func didClickAddBtn() { + override open func didClickAddBtn() { bodyTopViewHeight = 0 bodyBottomViewHeight = 0 } // 父类加载完数据后会调用此方法,可在此对数据进行二次处理 - public func onDataLoaded() { + open func onDataLoaded() { for info in viewModel.contacts[1].contacts { info.contactCellType = ContactCellType.ContactCutom.rawValue } diff --git a/app/Custom/CustomConversationController.swift b/app/Custom/CustomConversationController.swift index 912ee674..e4ce211b 100644 --- a/app/Custom/CustomConversationController.swift +++ b/app/Custom/CustomConversationController.swift @@ -18,7 +18,7 @@ open class CustomConversationController: ConversationController, NEBaseConversat super.init(coder: coder) } - override public func viewDidLoad() { + override open func viewDidLoad() { // 通过重写实现自定义,该方式需要继承自 ChatViewController // customByOverread() @@ -76,7 +76,7 @@ open class CustomConversationController: ConversationController, NEBaseConversat } // 可自行处理数据 - public func onDataLoaded() { + open func onDataLoaded() { for model in viewModel.conversationListData { model.customType = 1 } diff --git a/app/Main/NENavigationController.swift b/app/Main/NENavigationController.swift index 9d3a996b..6e3713eb 100644 --- a/app/Main/NENavigationController.swift +++ b/app/Main/NENavigationController.swift @@ -6,7 +6,7 @@ import UIKit class NENavigationController: UINavigationController { - override public func viewDidLoad() { + override open func viewDidLoad() { super.viewDidLoad() setUpNavigation() } @@ -22,7 +22,7 @@ class NENavigationController: UINavigationController { } } - override public func pushViewController(_ viewController: UIViewController, animated: Bool) { + override open func pushViewController(_ viewController: UIViewController, animated: Bool) { if children.count > 0 { viewController.hidesBottomBarWhenPushed = true if children.count > 1 { diff --git a/app/Main/NETabBarController.swift b/app/Main/NETabBarController.swift index 2b9e70db..d293027f 100644 --- a/app/Main/NETabBarController.swift +++ b/app/Main/NETabBarController.swift @@ -204,7 +204,7 @@ class NETabBarController: UITabBarController, NEConversationListener, NEContactL setUpSessionBadgeValue() } - @objc public func clearValidationUnreadCount() { + @objc open func clearValidationUnreadCount() { setUpContactBadgeValue() } } diff --git a/app/Main/UIStyleManager.swift b/app/Main/UIStyleManager.swift index ee768e48..8dffdcd6 100644 --- a/app/Main/UIStyleManager.swift +++ b/app/Main/UIStyleManager.swift @@ -8,19 +8,19 @@ import NEChatUIKit class NEStyleManager { static let instance = NEStyleManager() let userDefault = UserDefaults.standard - public func isNormalStyle() -> Bool { + open func isNormalStyle() -> Bool { if let style = userDefault.object(forKey: IMUIKit_Style_Key) as? NSNumber, style.intValue == 2 { return false } return true } - public func setNormalStyle() { + open func setNormalStyle() { userDefault.set(NSNumber(integerLiteral: 1), forKey: IMUIKit_Style_Key) userDefault.synchronize() } - public func setFunStyle() { + open func setFunStyle() { userDefault.set(NSNumber(integerLiteral: 2), forKey: IMUIKit_Style_Key) userDefault.synchronize() } diff --git a/app/Main/ViewController.swift b/app/Main/ViewController.swift index 18e28866..1ed20277 100644 --- a/app/Main/ViewController.swift +++ b/app/Main/ViewController.swift @@ -51,20 +51,11 @@ class ViewController: UIViewController { func setupUI() { view.addSubview(launchIconView) - if #available(iOS 11.0, *) { - NSLayoutConstraint.activate([ - launchIconView.centerXAnchor.constraint(equalTo: view.centerXAnchor), - launchIconView.topAnchor.constraint( - equalTo: view.safeAreaLayoutGuide.topAnchor, - constant: 145.0 - ), - ]) - } else { - NSLayoutConstraint.activate([ - launchIconView.centerXAnchor.constraint(equalTo: view.centerXAnchor), - launchIconView.topAnchor.constraint(equalTo: view.topAnchor, constant: 145.0), - ]) - } + + NSLayoutConstraint.activate([ + launchIconView.centerXAnchor.constraint(equalTo: view.centerXAnchor), + launchIconView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 145.0), + ]) view.addSubview(launchIconLabel) NSLayoutConstraint.activate([ @@ -80,19 +71,10 @@ class ViewController: UIViewController { ]) view.addSubview(copyright) - if #available(iOS 11.0, *) { - NSLayoutConstraint.activate([ - copyright.centerXAnchor.constraint(equalTo: view.centerXAnchor), - copyright.bottomAnchor.constraint( - equalTo: view.safeAreaLayoutGuide.bottomAnchor, - constant: -48 - ), - ]) - } else { - NSLayoutConstraint.activate([ - copyright.centerXAnchor.constraint(equalTo: view.centerXAnchor), - copyright.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: -48), - ]) - } + + NSLayoutConstraint.activate([ + copyright.centerXAnchor.constraint(equalTo: view.centerXAnchor), + copyright.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -48), + ]) } } diff --git a/app/Manager/IMSDKConfigManager.swift b/app/Manager/IMSDKConfigManager.swift index 5c9af33e..7f8e2b16 100644 --- a/app/Manager/IMSDKConfigManager.swift +++ b/app/Manager/IMSDKConfigManager.swift @@ -30,13 +30,13 @@ class IMSDKConfigManager: NSObject { } /// 保存私有化配置 - public func saveConfig(model: IMSDKConfigModel) { + open func saveConfig(model: IMSDKConfigModel) { configModel = model saveObjectToDisk(model, fileName: filename) } /// 获取私有化配置 - public func getConfig() -> IMSDKConfigModel { + open func getConfig() -> IMSDKConfigModel { configModel ?? IMSDKConfigModel() } diff --git a/app/Mine/Controller/IMSDKConfigViewController.swift b/app/Mine/Controller/IMSDKConfigViewController.swift index ed4ddf67..85c850cb 100644 --- a/app/Mine/Controller/IMSDKConfigViewController.swift +++ b/app/Mine/Controller/IMSDKConfigViewController.swift @@ -25,11 +25,10 @@ class IMSDKConfigViewController: NEBaseViewController, UITableViewDelegate, UITa tableView.sectionHeaderHeight = 12.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 } @@ -58,8 +57,10 @@ class IMSDKConfigViewController: NEBaseViewController, UITableViewDelegate, UITa setupUI() } - public func setupUI() { + open func setupUI() { + view.backgroundColor = navigationView.backgroundColor navigationView.moreButton.isHidden = true + view.addSubview(contentTableView) NSLayoutConstraint.activate([ contentTableView.leftAnchor.constraint(equalTo: view.leftAnchor), @@ -73,8 +74,6 @@ class IMSDKConfigViewController: NEBaseViewController, UITableViewDelegate, UITa for (key, value) in cellClassDic { contentTableView.register(value, forCellReuseIdentifier: "\(key)") } - view.backgroundColor = navigationView.backgroundColor - navigationView.moreButton.isHidden = true } let twoSectionModel = SettingSectionModel() @@ -324,7 +323,7 @@ class IMSDKConfigViewController: NEBaseViewController, UITableViewDelegate, UITa contentTableView.reloadData() } - public func changeParseModel() { + open func changeParseModel() { if NEStyleManager.instance.isNormalStyle() { let actionSheet = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet) let autoAction = UIAlertAction(title: "一键自动解析", style: .default) { [weak self] _ in @@ -349,7 +348,7 @@ class IMSDKConfigViewController: NEBaseViewController, UITableViewDelegate, UITa } } - public func getFooterView() -> UIView { + open func getFooterView() -> UIView { let back = UIView() back.backgroundColor = .clear back.frame = CGRectMake(0, 0, view.frame.width, 60) diff --git a/app/Mine/Controller/IntroduceBrandViewController.swift b/app/Mine/Controller/IntroduceBrandViewController.swift index e2d2b379..807781e4 100644 --- a/app/Mine/Controller/IntroduceBrandViewController.swift +++ b/app/Mine/Controller/IntroduceBrandViewController.swift @@ -41,11 +41,10 @@ class IntroduceBrandViewController: NEBaseViewController, UITableViewDelegate, tableView.register(VersionCell.self, forCellReuseIdentifier: "VersionCell") 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/app/Mine/Controller/LanguageViewController.swift b/app/Mine/Controller/LanguageViewController.swift index 3e142930..be30b272 100644 --- a/app/Mine/Controller/LanguageViewController.swift +++ b/app/Mine/Controller/LanguageViewController.swift @@ -27,11 +27,10 @@ class LanguageViewController: NEBaseViewController, UITableViewDelegate, tableView.sectionHeaderHeight = 12.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 } diff --git a/app/Mine/Controller/MessageRemindViewController.swift b/app/Mine/Controller/MessageRemindViewController.swift index f14ab601..72373fa8 100644 --- a/app/Mine/Controller/MessageRemindViewController.swift +++ b/app/Mine/Controller/MessageRemindViewController.swift @@ -25,11 +25,10 @@ class MessageRemindViewController: NEBaseViewController, UITableViewDelegate, tableView.sectionHeaderHeight = 12.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 } diff --git a/app/Mine/Controller/NEAboutWebViewController.swift b/app/Mine/Controller/NEAboutWebViewController.swift index 24d71223..cb430979 100644 --- a/app/Mine/Controller/NEAboutWebViewController.swift +++ b/app/Mine/Controller/NEAboutWebViewController.swift @@ -16,7 +16,7 @@ class NEAboutWebViewController: NEBaseViewController { setUpSubViews() } - init(url: String) { + public init(url: String) { super.init(nibName: nil, bundle: nil) loadUrl = url } diff --git a/app/Mine/Controller/NENodeViewController.swift b/app/Mine/Controller/NENodeViewController.swift index 91e33ec7..788dc608 100644 --- a/app/Mine/Controller/NENodeViewController.swift +++ b/app/Mine/Controller/NENodeViewController.swift @@ -23,11 +23,10 @@ class NENodeViewController: NEBaseViewController, UITableViewDataSource, UITable tableView.sectionHeaderHeight = 12.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 } diff --git a/app/Mine/Controller/PersonInfoViewController.swift b/app/Mine/Controller/PersonInfoViewController.swift index a61ddabc..23b4f46a 100644 --- a/app/Mine/Controller/PersonInfoViewController.swift +++ b/app/Mine/Controller/PersonInfoViewController.swift @@ -31,11 +31,10 @@ public class PersonInfoViewController: NEBaseViewController, 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 } @@ -48,7 +47,7 @@ public class PersonInfoViewController: NEBaseViewController, return picker }() - override public func viewDidLoad() { + override open func viewDidLoad() { super.viewDidLoad() ContactRepo.shared.addContactListener(self) initialConfig() @@ -158,15 +157,15 @@ public class PersonInfoViewController: NEBaseViewController, // MARK: UIImagePickerControllerDelegate - public func imagePickerController(_ picker: UIImagePickerController, - didFinishPickingMediaWithInfo info: [UIImagePickerController - .InfoKey: Any]) { + open func imagePickerController(_ picker: UIImagePickerController, + didFinishPickingMediaWithInfo info: [UIImagePickerController + .InfoKey: Any]) { let image: UIImage = info[UIImagePickerController.InfoKey.editedImage] as! UIImage uploadHeadImage(image: image) dismiss(animated: true, completion: nil) } - public func uploadHeadImage(image: UIImage) { + open func uploadHeadImage(image: UIImage) { weak var weakSelf = self if NEChatDetectNetworkTool.shareInstance.manager?.isReachable == false { weakSelf?.showToast(commonLocalizable("network_error")) @@ -352,7 +351,7 @@ public class PersonInfoViewController: NEBaseViewController, // MARK: UITableViewDelegate, UITableViewDataSource - public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + open func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { if viewModel.sectionData.count > section { let model = viewModel.sectionData[section] return model.cellModels.count @@ -360,11 +359,11 @@ public class PersonInfoViewController: NEBaseViewController, return 0 } - public func numberOfSections(in tableView: UITableView) -> Int { + open func numberOfSections(in tableView: UITableView) -> Int { viewModel.sectionData.count } - public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + open func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let model = viewModel.sectionData[indexPath.section].cellModels[indexPath.row] if let cell = tableView.dequeueReusableCell( withIdentifier: "\(model.type)", @@ -376,19 +375,19 @@ public class PersonInfoViewController: NEBaseViewController, return UITableViewCell() } - public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + open func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { let model = viewModel.sectionData[indexPath.section].cellModels[indexPath.row] if let block = model.cellClick { block() } } - public func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { + open func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { let model = viewModel.sectionData[indexPath.section].cellModels[indexPath.row] return model.rowHeight } - public func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { + open func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { if section == 0 { return 0 } @@ -401,7 +400,7 @@ public class PersonInfoViewController: NEBaseViewController, return 0 } - public func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { + open func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { let headerView = UIView() headerView.backgroundColor = .ne_lightBackgroundColor return headerView @@ -411,7 +410,7 @@ public class PersonInfoViewController: NEBaseViewController, /// 好友信息缓存更新 /// - 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 == IMKitClient.instance.account() { viewModel.userInfo = contact diff --git a/app/Mine/Controller/PocLoginController.swift b/app/Mine/Controller/PocLoginController.swift index e7bff2d8..2853a3fa 100644 --- a/app/Mine/Controller/PocLoginController.swift +++ b/app/Mine/Controller/PocLoginController.swift @@ -10,7 +10,7 @@ import NIMSDK import UIKit @objcMembers -public class PocLoginController: UIViewController { +public class PocLoginController: NEBaseViewController { // 成功回调 public var loginSuccess: (() -> Void)? @@ -20,10 +20,10 @@ public class PocLoginController: UIViewController { // 登录状态记录 var isLogining = false - override public func viewDidLoad() { + override open func viewDidLoad() { super.viewDidLoad() - - view.backgroundColor = .white + view.backgroundColor = navigationView.backgroundColor + navigationView.moreButton.isHidden = true // 设置用户名输入框 usernameTextField.placeholder = "用户名" @@ -40,7 +40,7 @@ public class PocLoginController: UIViewController { // 布局 NSLayoutConstraint.activate([ - usernameTextField.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 20), + usernameTextField.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: topConstant), usernameTextField.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 20), usernameTextField.rightAnchor.constraint(equalTo: view.rightAnchor, constant: -20), usernameTextField.heightAnchor.constraint(equalToConstant: 40), diff --git a/app/Mine/Controller/StyleSelectionViewController.swift b/app/Mine/Controller/StyleSelectionViewController.swift index 3d6d99a8..f83da9f5 100644 --- a/app/Mine/Controller/StyleSelectionViewController.swift +++ b/app/Mine/Controller/StyleSelectionViewController.swift @@ -15,7 +15,7 @@ open class StyleCellModel: NSObject { public var selected: Bool = false public var selectedImageName: String - init(styleName: String, styleImageName: String, styleTitle: String, selected: Bool, selectedImageName: String) { + public init(styleName: String, styleImageName: String, styleTitle: String, selected: Bool, selectedImageName: String) { self.styleName = styleName self.styleImageName = styleImageName self.styleTitle = styleTitle @@ -99,25 +99,25 @@ open class StyleSelectionViewController: NEBaseViewController, UICollectionViewD } } - public func numberOfSections(in collectionView: UICollectionView) -> Int { + open func numberOfSections(in collectionView: UICollectionView) -> Int { sectionCount } - public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + open func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { if section == sectionCount - 1 { return styleData.count - itemsInSection * (sectionCount - 1) } return itemsInSection } - public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + open func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "\(StyleSelectionCell.self)", for: indexPath) as? StyleSelectionCell let itemModel = styleData[indexPath.section * itemsInSection + indexPath.row] cell?.configData(model: itemModel) return cell ?? UICollectionViewCell() } - public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { + open func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { if indexPath.row == 0 { if NEStyleManager.instance.isNormalStyle() == false { NEStyleManager.instance.setNormalStyle() diff --git a/app/Mine/Model/CustomSettingCellModel.swift b/app/Mine/Model/CustomSettingCellModel.swift index 192462c6..966d6062 100644 --- a/app/Mine/Model/CustomSettingCellModel.swift +++ b/app/Mine/Model/CustomSettingCellModel.swift @@ -13,7 +13,7 @@ class CustomSettingCellModel: SettingCellModel { /// 输入内容对应SDK配置字段的key,便于自动解析映射 public var inputKey = "" - override init() { + override public init() { super.init() rowHeight = 100 } diff --git a/app/Mine/View/BirthdayDatePickerView.swift b/app/Mine/View/BirthdayDatePickerView.swift index 13310dc8..253e5666 100644 --- a/app/Mine/View/BirthdayDatePickerView.swift +++ b/app/Mine/View/BirthdayDatePickerView.swift @@ -64,7 +64,7 @@ public class BirthdayDatePickerView: UIView { return pickerBackView }() - override init(frame: CGRect) { + override public init(frame: CGRect) { super.init(frame: frame) backgroundColor = UIColor(white: 0, alpha: 0.25) let tap = UITapGestureRecognizer(target: self, action: #selector(pickerBackViewClicked)) diff --git a/app/Mine/View/NodeSelectCell.swift b/app/Mine/View/NodeSelectCell.swift index b3ae9875..10432c80 100644 --- a/app/Mine/View/NodeSelectCell.swift +++ b/app/Mine/View/NodeSelectCell.swift @@ -34,7 +34,7 @@ class NodeSelectCell: CornerCell { // 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) selectionStyle = .none setupUI() @@ -44,7 +44,7 @@ class NodeSelectCell: CornerCell { super.init(coder: coder) } - public func configure(_ cellModel: SettingCellModel) { + open func configure(_ cellModel: SettingCellModel) { cornerType = cellModel.cornerType stateImageView.isHighlighted = cellModel.switchOpen ? true : false titleLabel.text = cellModel.subTitle diff --git a/app/Mine/View/VersionCell.swift b/app/Mine/View/VersionCell.swift index c62d5a6c..c575c79e 100644 --- a/app/Mine/View/VersionCell.swift +++ b/app/Mine/View/VersionCell.swift @@ -70,7 +70,7 @@ class VersionCell: UITableViewCell { // 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) setupSubviews() selectionStyle = .none diff --git a/app/Mine/ViewModel/MeViewModel.swift b/app/Mine/ViewModel/MeViewModel.swift index 38e9c0e7..8c53bf2c 100644 --- a/app/Mine/ViewModel/MeViewModel.swift +++ b/app/Mine/ViewModel/MeViewModel.swift @@ -9,7 +9,7 @@ import UIKit class MeViewModel: NSObject { public var mineData: [[String: String]] = [] - public func getData() { + open func getData() { mineData = [ [localizable("setting"): "mine_setting"], [localizable("about_yunxin"): "about_yunxin"], diff --git a/app/Mine/ViewModel/MineSettingViewModel.swift b/app/Mine/ViewModel/MineSettingViewModel.swift index a950e0fb..3d61f52f 100644 --- a/app/Mine/ViewModel/MineSettingViewModel.swift +++ b/app/Mine/ViewModel/MineSettingViewModel.swift @@ -19,7 +19,7 @@ public class MineSettingViewModel: NSObject { var sectionData = [SettingSectionModel]() weak var delegate: MineSettingViewModelDelegate? - public func getData() { + open func getData() { sectionData.removeAll() sectionData.append(getFirstSection()) sectionData.append(getSecondSection()) diff --git a/app/Mine/ViewModel/NodeViewModel.swift b/app/Mine/ViewModel/NodeViewModel.swift index 82573351..b7c354e1 100644 --- a/app/Mine/ViewModel/NodeViewModel.swift +++ b/app/Mine/ViewModel/NodeViewModel.swift @@ -9,7 +9,7 @@ import UIKit class NodeViewModel: NSObject { var sectionData = [SettingSectionModel]() - public func getData() { + open func getData() { sectionData.append(getSection()) } From 45bec1753003eb6d4b1bd600e43f174449c9702a Mon Sep 17 00:00:00 2001 From: zsw666 <1176766775@qq.com> Date: Thu, 26 Dec 2024 14:41:25 +0800 Subject: [PATCH 2/3] OC demo Podfile update (#417) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add sample code * update Podfile * v10.4.0 * v10.4.1 * fix NEMapKit.podspec * update Podfile * update NETeamUIKit.podspec * v10.5.0 * 优化登录登出体验 * v10.5.1 * NEAISearchKit v1.0.5 * OC Podfile update --- IMUIKitOC/IMUIKitOCExample/Podfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IMUIKitOC/IMUIKitOCExample/Podfile b/IMUIKitOC/IMUIKitOCExample/Podfile index f7e12ced..3df54ea8 100644 --- a/IMUIKitOC/IMUIKitOCExample/Podfile +++ b/IMUIKitOC/IMUIKitOCExample/Podfile @@ -22,7 +22,7 @@ target 'IMUIKitOCExample' do pod 'NEMapKit', '10.5.1' # 扩展库 - AI 划词搜索 - pod 'NEAISearchKit', '1.0.4' + pod 'NEAISearchKit', '1.0.5' # 扩展库 - 呼叫组件 pod 'NERtcCallKit/NOS_Special', '3.1.0' From 956ee53405287f0c21994ed6605f0366e305b493 Mon Sep 17 00:00:00 2001 From: zsw666 <1176766775@qq.com> Date: Fri, 27 Dec 2024 14:57:01 +0800 Subject: [PATCH 3/3] update NEConversationUIKit (#419) * add sample code --- .../Assets/en.lproj/Localizable.strings | 2 -- .../Assets/zh-Hans.lproj/Localizable.strings | 3 --- .../Classes/Common/ConversationConstant.swift | 5 ---- .../NEBaseConversationController.swift | 20 +++----------- .../FunConversationController.swift | 1 - .../Controller/ConversationController.swift | 1 - app.xcodeproj/project.pbxproj | 4 +++ app/Custom/CustomConfig.swift | 26 +++++++++++++++++++ .../Custom}/NESecurityWarningView.swift | 5 ++-- app/Main/AppDelegate.swift | 7 ++++- app/en.lproj/Localizable.strings | 1 + app/zh-Hans.lproj/Localizable.strings | 1 + 12 files changed, 44 insertions(+), 32 deletions(-) rename {NEConversationUIKit/NEConversationUIKit/Classes/Conversation/View => app/Custom}/NESecurityWarningView.swift (93%) diff --git a/NEConversationUIKit/NEConversationUIKit/Assets/en.lproj/Localizable.strings b/NEConversationUIKit/NEConversationUIKit/Assets/en.lproj/Localizable.strings index ae0bc1d3..dbef8f56 100644 --- a/NEConversationUIKit/NEConversationUIKit/Assets/en.lproj/Localizable.strings +++ b/NEConversationUIKit/NEConversationUIKit/Assets/en.lproj/Localizable.strings @@ -37,8 +37,6 @@ "you_were_mentioned"="[You were mentioned]"; -"security_warning"="For test only. Beware of money transfer, lottery winnings & strange call scams."; - // error toast "leave_team_desc"="You have been removed from the group chat or the group chat has been dissolved."; diff --git a/NEConversationUIKit/NEConversationUIKit/Assets/zh-Hans.lproj/Localizable.strings b/NEConversationUIKit/NEConversationUIKit/Assets/zh-Hans.lproj/Localizable.strings index f89b5511..31d02538 100644 --- a/NEConversationUIKit/NEConversationUIKit/Assets/zh-Hans.lproj/Localizable.strings +++ b/NEConversationUIKit/NEConversationUIKit/Assets/zh-Hans.lproj/Localizable.strings @@ -36,9 +36,6 @@ "you_were_mentioned"="[有人@我]"; -"security_warning"="仅用于体验云信IM 产品功能,请勿轻信汇款、中奖等涉及钱款的信息,勿轻易拨打陌生电话,谨防上当受骗。"; - - // error toast "leave_team_desc"="您已被移出群聊或该群聊已被解散"; diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/Common/ConversationConstant.swift b/NEConversationUIKit/NEConversationUIKit/Classes/Common/ConversationConstant.swift index 81f782d8..8cf1b454 100644 --- a/NEConversationUIKit/NEConversationUIKit/Classes/Common/ConversationConstant.swift +++ b/NEConversationUIKit/NEConversationUIKit/Classes/Common/ConversationConstant.swift @@ -12,8 +12,3 @@ func localizable(_ key: String) -> String { } public let ModuleName = "NEConversationUIKit" - -extension UIColor { - static let securityWarningBg = UIColor(hexString: "#FFF5E1") - static let securityWarningTextColor = UIColor(hexString: "#EB9718") -} diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBaseConversationController.swift b/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBaseConversationController.swift index 44716cbb..ff14e132 100644 --- a/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBaseConversationController.swift +++ b/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBaseConversationController.swift @@ -96,19 +96,11 @@ open class NEBaseConversationController: UIViewController, UIGestureRecognizerDe view.translatesAutoresizingMaskIntoConstraints = false view.backgroundColor = .clear - view.addSubview(securityWarningView) view.addSubview(brokenNetworkView) view.addSubview(contentView) NSLayoutConstraint.activate([ - securityWarningView.topAnchor.constraint(equalTo: view.topAnchor), - securityWarningView.leftAnchor.constraint(equalTo: view.leftAnchor), - securityWarningView.rightAnchor.constraint(equalTo: view.rightAnchor), - securityWarningView.heightAnchor.constraint(equalToConstant: 56), - ]) - - NSLayoutConstraint.activate([ - brokenNetworkView.topAnchor.constraint(equalTo: securityWarningView.bottomAnchor), + brokenNetworkView.topAnchor.constraint(equalTo: view.topAnchor), brokenNetworkView.leftAnchor.constraint(equalTo: view.leftAnchor), brokenNetworkView.rightAnchor.constraint(equalTo: view.rightAnchor), brokenNetworkView.heightAnchor.constraint(equalToConstant: brokenNetworkViewHeight), @@ -132,12 +124,6 @@ open class NEBaseConversationController: UIViewController, UIGestureRecognizerDe return view }() - public lazy var securityWarningView: NESecurityWarningView = { - let view = NESecurityWarningView() - view.translatesAutoresizingMaskIntoConstraints = false - return view - }() - public lazy var contentView: UIView = { let view = UIView() view.translatesAutoresizingMaskIntoConstraints = false @@ -246,10 +232,10 @@ open class NEBaseConversationController: UIViewController, UIGestureRecognizerDe NEChatDetectNetworkTool.shareInstance.netWorkReachability { [weak self] status in if status == .notReachable { self?.brokenNetworkView.isHidden = false - self?.contentViewTopAnchor?.constant = (self?.brokenNetworkViewHeight ?? 36) + 56 + self?.contentViewTopAnchor?.constant = (self?.brokenNetworkViewHeight ?? 36) } else { self?.brokenNetworkView.isHidden = true - self?.contentViewTopAnchor?.constant = 56 + self?.contentViewTopAnchor?.constant = 0 } } diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/FunUI/Controller/FunConversationController.swift b/NEConversationUIKit/NEConversationUIKit/Classes/FunUI/Controller/FunConversationController.swift index 8055454e..c3b59789 100644 --- a/NEConversationUIKit/NEConversationUIKit/Classes/FunUI/Controller/FunConversationController.swift +++ b/NEConversationUIKit/NEConversationUIKit/Classes/FunUI/Controller/FunConversationController.swift @@ -63,7 +63,6 @@ open class FunConversationController: NEBaseConversationController { popListView = FunPopListView() searchView.searchButton.setTitle(commonLocalizable("search"), for: .normal) brokenNetworkView.contentLabel.text = commonLocalizable("network_error") - securityWarningView.warningLabel.text = localizable("security_warning") } override func initSystemNav() { diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/NormalUI/Controller/ConversationController.swift b/NEConversationUIKit/NEConversationUIKit/Classes/NormalUI/Controller/ConversationController.swift index 7fef3f54..e6c81552 100644 --- a/NEConversationUIKit/NEConversationUIKit/Classes/NormalUI/Controller/ConversationController.swift +++ b/NEConversationUIKit/NEConversationUIKit/Classes/NormalUI/Controller/ConversationController.swift @@ -67,7 +67,6 @@ open class ConversationController: NEBaseConversationController { initSystemNav() popListView = PopListView() brokenNetworkView.contentLabel.text = commonLocalizable("network_error") - securityWarningView.warningLabel.text = localizable("security_warning") } override func initSystemNav() { diff --git a/app.xcodeproj/project.pbxproj b/app.xcodeproj/project.pbxproj index b81724a6..8f4754cf 100644 --- a/app.xcodeproj/project.pbxproj +++ b/app.xcodeproj/project.pbxproj @@ -47,6 +47,7 @@ 181EE58D2B234C510043817F /* CustomContactTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE5842B234C510043817F /* CustomContactTableViewCell.swift */; }; 181EE58E2B234C510043817F /* CustomChatCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE5852B234C510043817F /* CustomChatCell.swift */; }; 181EE58F2B234C510043817F /* CustomConversationListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE5862B234C510043817F /* CustomConversationListCell.swift */; }; + 18A6A9842D1E822900209FC5 /* NESecurityWarningView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18A6A9832D1E822900209FC5 /* NESecurityWarningView.swift */; }; 18B05B342BD5FD0300666AD1 /* CustomFunChatViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18B05B322BD5FD0300666AD1 /* CustomFunChatViewController.swift */; }; 18B05B352BD5FD0300666AD1 /* CustomNormalChatViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18B05B332BD5FD0300666AD1 /* CustomNormalChatViewController.swift */; }; 18CF8A3B2D01B312000CF406 /* CustomContactViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18CF8A392D01B312000CF406 /* CustomContactViewController.swift */; }; @@ -125,6 +126,7 @@ 181EE5842B234C510043817F /* CustomContactTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomContactTableViewCell.swift; sourceTree = ""; }; 181EE5852B234C510043817F /* CustomChatCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomChatCell.swift; sourceTree = ""; }; 181EE5862B234C510043817F /* CustomConversationListCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomConversationListCell.swift; sourceTree = ""; }; + 18A6A9832D1E822900209FC5 /* NESecurityWarningView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NESecurityWarningView.swift; sourceTree = ""; }; 18B05B322BD5FD0300666AD1 /* CustomFunChatViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomFunChatViewController.swift; sourceTree = ""; }; 18B05B332BD5FD0300666AD1 /* CustomNormalChatViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomNormalChatViewController.swift; sourceTree = ""; }; 18CF8A382D01B312000CF406 /* CustomConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomConfig.swift; sourceTree = ""; }; @@ -244,6 +246,7 @@ 181EE57D2B234C510043817F /* Custom */ = { isa = PBXGroup; children = ( + 18A6A9832D1E822900209FC5 /* NESecurityWarningView.swift */, 18CF8A382D01B312000CF406 /* CustomConfig.swift */, 18CF8A392D01B312000CF406 /* CustomContactViewController.swift */, 18B05B322BD5FD0300666AD1 /* CustomFunChatViewController.swift */, @@ -470,6 +473,7 @@ buildActionMask = 2147483647; files = ( 181EE58D2B234C510043817F /* CustomContactTableViewCell.swift in Sources */, + 18A6A9842D1E822900209FC5 /* NESecurityWarningView.swift in Sources */, 181EE5872B234C510043817F /* CustomView.swift in Sources */, 181EE58F2B234C510043817F /* CustomConversationListCell.swift in Sources */, 181EE5882B234C510043817F /* CustomP2PChatViewController.swift in Sources */, diff --git a/app/Custom/CustomConfig.swift b/app/Custom/CustomConfig.swift index e19cd4f9..b9620e3c 100644 --- a/app/Custom/CustomConfig.swift +++ b/app/Custom/CustomConfig.swift @@ -352,6 +352,26 @@ public class CustomConfig { } } + /// 通过布局自定义实现顶部警告 + open func loadSecurityWarningView() { + ConversationUIConfig.shared.customController = { [weak self] viewController in + guard let self = self else { + return + } + + // 顶部bodyTopView中添加自定义view(需要设置bodyTopView的高度) + self.securityWarningView.warningLabel.text = localizable("security_warning") + viewController.bodyTopView.addSubview(self.securityWarningView) + NSLayoutConstraint.activate([ + self.securityWarningView.topAnchor.constraint(equalTo: viewController.bodyTopView.topAnchor), + self.securityWarningView.leftAnchor.constraint(equalTo: viewController.bodyTopView.leftAnchor), + self.securityWarningView.rightAnchor.constraint(equalTo: viewController.bodyTopView.rightAnchor), + self.securityWarningView.heightAnchor.constraint(equalToConstant: 56), + ]) + viewController.bodyTopViewHeight = 56 + } + } + @objc func customClick(_ button: UIButton) { button.neViewContainingController()?.showToast("文本输入框下方 tab 按钮自定义点击事件") } @@ -369,4 +389,10 @@ public class CustomConfig { view.backgroundColor = .green return view }() + + public lazy var securityWarningView: NESecurityWarningView = { + let view = NESecurityWarningView() + view.translatesAutoresizingMaskIntoConstraints = false + return view + }() } diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/View/NESecurityWarningView.swift b/app/Custom/NESecurityWarningView.swift similarity index 93% rename from NEConversationUIKit/NEConversationUIKit/Classes/Conversation/View/NESecurityWarningView.swift rename to app/Custom/NESecurityWarningView.swift index 2348d005..a92b0b82 100644 --- a/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/View/NESecurityWarningView.swift +++ b/app/Custom/NESecurityWarningView.swift @@ -3,6 +3,7 @@ // found in the LICENSE file. import Foundation +import UIKit open class NESecurityWarningView: UIView { override public init(frame: CGRect) { @@ -27,7 +28,7 @@ open class NESecurityWarningView: UIView { public lazy var backView: UIView = { let view = UIView() view.translatesAutoresizingMaskIntoConstraints = false - view.backgroundColor = .securityWarningBg + view.backgroundColor = UIColor(hexString: "#FFF5E1") view.addSubview(warningLabel) NSLayoutConstraint.activate([ @@ -42,7 +43,7 @@ open class NESecurityWarningView: UIView { public lazy var warningLabel: UILabel = { let label = UILabel() label.translatesAutoresizingMaskIntoConstraints = false - label.textColor = .securityWarningTextColor + label.textColor = UIColor(hexString: "#EB9718") label.font = .systemFont(ofSize: 14) label.text = localizable("security_warning") label.textAlignment = .justified diff --git a/app/Main/AppDelegate.swift b/app/Main/AppDelegate.swift index db42898d..4bc5312a 100644 --- a/app/Main/AppDelegate.swift +++ b/app/Main/AppDelegate.swift @@ -103,8 +103,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD self.window?.rootViewController = tab } - // regist router + // regist router func loadService() { + // 注册路由 ChatKitClient.shared.setupInit(isFun: !NEStyleManager.instance.isNormalStyle()) if NEStyleManager.instance.isNormalStyle() == false { registerFunCustom() @@ -112,6 +113,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD registerNormalCustom() } + // 会话列表顶部插入警告内容 + CustomConfig.shared.loadSecurityWarningView() + + // 注册【个人信息】页面 Router.shared.register(MeSettingRouter) { param in if let nav = param["nav"] as? UINavigationController { let me = PersonInfoViewController() diff --git a/app/en.lproj/Localizable.strings b/app/en.lproj/Localizable.strings index 982ac4d8..bf9cc6ee 100644 --- a/app/en.lproj/Localizable.strings +++ b/app/en.lproj/Localizable.strings @@ -72,3 +72,4 @@ "privatized_configuration"="Privatized configuration"; "login_by_account"="login"; +"security_warning"="For test only. Beware of money transfer, lottery winnings & strange call scams."; diff --git a/app/zh-Hans.lproj/Localizable.strings b/app/zh-Hans.lproj/Localizable.strings index a88a06ae..2644f0fb 100644 --- a/app/zh-Hans.lproj/Localizable.strings +++ b/app/zh-Hans.lproj/Localizable.strings @@ -71,3 +71,4 @@ "anti_error"="存在不安全内容,请重新输入。"; "privatized_configuration"="私有化配置"; "login_by_account"="账号登录"; +"security_warning"="仅用于体验云信IM 产品功能,请勿轻信汇款、中奖等涉及钱款的信息,勿轻易拨打陌生电话,谨防上当受骗。";