From ee2b2dca8717d3e3f80c7c17fcc4e5f4c0e0847b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E8=AF=97=E6=96=87?= Date: Fri, 8 Dec 2023 21:30:06 +0800 Subject: [PATCH] v9.6.5 --- NEChatUIKit/NEChatUIKit.podspec | 4 +- .../Assets/en.lproj/Localizable.strings | 6 +- .../Assets/zh-Hans.lproj/Localizable.strings | 8 +- .../ChatBaseViewController.swift | 24 +- .../Chat/Controller/ChatViewController.swift | 667 +++++++++-------- .../NEBasePinMessageViewController.swift | 35 +- .../Controller/NEBaseReadViewController.swift | 2 +- .../NEBaseSelectUserViewController.swift | 2 +- .../NEBaseUserSettingViewController.swift | 91 ++- .../Chat/Controller/TextViewController.swift | 3 +- .../Emoji/InputEmoticonContainerView.swift | 1 - .../Chat/Emoji/InputEmoticonTabView.swift | 3 +- .../Classes/Chat/Emoji/NEEmotionTool.swift | 2 +- .../Helper/NotificationMessageUtils.swift | 5 +- .../Chat/Model/MessageCallRecordModel.swift | 7 +- .../Classes/Chat/Model/MessageTextModel.swift | 5 +- .../Classes/Chat/Model/MessageTipsModel.swift | 2 +- .../View/Cell/NEBaseChatMessageCell.swift | 36 +- .../View/Cell/NEBaseChatMessageTipCell.swift | 4 +- .../Cell/NEBaseUserSettingSwitchCell.swift | 1 + .../PinCell/NEBasePinMessageAudioCell.swift | 2 +- .../View/ChatView/MessageOperationView.swift | 15 +- .../View/ChatView/NEBaseChatInputView.swift | 3 +- .../Chat/ViewModel/ChatViewModel.swift | 11 +- .../Classes/ChatConfig/ChatUIConfig.swift | 39 +- .../Classes/Common/NEChatUIKitClient.swift | 5 + .../Classes/Common/NEChatUITool.swift | 26 - .../Extension/ChatStringExtension.swift | 20 - .../FunUI/Cell/FunChatMessageBaseCell.swift | 14 +- .../FunUI/Cell/FunChatMessageCallCell.swift | 4 +- .../FunUI/Cell/FunChatMessageTextCell.swift | 4 +- .../Cell/PinCell/FunPinMessageAudioCell.swift | 2 +- .../Controller/FunChatViewController.swift | 56 +- .../FunGroupChatViewController.swift | 14 +- .../Controller/FunP2PChatViewController.swift | 33 +- .../FunPinMessageViewController.swift | 18 +- .../Controller/FunReadViewController.swift | 2 +- .../FunUserSettingViewController.swift | 72 +- .../NormalUI/Cell/ChatMessageCallCell.swift | 4 +- .../NormalUI/Cell/ChatMessageReplyCell.swift | 6 +- .../NormalUI/Cell/ChatMessageTextCell.swift | 4 +- .../Controller/GroupChatViewController.swift | 18 +- .../Controller/NormalChatViewController.swift | 16 +- .../Controller/P2PChatViewController.swift | 33 +- .../Controller/PinMessageViewController.swift | 2 +- .../Controller/ReadViewController.swift | 4 +- .../UserSettingViewController.swift | 8 +- .../Classes/NormalUI/View/ChatInpuView.swift | 6 +- NEContactUIKit/NEContactUIKit.podspec | 4 +- .../Assets/en.lproj/Localizable.strings | 2 +- .../Assets/zh-Hans.lproj/Localizable.strings | 2 +- .../Classes/Base/NEBaseContactViewCell.swift | 1 + .../NEBaseBlackListViewController.swift | 22 +- .../Classes/Common/ContactConst.swift | 3 - .../ContactConfig/ContactUIConfig.swift | 63 +- .../FunUI/Cell/FunContactSelectedCell.swift | 8 +- .../FunUI/Cell/FunContactTableViewCell.swift | 8 +- .../Classes/FunUI/FunContactRouter.swift | 27 +- .../FunContactRemakNameViewController.swift | 2 +- .../FunContactUserViewController.swift | 2 +- .../FunContactsSelectedViewController.swift | 4 +- .../FunContactsViewController.swift | 141 ++-- .../FunValidationMessageViewController.swift | 2 +- .../NormalUI/Cell/ContactSelectedCell.swift | 2 +- .../NormalUI/Cell/ContactTableViewCell.swift | 2 +- .../NormalUI/NromalContactRouter.swift | 27 +- .../BlackListViewController.swift | 2 +- .../ContactsSelectedViewController.swift | 6 +- .../ContactsViewController.swift | 137 ++-- .../FindFriendViewController.swift | 2 +- .../TeamListViewController.swift | 2 +- .../ValidationMessageViewController.swift | 4 +- .../NEBaseTeamListViewController.swift | 20 +- .../UserInfo/Views/CenterTextCell.swift | 1 + .../Views/TextWithDetailTextCell.swift | 1 + .../UserInfo/Views/TextWithSwitchCell.swift | 1 + ...EBaseValidationMessageViewController.swift | 8 +- .../Cell/NEBaseContactTableViewCell.swift | 8 +- .../Classes/Views/ContactSectionView.swift | 4 +- ...NEBaseContactRemakNameViewController.swift | 9 +- .../NEBaseContactUserViewController.swift | 42 +- .../Views/NEBaseContactViewController.swift | 18 +- ...NEBaseContactsSelectedViewController.swift | 18 +- .../Views/NEBaseContactsViewController.swift | 322 ++++++--- .../NEBaseFindFriendViewController.swift | 11 +- .../NEConversationUIKit.podspec | 4 +- .../Cell/NEBaseConversationListCell.swift | 20 +- .../NEBaseConversationController.swift | 675 +++++++++++++++++- ...NEBaseConversationListViewController.swift | 443 ------------ ...BaseConversationNavigationController.swift | 20 +- .../NEBaseConversationSearchController.swift | 36 +- .../NEBasePopListViewController.swift | 24 +- .../ViewModel/ConversationViewModel.swift | 79 +- .../ConversationUIConfig.swift | 106 ++- .../FunUI/Cell/FunConversationListCell.swift | 12 +- .../FunConversationController.swift | 97 +-- .../FunConversationListViewController.swift | 85 --- .../FunConversationSearchController.swift | 7 +- .../Controller/FunPopListViewController.swift | 13 +- .../Classes/FunUI/FunConversationRouter.swift | 2 +- .../Classes/Manager/NEAtMessageManager.swift | 8 +- .../NormalUI/Cell/ConversationListCell.swift | 10 +- .../Controller/ConversationController.swift | 93 +-- .../ConversationListViewController.swift | 26 - .../ConversationSearchController.swift | 2 +- .../Controller/PopListViewController.swift | 5 +- .../NormalUI/NormalConversationRouter.swift | 2 +- NEMapKit/NEMapKit.podspec | 4 +- NERtcCallUIKit/NERtcCallUIKit.podspec | 8 +- NETeamUIKit/NETeamUIKit.podspec | 4 +- .../FunTeamAvatarViewController.swift | 8 +- .../FunTeamHistoryMessageController.swift | 2 +- .../FunTeamInfoViewController.swift | 8 +- .../FunTeamIntroduceViewController.swift | 4 +- .../FunTeamNameViewController.swift | 12 +- .../FunTeamSettingViewController.swift | 14 +- .../Controller/TeamAvatarViewController.swift | 6 +- .../TeamHistoryMessageController.swift | 2 +- .../Controller/TeamInfoViewController.swift | 6 +- .../TeamIntroduceViewController.swift | 6 +- .../Controller/TeamMembersController.swift | 2 +- .../Controller/TeamNameViewController.swift | 6 +- .../TeamSettingViewController.swift | 12 +- .../Setting/NEBaseTeamMembersController.swift | 17 +- .../View/NEBaseTeamAvatarViewController.swift | 13 +- .../View/NEBaseTeamInfoViewController.swift | 9 + .../NEBaseTeamIntroduceViewController.swift | 6 +- .../View/NEBaseTeamNameViewController.swift | 14 +- .../Setting/View/NEBaseTeamSettingCell.swift | 1 + .../View/NEBaseTeamSettingSwitchCell.swift | 1 + .../NEBaseTeamSettingViewController.swift | 18 +- .../View/TeamSettingRightCustomCell.swift | 1 + .../View/TeamSettingSubtitleCell.swift | 1 + .../Setting/ViewModel/TeamInfoViewModel.swift | 2 +- .../ViewModel/TeamSettingViewModel.swift | 4 +- Podfile | 55 +- app.xcodeproj/project.pbxproj | 428 +++++------ app/Custom/CustomAttachment.swift | 4 +- app/Custom/CustomChatCell.swift | 4 +- app/Custom/CustomContactTableViewCell.swift | 2 +- app/Custom/CustomContactsViewController.swift | 148 +++- app/Custom/CustomConversationController.swift | 211 ++++-- app/Custom/CustomConversationListCell.swift | 2 +- ...CustomConversationListViewController.swift | 44 -- app/Custom/CustomP2PChatViewController.swift | 366 ++++++---- .../{CustomTopView.swift => CustomView.swift} | 19 +- .../Controller/ConfigTestViewController.swift | 163 +++++ .../InputPersonInfoController.swift | 27 +- .../IntroduceBrandViewController.swift | 10 +- app/Mine/Controller/MeViewController.swift | 25 +- .../MessageRemindViewController.swift | 6 +- .../MineSettingViewController.swift | 56 +- .../Controller/NEAboutWebViewController.swift | 6 +- .../Controller/NENodeViewController.swift | 4 +- .../Controller/PersonInfoViewController.swift | 15 +- .../StyleSelectionViewController.swift | 6 +- app/Mine/View/BirthdayDatePickerView.swift | 4 +- app/Mine/View/MineTableViewCell.swift | 3 +- app/Mine/View/NodeSelectCell.swift | 2 +- .../Theme/CustomTeamArrowSettingCell.swift | 4 +- .../Theme/CustomTeamSettingHeaderCell.swift | 4 +- .../CustomTeamSettingRightCustomCell.swift | 4 +- .../Theme/CustomTeamSettingSubtitleCell.swift | 4 +- .../Theme/CustomTeamSettingSwitchCell.swift | 4 +- app/Mine/View/VersionCell.swift | 3 +- .../ViewModel/MessageRemindViewModel.swift | 22 +- app/Mine/ViewModel/MineSettingViewModel.swift | 36 +- app/Mine/ViewModel/NodeViewModel.swift | 14 +- app/Mine/ViewModel/PersonInfoViewModel.swift | 9 +- 169 files changed, 3361 insertions(+), 2600 deletions(-) delete mode 100644 NEChatUIKit/NEChatUIKit/Classes/Common/NEChatUITool.swift delete mode 100644 NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBaseConversationListViewController.swift delete mode 100644 NEConversationUIKit/NEConversationUIKit/Classes/FunUI/Controller/FunConversationListViewController.swift delete mode 100644 NEConversationUIKit/NEConversationUIKit/Classes/NormalUI/Controller/ConversationListViewController.swift delete mode 100644 app/Custom/CustomConversationListViewController.swift rename app/Custom/{CustomTopView.swift => CustomView.swift} (60%) create mode 100644 app/Mine/Controller/ConfigTestViewController.swift diff --git a/NEChatUIKit/NEChatUIKit.podspec b/NEChatUIKit/NEChatUIKit.podspec index b6314fa1..e83b1a6d 100644 --- a/NEChatUIKit/NEChatUIKit.podspec +++ b/NEChatUIKit/NEChatUIKit.podspec @@ -16,7 +16,7 @@ Pod::Spec.new do |s| # s.name = 'NEChatUIKit' - s.version = '9.6.3' + s.version = '9.6.5' s.summary = 'Chat Module of IM.' # This description is used to generate tags and improve search results. @@ -32,7 +32,7 @@ TODO: Add long description of the pod here. s.author = 'yunxin engineering department' s.source = { :git => 'ssh://git@g.hz.netease.com:22222/yunxin-app/xkit-ios.git', :tag => s.version.to_s } - s.ios.deployment_target = '10.0' + s.ios.deployment_target = '11.0' s.swift_version = '5.0' s.source_files = 'NEChatUIKit/Classes/**/*' diff --git a/NEChatUIKit/NEChatUIKit/Assets/en.lproj/Localizable.strings b/NEChatUIKit/NEChatUIKit/Assets/en.lproj/Localizable.strings index 2437c7c9..a73fea56 100644 --- a/NEChatUIKit/NEChatUIKit/Assets/en.lproj/Localizable.strings +++ b/NEChatUIKit/NEChatUIKit/Assets/en.lproj/Localizable.strings @@ -94,8 +94,8 @@ "withdrew_message" = "withdrew this message"; "message_has_be_withdrawn" = "message recalled"; "message_reedit" = "reedit"; -"message_revoke_confim" = "Wether to recall this message"; -"message_delete_comfirm"="Wether to delete this message"; +"message_revoke_confirm" = "Wether to recall this message"; +"message_delete_confirm"="Wether to delete this message"; //MARK: toast @@ -139,7 +139,7 @@ "search_result_empty"="Not found"; "no_map_plugin"="Map module not integrated"; "location_not_auth"="The geographic location is not authorized. Please open it in the settings"; -"fileSize_over_limit"="Oops!File size limit over XXXM."; +"fileSize_over_limit"="Oops!File size limit over %@M."; "message_recalled"="message recalled"; diff --git a/NEChatUIKit/NEChatUIKit/Assets/zh-Hans.lproj/Localizable.strings b/NEChatUIKit/NEChatUIKit/Assets/zh-Hans.lproj/Localizable.strings index 8c57aa07..45a7848a 100644 --- a/NEChatUIKit/NEChatUIKit/Assets/zh-Hans.lproj/Localizable.strings +++ b/NEChatUIKit/NEChatUIKit/Assets/zh-Hans.lproj/Localizable.strings @@ -24,7 +24,7 @@ "downloading"="正在下载中..."; "read"="已读(0)"; "unread"="未读(0)"; -"network_unavailable"="当前网络不可用,请检查你当网络设置。"; +"network_unavailable"="当前网络不可用,请检查你的网络设置"; //MARK: tips //MARK: team @@ -91,8 +91,8 @@ "withdrew_message" = "撤回了一条消息"; "message_has_be_withdrawn" = "此消息已撤回"; "message_reedit" = "重新编辑"; -"message_revoke_confim" = "确认要撤回该消息吗?"; -"message_delete_comfirm"="确认要删除该消息吗?"; +"message_revoke_confirm" = "确认要撤回该消息吗?"; +"message_delete_confirm"="确认要删除该消息吗?"; //MARK: toast @@ -136,7 +136,7 @@ "search_result_empty"="未找到你要搜的地址"; "no_map_plugin"="未集成地图模块"; "location_not_auth"="地理位置未授权,请去设置中开启"; -"fileSize_over_limit"="当前文件大小超出XXXM发送限制,请重新选择"; +"fileSize_over_limit"="当前文件大小超出%@M发送限制,请重新选择"; "message_recalled"="此消息已撤回"; diff --git a/NEChatUIKit/NEChatUIKit/Classes/Base/BaseViewController/ChatBaseViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/Base/BaseViewController/ChatBaseViewController.swift index d1e78844..d91547c9 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Base/BaseViewController/ChatBaseViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Base/BaseViewController/ChatBaseViewController.swift @@ -10,7 +10,7 @@ import UIKit @objcMembers open class ChatBaseViewController: UIViewController, UIGestureRecognizerDelegate { var topConstant: CGFloat = 0 - public let customNavigationView = NENavigationView() + public let navigationView = NENavigationView() override open var title: String? { get { @@ -19,16 +19,16 @@ open class ChatBaseViewController: UIViewController, UIGestureRecognizerDelegate set { super.title = newValue - customNavigationView.navTitle.text = newValue + navigationView.navTitle.text = newValue } } override open func viewDidLoad() { super.viewDidLoad() navigationController?.interactivePopGestureRecognizer?.delegate = self - view.backgroundColor = NEKitChatConfig.shared.ui.chatViewBackground ?? .white + view.backgroundColor = NEKitChatConfig.shared.ui.messageProperties.chatViewBackground ?? .white - if !NEKitChatConfig.shared.ui.showTitleBar { + if !NEKitChatConfig.shared.ui.messageProperties.showTitleBar { navigationController?.isNavigationBarHidden = true return } @@ -40,15 +40,15 @@ open class ChatBaseViewController: UIViewController, UIGestureRecognizerDelegate } else { navigationController?.isNavigationBarHidden = true topConstant = NEConstant.navigationAndStatusHeight - customNavigationView.translatesAutoresizingMaskIntoConstraints = false - customNavigationView.addBackButtonTarget(target: self, selector: #selector(backEvent)) - customNavigationView.addMoreButtonTarget(target: self, selector: #selector(toSetting)) - view.addSubview(customNavigationView) + navigationView.translatesAutoresizingMaskIntoConstraints = false + navigationView.addBackButtonTarget(target: self, selector: #selector(backEvent)) + navigationView.addMoreButtonTarget(target: self, selector: #selector(toSetting)) + view.addSubview(navigationView) NSLayoutConstraint.activate([ - customNavigationView.leftAnchor.constraint(equalTo: view.leftAnchor), - customNavigationView.rightAnchor.constraint(equalTo: view.rightAnchor), - customNavigationView.topAnchor.constraint(equalTo: view.topAnchor), - customNavigationView.heightAnchor.constraint(equalToConstant: topConstant), + navigationView.leftAnchor.constraint(equalTo: view.leftAnchor), + navigationView.rightAnchor.constraint(equalTo: view.rightAnchor), + navigationView.topAnchor.constraint(equalTo: view.topAnchor), + navigationView.heightAnchor.constraint(equalToConstant: topConstant), ]) } } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/ChatViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/ChatViewController.swift index 2c62e46a..b70f658b 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/ChatViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/ChatViewController.swift @@ -23,93 +23,72 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel private let tag = "ChatViewController" private let kCallKitDismissNoti = "kCallKitDismissNoti" private let kCallKitShowNoti = "kCallKitShowNoti" + public var titleContent = "" + + public var viewmodel: ChatViewModel + let interactionController = UIDocumentInteractionController() + private lazy var manager = CLLocationManager() private var playingCell: ChatAudioCellProtocol? private var playingModel: MessageAudioModel? - private var atUsers = [NSRange]() private var timer: Timer? private var isFile: Bool? // 是否以文件形式发送 - private var needMarkReadMsgs = [NIMMessage]() private var isCurrentPage = true - var replyView = ReplyView() - public var titleContent = "" - let interactionController = UIDocumentInteractionController() + public var operationCellFilter: [OperationType]? // 消息长按菜单全局过滤列表 + public var cellRegisterDic = [String: UITableViewCell.Type]() + private var needMarkReadMsgs = [NIMMessage]() + private var atUsers = [NSRange]() + let group = DispatchGroup() - public var viewmodel: ChatViewModel - public var inputViewTopConstraint: NSLayoutConstraint? - public var tableViewBottomConstraint: NSLayoutConstraint? - public var menuView: NEBaseChatInputView! + var replyView = ReplyView() +// public var menuView: NEBaseChatInputView! public var operationView: MessageOperationView? - public var operationCellFilter: [OperationType]? + + public var normalOffset: CGFloat = 0 public var bottomExanpndHeight: CGFloat = 204 // 底部展开高度 public var normalInputHeight: CGFloat = 100 - public var normalOffset: CGFloat = 0 - public var registerCellDic = [String: UITableViewCell.Type]() - - public lazy var inputTopExtendView: UIView = { - let content = UIView() - content.translatesAutoresizingMaskIntoConstraints = false - content.backgroundColor = UIColor.clear - return content - }() + public var brokenNetworkViewHeight: CGFloat = 36 + public lazy var bodyTopViewHeight: CGFloat = 0 { + didSet { + bodyTopViewHeightAnchor?.constant = bodyTopViewHeight + bodyTopView.isHidden = bodyTopViewHeight <= 0 + } + } - public lazy var navigationBarBottomExtendView: UIView = { - let content = UIView() - content.translatesAutoresizingMaskIntoConstraints = false - content.backgroundColor = UIColor.clear - return content - }() + public lazy var bodyBottomViewHeight: CGFloat = 0 { + didSet { + bodyBottomViewHeightAnchor?.constant = bodyBottomViewHeight + bodyBottomView.isHidden = bodyBottomViewHeight <= 0 + } + } - public lazy var inputTopExtendHeight: CGFloat = 0 - public lazy var navigationBarBottomExtendHeight: CGFloat = 0 - public var inputTopExtendHeightConstant: NSLayoutConstraint? - public var navigationBarBottomExtendHeightConstant: NSLayoutConstraint? + public lazy var bottomViewHeight: CGFloat = 304 { + didSet { + bottomViewHeightAnchor?.constant = bottomViewHeight + } + } - private lazy var manager = CLLocationManager() + public var bodyTopViewHeightAnchor: NSLayoutConstraint? + public var bodyBottomViewHeightAnchor: NSLayoutConstraint? + public var contentViewTopAnchor: NSLayoutConstraint? + public var bottomViewTopAnchor: NSLayoutConstraint? + public var bottomViewHeightAnchor: NSLayoutConstraint? public init(session: NIMSession) { viewmodel = ChatViewModel(session: session, anchor: nil) super.init(nibName: nil, bundle: nil) - menuView = getMenuView() +// menuView = getMenuView() NEKeyboardManager.shared.enable = false NEKeyboardManager.shared.enableAutoToolbar = false NIMSDK.shared().mediaManager.add(self) - NIMSDK.shared().mediaManager.setNeedProximityMonitor(viewmodel.getHandSetEnable()) + NIMSDK.shared().mediaManager.switch(viewmodel.getHandSetEnable() ? .receiver : .speaker) } public required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } - override open func backEvent() { - super.backEvent() - cleanDelegate() - } - - override open func viewDidLoad() { - super.viewDidLoad() - commonUI() - addObseve() - weak var weakSelf = self - viewmodel.fetchPinMessage { - weakSelf?.loadData() - } - } - - func appEnterBackground() { - isCurrentPage = false - } - - func appEnterForegournd() { - isCurrentPage = true - } - - open func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { - textView.typingAttributes = [NSAttributedString.Key.foregroundColor: UIColor.ne_darkText, NSAttributedString.Key.font: UIFont.systemFont(ofSize: 16)] - return true - } - override open func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) NEKeyboardManager.shared.enable = false @@ -119,27 +98,28 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel getSessionInfo(session: viewmodel.session) clearAtRemind() - weak var weakSelf = self - NEChatDetectNetworkTool.shareInstance.netWorkReachability { status in - if status == .notReachable, - let networkView = weakSelf?.brokenNetworkView, - let self = weakSelf { - self.view.addSubview(networkView) - NSLayoutConstraint.activate([ - networkView.topAnchor.constraint( - equalTo: self.tableView.topAnchor, - constant: 0 - ), - networkView.leftAnchor.constraint(equalTo: self.view.leftAnchor), - networkView.rightAnchor.constraint(equalTo: self.view.rightAnchor), - networkView.heightAnchor.constraint(equalToConstant: self.networkToolHeight), - ]) + NEChatDetectNetworkTool.shareInstance.netWorkReachability { [weak self] status in + if status == .notReachable { + self?.brokenNetworkView.isHidden = false + self?.contentViewTopAnchor?.constant = self?.brokenNetworkViewHeight ?? 36 } else { - weakSelf?.brokenNetworkView.removeFromSuperview() + self?.brokenNetworkView.isHidden = true + self?.contentViewTopAnchor?.constant = 0 } } } + override open func viewDidLoad() { + super.viewDidLoad() + viewmodel.delegate = self + commonUI() + addObseve() + weak var weakSelf = self + viewmodel.fetchPinMessage { + weakSelf?.loadData() + } + } + override open func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) NEKeyboardManager.shared.enable = true @@ -157,8 +137,88 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel stopPlay() } + open func commonUI() { + title = viewmodel.session.sessionId + navigationView.titleBarBottomLine.isHidden = false + if NEKitChatConfig.shared.ui.messageProperties.showTitleBarRightIcon { + let image = NEKitChatConfig.shared.ui.messageProperties.titleBarRightRes ?? UIImage.ne_imageNamed(name: "three_point") + addRightAction(image, #selector(toSetting), self) + navigationView.setMoreButtonImage(image) + } else { + navigationView.moreButton.isHidden = true + } + + view.addSubview(bodyTopView) + view.addSubview(bodyView) + view.addSubview(bodyBottomView) + view.addSubview(bottomView) + + var bodyTopViewTopConstant: CGFloat = 0 + if #available(iOS 10, *) { + bodyTopViewTopConstant += KStatusBarHeight + } + if NEKitChatConfig.shared.ui.messageProperties.showTitleBar { + bodyTopViewTopConstant += kNavigationHeight + } + bodyTopViewHeightAnchor = bodyTopView.heightAnchor.constraint(equalToConstant: bodyTopViewHeight) + bodyTopViewHeightAnchor?.isActive = true + NSLayoutConstraint.activate([ + bodyTopView.topAnchor.constraint(equalTo: view.topAnchor, constant: bodyTopViewTopConstant), + bodyTopView.leftAnchor.constraint(equalTo: view.leftAnchor), + bodyTopView.rightAnchor.constraint(equalTo: view.rightAnchor), + ]) + + NSLayoutConstraint.activate([ + bodyView.topAnchor.constraint(equalTo: bodyTopView.bottomAnchor), + bodyView.leftAnchor.constraint(equalTo: view.leftAnchor), + bodyView.rightAnchor.constraint(equalTo: view.rightAnchor), + bodyView.bottomAnchor.constraint(equalTo: bodyBottomView.topAnchor), + ]) + + bodyBottomViewHeightAnchor = bodyBottomView.heightAnchor.constraint(equalToConstant: bodyBottomViewHeight) + bodyBottomViewHeightAnchor?.isActive = true + NSLayoutConstraint.activate([ + bodyBottomView.bottomAnchor.constraint(equalTo: chatInputView.topAnchor), + bodyBottomView.leftAnchor.constraint(equalTo: view.leftAnchor), + bodyBottomView.rightAnchor.constraint(equalTo: view.rightAnchor), + ]) + + bottomViewTopAnchor = bottomView.topAnchor.constraint(equalTo: view.bottomAnchor, constant: -normalInputHeight) + bottomViewTopAnchor?.isActive = true + bottomViewHeightAnchor = bottomView.heightAnchor.constraint(equalToConstant: bottomViewHeight) + bottomViewHeightAnchor?.isActive = true + NSLayoutConstraint.activate([ + bottomView.leftAnchor.constraint(equalTo: view.leftAnchor), + bottomView.rightAnchor.constraint(equalTo: view.rightAnchor), + ]) + + tableView.register( + NEBaseChatMessageCell.self, + forCellReuseIdentifier: "\(NEBaseChatMessageCell.self)" + ) + + NEChatUIKitClient.instance.getRegisterCustomCell().forEach { (key: String, value: UITableViewCell.Type) in + cellRegisterDic[key] = value + } + + cellRegisterDic.forEach { (key: String, value: UITableViewCell.Type) in + tableView.register(value, forCellReuseIdentifier: key) + } + + expandMoreAction() + + if let customController = NEKitChatConfig.shared.ui.customController { + customController(self) + } + } + // MARK: 子类可重写方法 + override open func backEvent() { + super.backEvent() + cleanDelegate() + } + // load data的时候会调用 open func getSessionInfo(session: NIMSession) {} @@ -189,7 +249,16 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel /// - cell: 长按cell /// - model: cell模型 open func didLongTouchMessageView(_ cell: UITableViewCell, _ model: MessageContentModel?) { + if model?.isRevoked == true { + return + } + + // 底部收起 + chatInputView.textView.resignFirstResponder() + layoutInputView(offset: 0) + operationView?.removeFromSuperview() + // get operations guard let items = viewmodel.avalibleOperationsForMessage(model) else { return @@ -205,62 +274,110 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel } } + // 配置项自定义 items + if let chatPopMenu = NEKitChatConfig.shared.ui.chatPopMenu { + chatPopMenu(&filterItems, model) + } + // 供用户自定义 items setOperationItems(items: &filterItems, model: model) - if model?.isRevoked == true { - return - } - viewmodel.operationModel = model + group.notify(queue: .main) { + DispatchQueue.main.asyncAfter(deadline: .now() + 0.1, execute: DispatchWorkItem(block: { [self] in + // size + let w = filterItems.count <= 5 ? 60.0 * Double(filterItems.count) + 16.0 : 60.0 * 5 + 16.0 + let h = filterItems.count <= 5 ? 56.0 + 16.0 : 56.0 * 2 + 16.0 + + if let index = tableView.indexPath(for: cell) { + let rectInTableView = tableView.rectForRow(at: index) + let rectInView = tableView.convert(rectInTableView, to: view) + let topOffset = NEConstant.navigationAndStatusHeight + var operationY = 0.0 + if topOffset + h + bodyTopViewHeight > rectInView.origin.y { + // under the cell + operationY = rectInView.origin.y + rectInView.size.height + } else { + operationY = rectInView.origin.y - h + } + var frameX = 0.0 + if let msg = model?.message, + msg.isOutgoingMsg { + frameX = kScreenWidth - w + } + var frame = CGRect(x: frameX, y: operationY, width: w, height: h) + if frame.origin.y + h < tableView.frame.origin.y { + frame.origin.y = tableView.frame.origin.y + } else if frame.origin.y + h > view.frame.size.height { + frame.origin.y = tableView.frame.origin.y + tableView.frame.size.height - h + } -// size - let w = filterItems.count <= 5 ? 60.0 * Double(filterItems.count) + 16.0 : 60.0 * 5 + 16.0 - let h = filterItems.count <= 5 ? 56.0 + 16.0 : 56.0 * 2 + 16.0 - - if let index = tableView.indexPath(for: cell) { - let rectInTableView = tableView.rectForRow(at: index) - let rectInView = tableView.convert(rectInTableView, to: tableView.superview) - let topOffset = UIApplication.shared.statusBarFrame.size.height + navigationController! - .navigationBar.frame.size.height - var operationY = 0.0 - if topOffset + h > rectInView.origin.y { -// under the cell - operationY = rectInView.origin.y + rectInView.size.height - } else { - operationY = rectInView.origin.y - h - } - var frameX = 0.0 - if let msg = model?.message, - msg.isOutgoingMsg { - frameX = kScreenWidth - w - } - var frame = CGRect(x: frameX, y: operationY, width: w, height: h) - if frame.origin.y + h < tableView.frame.origin.y { - frame.origin.y = tableView.frame.origin.y - } else if frame.origin.y + h > view.frame.size.height { - frame.origin.y = tableView.frame.origin.y + tableView.frame.size.height - h - } - - operationView = MessageOperationView(frame: frame) - operationView!.delegate = self - operationView!.items = filterItems - view.addSubview(operationView!) + operationView = MessageOperationView(frame: frame) + operationView!.delegate = self + operationView!.items = filterItems + view.addSubview(operationView!) + } + })) } } // MARK: lazy Method - public var networkToolHeight: CGFloat = 36 + public lazy var bodyTopView: UIView = { + let view = UIView() + view.translatesAutoresizingMaskIntoConstraints = false + view.backgroundColor = UIColor.clear + return view + }() + + public lazy var bodyView: UIView = { + let view = UIView() + view.translatesAutoresizingMaskIntoConstraints = false + view.backgroundColor = UIColor.clear + view.addSubview(brokenNetworkView) + view.addSubview(contentView) + + NSLayoutConstraint.activate([ + brokenNetworkView.topAnchor.constraint(equalTo: view.topAnchor), + brokenNetworkView.leftAnchor.constraint(equalTo: view.leftAnchor), + brokenNetworkView.rightAnchor.constraint(equalTo: view.rightAnchor), + brokenNetworkView.heightAnchor.constraint(equalToConstant: brokenNetworkViewHeight), + ]) + + contentViewTopAnchor = contentView.topAnchor.constraint(equalTo: view.topAnchor) + contentViewTopAnchor?.isActive = true + NSLayoutConstraint.activate([ + contentView.leftAnchor.constraint(equalTo: view.leftAnchor), + contentView.rightAnchor.constraint(equalTo: view.rightAnchor), + contentView.bottomAnchor.constraint(equalTo: view.bottomAnchor), + ]) + + return view + }() public lazy var brokenNetworkView: NEBrokenNetworkView = { - let view = - NEBrokenNetworkView(frame: CGRect(x: 0, y: kNavigationHeight + KStatusBarHeight, - width: kScreenWidth, height: networkToolHeight)) + let view = NEBrokenNetworkView() view.translatesAutoresizingMaskIntoConstraints = false + view.isHidden = true return view }() + public lazy var contentView: UIView = { + let content = UIView() + content.translatesAutoresizingMaskIntoConstraints = false + content.backgroundColor = UIColor.clear + content.addSubview(tableView) + + NSLayoutConstraint.activate([ + tableView.topAnchor.constraint(equalTo: content.topAnchor), + tableView.leftAnchor.constraint(equalTo: content.leftAnchor), + tableView.rightAnchor.constraint(equalTo: content.rightAnchor), + tableView.bottomAnchor.constraint(equalTo: content.bottomAnchor), + ]) + + return content + }() + public lazy var tableView: UITableView = { let tableView = UITableView(frame: .zero, style: .plain) tableView.translatesAutoresizingMaskIntoConstraints = false @@ -277,14 +394,46 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel return tableView }() + public lazy var bodyBottomView: UIView = { + let view = UIView() + view.translatesAutoresizingMaskIntoConstraints = false + view.backgroundColor = UIColor.clear + return view + }() + + public lazy var bottomView: UIView = { + let view = UIView() + view.translatesAutoresizingMaskIntoConstraints = false + view.backgroundColor = UIColor.clear + view.addSubview(chatInputView) + + NSLayoutConstraint.activate([ + chatInputView.leftAnchor.constraint(equalTo: view.leftAnchor), + chatInputView.rightAnchor.constraint(equalTo: view.rightAnchor), + chatInputView.heightAnchor.constraint(equalToConstant: 304), + chatInputView.bottomAnchor.constraint(equalTo: view.bottomAnchor), + ]) + + return view + }() + + public lazy var chatInputView: NEBaseChatInputView = { + let menu = getMenuView() + menu.translatesAutoresizingMaskIntoConstraints = false + menu.backgroundColor = UIColor(hexString: "#EFF1F3") + menu.delegate = self + return menu + }() + // MARK: UIGestureRecognizerDelegate open func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool { -// print("touch.view:\(touch.view)") guard let view = touch.view else { return true } + + // 消息操作按钮 if view.bounds.size.width == 60 { return false } @@ -342,105 +491,6 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel // MARK: private 方法 - open func commonUI() { - title = viewmodel.session.sessionId - customNavigationView.bottomLine.isHidden = false - view.addSubview(tableView) - tableViewBottomConstraint = tableView.bottomAnchor.constraint( - equalTo: view.bottomAnchor, - constant: -normalInputHeight - inputTopExtendHeight - ) - tableViewBottomConstraint?.isActive = true - view.addSubview(navigationBarBottomExtendView) - - if #available(iOS 10, *) { - self.navigationBarBottomExtendHeightConstant = navigationBarBottomExtendView.heightAnchor.constraint(equalToConstant: navigationBarBottomExtendHeight) - self.navigationBarBottomExtendHeightConstant?.isActive = true - NSLayoutConstraint.activate([ - navigationBarBottomExtendView.topAnchor.constraint(equalTo: view.topAnchor, constant: kNavigationHeight + KStatusBarHeight), - navigationBarBottomExtendView.leftAnchor.constraint(equalTo: view.leftAnchor), - navigationBarBottomExtendView.rightAnchor.constraint(equalTo: view.rightAnchor), - ]) - NSLayoutConstraint.activate([ - tableView.topAnchor.constraint( - equalTo: navigationBarBottomExtendView.bottomAnchor, - constant: 0 - ), - tableView.leftAnchor.constraint(equalTo: view.leftAnchor), - tableView.rightAnchor.constraint(equalTo: view.rightAnchor), - ]) - } else { - navigationBarBottomExtendHeightConstant = navigationBarBottomExtendView.heightAnchor.constraint(equalToConstant: navigationBarBottomExtendHeight) - navigationBarBottomExtendHeightConstant?.isActive = true - NSLayoutConstraint.activate([ - navigationBarBottomExtendView.topAnchor.constraint(equalTo: view.topAnchor, constant: 0), - navigationBarBottomExtendView.leftAnchor.constraint(equalTo: view.leftAnchor), - navigationBarBottomExtendView.rightAnchor.constraint(equalTo: view.rightAnchor), - ]) - - NSLayoutConstraint.activate([ - tableView.topAnchor.constraint( - equalTo: navigationBarBottomExtendView.bottomAnchor, - constant: 0 - ), - tableView.leftAnchor.constraint(equalTo: view.leftAnchor), - tableView.rightAnchor.constraint(equalTo: view.rightAnchor), - ]) - } - - tableView.register( - NEBaseChatMessageCell.self, - forCellReuseIdentifier: "\(NEBaseChatMessageCell.self)" - ) - - NEChatUIKitClient.instance.getRegisterCustomCell().forEach { (key: String, value: UITableViewCell.Type) in - registerCellDic[key] = value - } - - registerCellDic.forEach { (key: String, value: UITableViewCell.Type) in - tableView.register(value, forCellReuseIdentifier: key) - } - - viewmodel.delegate = self - menuView.backgroundColor = UIColor(hexString: "#EFF1F3") - menuView.translatesAutoresizingMaskIntoConstraints = false - menuView.delegate = self - expandMoreAction() - view.addSubview(menuView) - - inputViewTopConstraint = menuView.topAnchor.constraint( - equalTo: view.bottomAnchor, - constant: -normalInputHeight - ) - NSLayoutConstraint.activate([ - menuView.leftAnchor.constraint(equalTo: view.leftAnchor), - menuView.rightAnchor.constraint(equalTo: view.rightAnchor), - menuView.heightAnchor.constraint(equalToConstant: 304), - ]) - inputViewTopConstraint?.isActive = true - - view.addSubview(inputTopExtendView) - inputTopExtendHeightConstant = inputTopExtendView.heightAnchor.constraint(equalToConstant: inputTopExtendHeight) - inputTopExtendHeightConstant?.isActive = true - NSLayoutConstraint.activate([ - inputTopExtendView.bottomAnchor.constraint(equalTo: menuView.topAnchor), - inputTopExtendView.leftAnchor.constraint(equalTo: view.leftAnchor), - inputTopExtendView.rightAnchor.constraint(equalTo: view.rightAnchor), - ]) - - if NEKitChatConfig.shared.ui.showTitleBarRightIcon { - let image = NEKitChatConfig.shared.ui.titleBarRightRes ?? UIImage.ne_imageNamed(name: "three_point") - addRightAction(image, #selector(toSetting), self) - customNavigationView.setMoreButtonImage(image) - } else { - customNavigationView.moreButton.isHidden = true - } - - if let pan = navigationController?.interactivePopGestureRecognizer { - tableView.panGestureRecognizer.require(toFail: pan) - } - } - func loadData() { weak var weakSelf = self @@ -540,6 +590,10 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel tap.delegate = self tap.cancelsTouchesInView = false view.addGestureRecognizer(tap) + + if let pan = navigationController?.interactivePopGestureRecognizer { + tableView.panGestureRecognizer.require(toFail: pan) + } } open func addBottomLoadMore() { @@ -567,15 +621,24 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel } } + func appEnterBackground() { + isCurrentPage = false + } + + func appEnterForegournd() { + isCurrentPage = true + } + // MARK: 键盘通知相关操作 open func keyBoardWillShow(_ notification: Notification) { - if menuView.currentType != .text { + operationView?.removeFromSuperview() + if chatInputView.currentType != .text { return } - menuView.currentButton?.isSelected = false + chatInputView.currentButton?.isSelected = false - menuView.contentSubView?.isHidden = true + chatInputView.contentSubView?.isHidden = true let oldKeyboardRect = (notification .userInfo?[UIResponder.keyboardFrameBeginUserInfoKey] as! NSValue).cgRectValue @@ -598,10 +661,10 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel } open func keyBoardWillHide(_ notification: Notification) { - if menuView.currentType != .text { + if chatInputView.currentType != .text { return } - menuView.currentButton?.isSelected = false + chatInputView.currentButton?.isSelected = false // 解决点击operation点击无效问题 // if operationView?.superview != nil { // operationView?.removeFromSuperview() @@ -630,12 +693,11 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel weak var weakSelf = self let topValue = normalInputHeight - normalOffset if offset == 0 { - menuView.contentSubView?.isHidden = true - menuView.currentButton?.isSelected = false + chatInputView.contentSubView?.isHidden = true + chatInputView.currentButton?.isSelected = false } UIView.animate(withDuration: 0.1, animations: { - weakSelf?.inputViewTopConstraint?.constant = -topValue - offset - weakSelf?.tableViewBottomConstraint?.constant = -topValue - offset - (weakSelf?.inputTopExtendHeight ?? 0) + weakSelf?.bottomViewTopAnchor?.constant = -topValue - offset }) } @@ -645,8 +707,8 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel guard let content = text, content.count > 0 else { return } - let remoteExt = menuView.getRemoteExtension(attribute) - menuView.cleartAtCache() + let remoteExt = chatInputView.getRemoteExtension(attribute) + chatInputView.cleartAtCache() weak var weakSelf = self if viewmodel.isReplying, let msg = viewmodel.operationModel?.message { viewmodel.replyMessageWithoutThread(message: MessageUtils.textMessage(text: content, remoteExt: remoteExt), target: msg) { [weak self] error in @@ -808,23 +870,23 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel } // 记录当前光标位置(removeSubrange后光标会直接跳到末尾) - var selRange = menuView.textView.selectedTextRange - if let oldCursor = menuView.textView.selectedTextRange { - if let newCursor = menuView.textView.position(from: oldCursor.start, offset: -rmRange.length) { - selRange = menuView.textView.textRange(from: newCursor, to: newCursor) + var selRange = chatInputView.textView.selectedTextRange + if let oldCursor = chatInputView.textView.selectedTextRange { + if let newCursor = chatInputView.textView.position(from: oldCursor.start, offset: -rmRange.length) { + selRange = chatInputView.textView.textRange(from: newCursor, to: newCursor) } } // 删除rmRange范围内的字符串("@xxx ") - let subRange = menuView.textView.text.utf16.index(menuView.textView.text.startIndex, offsetBy: rmRange.location) ... menuView.textView.text.utf16.index(menuView.textView.text.startIndex, offsetBy: rmRange.location + rmRange.length - 1) + let subRange = chatInputView.textView.text.utf16.index(chatInputView.textView.text.startIndex, offsetBy: rmRange.location) ... chatInputView.textView.text.utf16.index(chatInputView.textView.text.startIndex, offsetBy: rmRange.location + rmRange.length - 1) let key = "\(rmRange.location)_\(rmRange.length - 1)" - menuView.atRangeCache.removeValue(forKey: key) + chatInputView.atRangeCache.removeValue(forKey: key) - menuView.textView.text.removeSubrange(subRange) + chatInputView.textView.text.removeSubrange(subRange) // 重新设置光标到删除前的位置 - menuView.textView.selectedTextRange = selRange + chatInputView.textView.selectedTextRange = selRange } return false } @@ -851,6 +913,11 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel } } + open func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { + textView.typingAttributes = [NSAttributedString.Key.foregroundColor: UIColor.ne_darkText, NSAttributedString.Key.font: UIFont.systemFont(ofSize: 16)] + return true + } + open func willSelectItem(button: UIButton?, index: Int) { operationView?.removeFromSuperview() if button?.isSelected == true { @@ -865,12 +932,17 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel } else if index == 2 { // 相册 isFile = false - goPhotoAlbumWithVideo(self) + goPhotoAlbumWithVideo(self) { [weak self] in + if NIMSDK.shared().mediaManager.isPlaying() { + NIMSDK.shared().mediaManager.stopPlay() + self?.playingCell?.stopAnimation(byRight: self?.playingModel?.message?.isOutgoingMsg ?? true) + self?.playingModel?.isPlaying = false + } + } } else if index == 3 { // 更多 layoutInputView(offset: bottomExanpndHeight) scrollTableViewToBottom() - UIApplication.shared.keyWindow?.endEditing(true) } } else { layoutInputView(offset: 0) @@ -969,7 +1041,7 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel let imgSize_MB = Double(imgData.count) / 1e6 NELog.infoLog(ModuleName + " " + tag, desc: #function + "imgSize_MB: \(imgSize_MB) MB") if imgSize_MB > NEKitChatConfig.shared.ui.fileSizeLimit { - showToast(chatLocalizable("fileSize_over_limit").replacingOccurrences(of: "XXX", with: "\(NEKitChatConfig.shared.ui.fileSizeLimit)")) + showToast(String(format: chatLocalizable("fileSize_over_limit"), "\(NEKitChatConfig.shared.ui.fileSizeLimit)")) } else { viewmodel.sendFileMessage(data: imgData, displayName: imageName) { [weak self] error in NELog.infoLog( @@ -1031,7 +1103,7 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel if let size_B = fileAttributes[FileAttributeKey.size] as? Double { let size_MB = size_B / 1e6 if size_MB > NEKitChatConfig.shared.ui.fileSizeLimit { - showToast(chatLocalizable("fileSize_over_limit").replacingOccurrences(of: "XXX", with: "\(NEKitChatConfig.shared.ui.fileSizeLimit)")) + showToast(String(format: chatLocalizable("fileSize_over_limit"), "\(NEKitChatConfig.shared.ui.fileSizeLimit)")) try? FileManager.default.removeItem(atPath: desPath) } else { viewmodel.sendFileMessage(filePath: desPath, displayName: displayName) { [weak self] error in @@ -1096,6 +1168,7 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel } open func onRecvMessages(_ messages: [NIMMessage]) { + operationView?.removeFromSuperview() insertRows() if isCurrentPage, UIApplication.shared.applicationState == .active { @@ -1138,6 +1211,7 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel if atIndexs.isEmpty { return } + operationView?.removeFromSuperview() tableViewDeleteIndexs(atIndexs) DispatchQueue.main.asyncAfter(deadline: .now() + 0.25, execute: DispatchWorkItem(block: { [weak self] in self?.tableViewReloadIndexs(reloadIndex) @@ -1153,6 +1227,7 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel return } operationView?.removeFromSuperview() + NELog.infoLog(className(), desc: "on revoke message at indexs \(atIndexs)") tableViewReloadIndexs(atIndexs) } @@ -1200,8 +1275,10 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel } open func didRefreshTable() { + group.enter() DispatchQueue.main.async { [weak self] in self?.tableView.reloadData() + self?.group.leave() } } @@ -1243,8 +1320,8 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel opeView.removeFromSuperview() } else { - if menuView.textView.isFirstResponder { - menuView.textView.resignFirstResponder() + if chatInputView.textView.isFirstResponder { + chatInputView.textView.resignFirstResponder() } else { layoutInputView(offset: 0) } @@ -1334,6 +1411,8 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel open func playAudioInterruptionEnd() { print(#function) + playingCell?.stopAnimation(byRight: playingModel?.message?.isOutgoingMsg ?? true) + playingModel?.isPlaying = false } open func playAudioInterruptionBegin() { @@ -1350,7 +1429,7 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel open func recordAudio(_ filePath: String?, didCompletedWithError error: Error?) { print("[record] sdk Completed error:\(error)") - menuView.stopRecordAnimation() + chatInputView.stopRecordAnimation() guard let fp = filePath else { showToast(error?.localizedDescription ?? "") return @@ -1432,16 +1511,16 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel } open func addToAtUsers(addText: String, isReply: Bool = false, accid: String, _ isLongPress: Bool = false) { - if let font = menuView.textView.font { - let mutaString = NSMutableAttributedString(attributedString: menuView.textView.attributedText) + if let font = chatInputView.textView.font { + let mutaString = NSMutableAttributedString(attributedString: chatInputView.textView.attributedText) let atString = NSAttributedString(string: addText, attributes: [NSAttributedString.Key.foregroundColor: UIColor.ne_blueText, NSAttributedString.Key.font: font]) var selectRange = NSMakeRange(0, 0) var location = 0 - if menuView.textView.isFirstResponder == true { - location = menuView.textView.selectedRange.location - selectRange = menuView.textView.selectedRange + if chatInputView.textView.isFirstResponder == true { + location = chatInputView.textView.selectedRange.location + selectRange = chatInputView.textView.selectedRange } else { - location = menuView.textView.attributedText.length + location = chatInputView.textView.attributedText.length selectRange = NSMakeRange(location, 0) } @@ -1451,25 +1530,25 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel temMutaString.append(spaceStr) mutaString.insert(temMutaString, at: location) - menuView.nickAccidDic[addText] = accid.count > 0 ? accid : "ait_all" - menuView.textView.attributedText = mutaString - menuView.textView.selectedRange = NSMakeRange(selectRange.location + temMutaString.length, 0) + chatInputView.nickAccidDic[addText] = accid.count > 0 ? accid : "ait_all" + chatInputView.textView.attributedText = mutaString + chatInputView.textView.selectedRange = NSMakeRange(selectRange.location + temMutaString.length, 0) return } - if menuView.textView.selectedRange.location > 0 { - mutaString.replaceCharacters(in: NSMakeRange(menuView.textView.selectedRange.location - 1, 1), with: "") + if chatInputView.textView.selectedRange.location > 0 { + mutaString.replaceCharacters(in: NSMakeRange(chatInputView.textView.selectedRange.location - 1, 1), with: "") let temMutaString = NSMutableAttributedString(attributedString: atString) let spaceStr = NSAttributedString(string: " ", attributes: [NSAttributedString.Key.font: font]) temMutaString.append(spaceStr) - mutaString.insert(temMutaString, at: menuView.textView.selectedRange.location - 1) + mutaString.insert(temMutaString, at: chatInputView.textView.selectedRange.location - 1) selectRange = NSMakeRange(selectRange.location - 1, selectRange.length) } - menuView.nickAccidDic[addText] = accid.count > 0 ? accid : "ait_all" + chatInputView.nickAccidDic[addText] = accid.count > 0 ? accid : "ait_all" - menuView.textView.attributedText = mutaString - menuView.textView.selectedRange = NSMakeRange(selectRange.location + addText.count + atRangeOffset, 0) + chatInputView.textView.attributedText = mutaString + chatInputView.textView.selectedRange = NSMakeRange(selectRange.location + addText.count + atRangeOffset, 0) } } @@ -1503,6 +1582,11 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel // MARK: MessageOperationViewDelegate open func didSelectedItem(item: OperationItem) { + if let popMenuClick = NEKitChatConfig.shared.ui.popMenuClick { + popMenuClick(item) + return + } + switch item.type { case .copy: copyMessage() @@ -1537,7 +1621,7 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel } open func deleteMessage() { - showAlert(message: chatLocalizable("message_delete_comfirm")) { + showAlert(message: chatLocalizable("message_delete_confirm")) { if let message = self.viewmodel.operationModel?.message { self.viewmodel.deleteMessage(message: message) { error in if error != nil { @@ -1554,9 +1638,9 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel replyView.closeButton.addTarget(self, action: #selector(closeReply), for: .touchUpInside) replyView.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ - replyView.leadingAnchor.constraint(equalTo: menuView.leadingAnchor), - replyView.trailingAnchor.constraint(equalTo: menuView.trailingAnchor), - replyView.bottomAnchor.constraint(equalTo: menuView.topAnchor), + replyView.leadingAnchor.constraint(equalTo: chatInputView.leadingAnchor), + replyView.trailingAnchor.constraint(equalTo: chatInputView.trailingAnchor), + replyView.bottomAnchor.constraint(equalTo: chatInputView.topAnchor), replyView.heightAnchor.constraint(equalToConstant: 36), ]) if let message = viewmodel.operationModel?.message { @@ -1605,7 +1689,7 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel replyView.textLabel.attributedText = NEEmotionTool.getAttWithStr(str: text, font: replyView.textLabel.font, color: replyView.textLabel.textColor) - menuView.textView.becomeFirstResponder() + chatInputView.textView.becomeFirstResponder() } } } @@ -1617,7 +1701,7 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel open func recallMessage() { weak var weakSelf = self - showAlert(message: chatLocalizable("message_revoke_confim")) { + showAlert(message: chatLocalizable("message_revoke_confirm")) { if let message = weakSelf?.viewmodel.operationModel?.message { if let messageType = weakSelf?.viewmodel.operationModel?.message?.messageType, messageType == .text { weakSelf?.viewmodel.operationModel?.isRevokedText = true @@ -1625,6 +1709,7 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel // DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + .seconds(120)) { // weakSelf?.tableView.reloadData() // } + let isPin = weakSelf?.viewmodel.operationModel?.isPined ?? false weakSelf?.viewmodel.revokeMessage(message: message) { error in NELog.infoLog( ModuleName + " " + (weakSelf?.tag ?? ""), @@ -1641,6 +1726,10 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel } else { // 自己撤回成功 & 收到对方撤回 都会走回调方法 onRevokeMessage // 撤回成功的逻辑统一在代理方法中处理 onRevokeMessage + if isPin { + weakSelf?.viewmodel.removePinMessage(message) { error, pinItem, value in + } + } weakSelf?.viewmodel.saveRevokeMessage(message) { error in print("message id : ", message.messageId) if let err = error { @@ -1744,28 +1833,33 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel Router.shared.use( ContactTeamListRouter, - parameters: ["nav": weakSelf?.navigationController as Any], + parameters: ["nav": weakSelf?.navigationController as Any, + "isClickCallBack": true], closure: nil ) } open func forwardMessage() { if let message = viewmodel.operationModel?.message { - weak var weakSelf = self - let userAction = UIAlertAction(title: chatLocalizable("contact_user"), - style: .default) { action in - weakSelf?.forwardMessageToUser(message: message) - } + if IMKitClient.instance.getConfigCenter().teamEnable { + weak var weakSelf = self + let userAction = UIAlertAction(title: chatLocalizable("contact_user"), + style: .default) { action in + weakSelf?.forwardMessageToUser(message: message) + } - let teamAction = UIAlertAction(title: chatLocalizable("team"), style: .default) { action in - weakSelf?.forwardMessageToTeam(message: message) - } + let teamAction = UIAlertAction(title: chatLocalizable("team"), style: .default) { action in + weakSelf?.forwardMessageToTeam(message: message) + } - let cancelAction = UIAlertAction(title: chatLocalizable("cancel"), - style: .cancel) { action in - } + let cancelAction = UIAlertAction(title: chatLocalizable("cancel"), + style: .cancel) { action in + } - showActionSheet([teamAction, userAction, cancelAction]) + showActionSheet([teamAction, userAction, cancelAction]) + } else { + forwardMessageToUser(message: message) + } } } @@ -1845,14 +1939,14 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel } else { let key = "\(model.type.rawValue)" if model.type == .custom, let object = model.message?.messageObject as? NIMCustomObject, let custom = object.attachment as? NECustomAttachmentProtocol { - if registerCellDic["\(custom.customType)"] != nil { + if cellRegisterDic["\(custom.customType)"] != nil { reuseId = "\(custom.customType)" } else { reuseId = "\(NEBaseChatMessageCell.self)" } } else if model.type == .time || model.type == .notification || model.type == .tip { reuseId = "\(MessageType.time.rawValue)" - } else if registerCellDic[key] != nil { + } else if cellRegisterDic[key] != nil { reuseId = key } else { reuseId = "\(NEBaseChatMessageCell.self)" @@ -1903,8 +1997,8 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel open func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { operationView?.removeFromSuperview() - if menuView.textView.isFirstResponder { - menuView.textView.resignFirstResponder() + if chatInputView.textView.isFirstResponder { + chatInputView.textView.resignFirstResponder() } else { // layoutInputView(offset: 0) } @@ -2127,7 +2221,7 @@ open class ChatViewController: ChatBaseViewController, UINavigationControllerDel } open func expandMoreAction() { - menuView.chatAddMoreView.configData(data: NEChatUIKitClient.instance.getMoreActionData(sessionType: viewmodel.session.sessionType)) + chatInputView.chatAddMoreView.configData(data: NEChatUIKitClient.instance.getMoreActionData(sessionType: viewmodel.session.sessionType)) } } @@ -2157,6 +2251,11 @@ extension ChatViewController: ChatBaseCellDelegate { } open func didTapMessageView(_ cell: UITableViewCell, _ model: MessageContentModel?) { + if let tapClick = NEKitChatConfig.shared.ui.messageItemClick { + tapClick(cell, model) + return + } + if model?.isRevoked == true { return } @@ -2246,7 +2345,7 @@ extension ChatViewController: ChatBaseCellDelegate { if text.last == " " { text = String(text.prefix(text.count - 1)) } - menuView.nickAccidDic[text] = key + chatInputView.nickAccidDic[text] = key } if attributeStr.length > model.end { @@ -2258,8 +2357,8 @@ extension ChatViewController: ChatBaseCellDelegate { } } } - menuView.textView.attributedText = attributeStr - menuView.textView.becomeFirstResponder() + chatInputView.textView.attributedText = attributeStr + chatInputView.textView.becomeFirstResponder() } } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBasePinMessageViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBasePinMessageViewController.swift index 906c9628..a0e29241 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBasePinMessageViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBasePinMessageViewController.swift @@ -71,8 +71,8 @@ open class NEBasePinMessageViewController: ChatBaseViewController, UITableViewDa func setupUI() { title = chatLocalizable("operation_pin") - customNavigationView.navTitle.text = chatLocalizable("operation_pin") - customNavigationView.moreButton.isHidden = true + navigationView.navTitle.text = chatLocalizable("operation_pin") + navigationView.moreButton.isHidden = true view.addSubview(tableView) NSLayoutConstraint.activate([ tableView.topAnchor.constraint(equalTo: view.topAnchor, constant: NEConstant.navigationAndStatusHeight), @@ -298,27 +298,32 @@ open class NEBasePinMessageViewController: ChatBaseViewController, UITableViewDa Router.shared.use( ContactTeamListRouter, - parameters: ["nav": weakSelf?.navigationController as Any], + parameters: ["nav": weakSelf?.navigationController as Any, + "isClickCallBack": true], closure: nil ) } open func forwardMessage(_ message: NIMMessage) { - weak var weakSelf = self - let userAction = UIAlertAction(title: chatLocalizable("contact_user"), - style: .default) { action in - weakSelf?.forwardMessageToUser(message) - } + if IMKitClient.instance.getConfigCenter().teamEnable { + weak var weakSelf = self + let userAction = UIAlertAction(title: chatLocalizable("contact_user"), + style: .default) { action in + weakSelf?.forwardMessageToUser(message) + } - let teamAction = UIAlertAction(title: chatLocalizable("team"), style: .default) { action in - weakSelf?.forwardMessageToTeam(message) - } + let teamAction = UIAlertAction(title: chatLocalizable("team"), style: .default) { action in + weakSelf?.forwardMessageToTeam(message) + } - let cancelAction = UIAlertAction(title: chatLocalizable("cancel"), - style: .cancel) { action in - } + let cancelAction = UIAlertAction(title: chatLocalizable("cancel"), + style: .cancel) { action in + } - showActionSheet([teamAction, userAction, cancelAction]) + showActionSheet([teamAction, userAction, cancelAction]) + } else { + forwardMessageToUser(message) + } } // MARK: PinMessageViewModelDelegate diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBaseReadViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBaseReadViewController.swift index 3b9a53df..ad90af47 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBaseReadViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBaseReadViewController.swift @@ -37,7 +37,7 @@ open class NEBaseReadViewController: ChatBaseViewController, UIScrollViewDelegat open func commonUI() { title = chatLocalizable("message_read") - customNavigationView.moreButton.isHidden = true + navigationView.moreButton.isHidden = true readButton.titleLabel?.font = UIFont.systemFont(ofSize: 14) readButton.setTitle(chatLocalizable("read"), for: .normal) diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBaseSelectUserViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBaseSelectUserViewController.swift index 2fcbf0ff..e382e6f3 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBaseSelectUserViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBaseSelectUserViewController.swift @@ -32,7 +32,7 @@ open class NEBaseSelectUserViewController: ChatBaseViewController, UITableViewDe override public func viewDidLoad() { super.viewDidLoad() navigationController?.isNavigationBarHidden = true - customNavigationView.isHidden = true + navigationView.isHidden = true commonUI() loadData() } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBaseUserSettingViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBaseUserSettingViewController.swift index e12b0df9..e702da51 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBaseUserSettingViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/NEBaseUserSettingViewController.swift @@ -10,7 +10,7 @@ import UIKit @objcMembers open class NEBaseUserSettingViewController: ChatBaseViewController, UserSettingViewModelDelegate, UITableViewDataSource, UITableViewDelegate { - var userId: String? + public var userId: String? let viewmodel = UserSettingViewModel() @@ -61,6 +61,15 @@ open class NEBaseUserSettingViewController: ChatBaseViewController, UserSettingV public var cellClassDic = [Int: NEBaseUserSettingCell.Type]() + public init(userId: String) { + super.init(nibName: nil, bundle: nil) + self.userId = userId + } + + public required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + override public func viewDidLoad() { super.viewDidLoad() viewmodel.delegate = self @@ -73,9 +82,11 @@ open class NEBaseUserSettingViewController: ChatBaseViewController, UserSettingV } func setupUI() { - view.backgroundColor = .ne_backcolor + view.backgroundColor = .ne_lightBackgroundColor title = chatLocalizable("chat_setting") - customNavigationView.moreButton.isHidden = true + navigationView.moreButton.isHidden = true + navigationView.backgroundColor = .ne_lightBackgroundColor + view.addSubview(contentTable) NSLayoutConstraint.activate([ contentTable.leftAnchor.constraint(equalTo: view.leftAnchor), @@ -108,12 +119,6 @@ open class NEBaseUserSettingViewController: ChatBaseViewController, UserSettingV ]) cornerBack.addSubview(userHeader) - NSLayoutConstraint.activate([ - userHeader.leftAnchor.constraint(equalTo: cornerBack.leftAnchor, constant: 16), - userHeader.topAnchor.constraint(equalTo: cornerBack.topAnchor, constant: 12), - userHeader.widthAnchor.constraint(equalToConstant: 42), - userHeader.heightAnchor.constraint(equalToConstant: 42), - ]) let tap = UITapGestureRecognizer() userHeader.addGestureRecognizer(tap) tap.numberOfTapsRequired = 1 @@ -129,22 +134,48 @@ open class NEBaseUserSettingViewController: ChatBaseViewController, UserSettingV userHeader.backgroundColor = UIColor.colorWithString(string: viewmodel.userInfo?.userId) } - cornerBack.addSubview(addBtn) - NSLayoutConstraint.activate([ - addBtn.leftAnchor.constraint(equalTo: userHeader.rightAnchor, constant: 20.0), - addBtn.topAnchor.constraint(equalTo: userHeader.topAnchor), - addBtn.widthAnchor.constraint(equalToConstant: 42.0), - addBtn.heightAnchor.constraint(equalToConstant: 42.0), - ]) - addBtn.addTarget(self, action: #selector(createDiscuss), for: .touchUpInside) - - cornerBack.addSubview(nameLabel) - NSLayoutConstraint.activate([ - nameLabel.leftAnchor.constraint(equalTo: userHeader.leftAnchor, constant: -12.0), - nameLabel.rightAnchor.constraint(equalTo: userHeader.rightAnchor, constant: 12.0), - nameLabel.topAnchor.constraint(equalTo: userHeader.bottomAnchor, constant: 6.0), - ]) nameLabel.text = viewmodel.userInfo?.showName() + cornerBack.addSubview(nameLabel) + if IMKitClient.instance.getConfigCenter().teamEnable { + NSLayoutConstraint.activate([ + userHeader.leftAnchor.constraint(equalTo: cornerBack.leftAnchor, constant: 16), + userHeader.topAnchor.constraint(equalTo: cornerBack.topAnchor, constant: 12), + userHeader.widthAnchor.constraint(equalToConstant: 42), + userHeader.heightAnchor.constraint(equalToConstant: 42), + ]) + + nameLabel.font = NEConstant.defaultTextFont(12) + nameLabel.textAlignment = .center + NSLayoutConstraint.activate([ + nameLabel.leftAnchor.constraint(equalTo: userHeader.leftAnchor, constant: -12.0), + nameLabel.rightAnchor.constraint(equalTo: userHeader.rightAnchor, constant: 12.0), + nameLabel.topAnchor.constraint(equalTo: userHeader.bottomAnchor, constant: 6.0), + ]) + + cornerBack.addSubview(addBtn) + addBtn.addTarget(self, action: #selector(createDiscuss), for: .touchUpInside) + NSLayoutConstraint.activate([ + addBtn.leftAnchor.constraint(equalTo: userHeader.rightAnchor, constant: 20.0), + addBtn.topAnchor.constraint(equalTo: userHeader.topAnchor), + addBtn.widthAnchor.constraint(equalToConstant: 42.0), + addBtn.heightAnchor.constraint(equalToConstant: 42.0), + ]) + } else { + NSLayoutConstraint.activate([ + userHeader.leftAnchor.constraint(equalTo: cornerBack.leftAnchor, constant: 16), + userHeader.centerYAnchor.constraint(equalTo: cornerBack.centerYAnchor), + userHeader.widthAnchor.constraint(equalToConstant: 60), + userHeader.heightAnchor.constraint(equalToConstant: 60), + ]) + + nameLabel.font = NEConstant.defaultTextFont(16) + nameLabel.textAlignment = .left + NSLayoutConstraint.activate([ + nameLabel.leftAnchor.constraint(equalTo: userHeader.rightAnchor, constant: 16.0), + nameLabel.rightAnchor.constraint(equalTo: cornerBack.rightAnchor), + nameLabel.centerYAnchor.constraint(equalTo: userHeader.centerYAnchor), + ]) + } return header } @@ -238,22 +269,14 @@ open class NEBaseUserSettingViewController: ChatBaseViewController, UserSettingV viewmodel.cellDatas.count } - public func tableView(_ tableView: UITableView, - cellForRowAt indexPath: IndexPath) -> UITableViewCell { + open func tableView(_ tableView: UITableView, + cellForRowAt indexPath: IndexPath) -> UITableViewCell { let model = viewmodel.cellDatas[indexPath.row] if let cell = tableView.dequeueReusableCell( withIdentifier: "\(model.type)", for: indexPath ) as? NEBaseUserSettingCell { cell.configure(model) - if let c = cell as? UserSettingSwitchCell { - if model.cellName == chatLocalizable("message_remind") { - c.tSwitch.accessibilityIdentifier = "id.messageRemind" - } - if model.cellName == chatLocalizable("session_set_top") { - c.tSwitch.accessibilityIdentifier = "id.stickTop" - } - } return cell } return UITableViewCell() diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/TextViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/TextViewController.swift index c7a2847c..ec9fe42f 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/TextViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/Controller/TextViewController.swift @@ -3,6 +3,7 @@ // found in the LICENSE file. import Foundation +import NECommonKit @objcMembers open class TextViewController: ChatBaseViewController { @@ -47,7 +48,7 @@ open class TextViewController: ChatBaseViewController { override open func viewDidLoad() { super.viewDidLoad() navigationController?.isNavigationBarHidden = true - customNavigationView.isHidden = true + navigationView.isHidden = true let tap = UITapGestureRecognizer(target: self, action: #selector(viewTap)) scrollView.addGestureRecognizer(tap) setupUI() diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/Emoji/InputEmoticonContainerView.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/Emoji/InputEmoticonContainerView.swift index f01e5fd8..40ab4145 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/Emoji/InputEmoticonContainerView.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/Emoji/InputEmoticonContainerView.swift @@ -210,7 +210,6 @@ extension InputEmoticonContainerView { catalogID: id, delegate: self ) - button.accessibilityIdentifier = "id.emoji" rowIndex = indexInPage / layout.columes coloumnIndex = indexInPage % layout.columes let x = coloumnIndex * Int(layout.cellWidth) + startX diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/Emoji/InputEmoticonTabView.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/Emoji/InputEmoticonTabView.swift index f0b9f103..042dad9e 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/Emoji/InputEmoticonTabView.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/Emoji/InputEmoticonTabView.swift @@ -82,11 +82,10 @@ public class InputEmoticonTabView: UIControl { public lazy var sendButton: UIButton = { let button = UIButton() button.translatesAutoresizingMaskIntoConstraints = false - button.setTitle(chatLocalizable("send"), for: .normal) + button.setTitle(coreLoader.localizable("send"), for: .normal) button.titleLabel?.textColor = .white button.backgroundColor = UIColor.ne_blueText button.titleLabel?.font = DefaultTextFont(14) - button.accessibilityIdentifier = "id.emojiSend" return button }() } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/Emoji/NEEmotionTool.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/Emoji/NEEmotionTool.swift index 85759717..dfb54c64 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/Emoji/NEEmotionTool.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/Emoji/NEEmotionTool.swift @@ -25,7 +25,7 @@ public class NEEmotionTool: NSObject { .emoticonCatalog(catalogID: NIMKit_EmojiCatalog)?.emoticons let attStr = NSMutableAttributedString(string: str, attributes: [ NSAttributedString.Key.font: font, - .foregroundColor: NEKitChatConfig.shared.ui.messageTextColor, + .foregroundColor: NEKitChatConfig.shared.ui.messageProperties.messageTextColor, ]) if let regArr = regularArr, regArr.count > 0, let targetEmotions = emoticons { diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/Helper/NotificationMessageUtils.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/Helper/NotificationMessageUtils.swift index 68a95e32..e526ea8a 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/Helper/NotificationMessageUtils.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/Helper/NotificationMessageUtils.swift @@ -4,6 +4,7 @@ // found in the LICENSE file. import Foundation +import NEChatKit import NECoreIMKit import NECoreKit import NIMSDK @@ -217,8 +218,8 @@ public class NotificationMessageUtils: NSObject { } public class func teamType(message: NIMMessage) -> TeamType { - let team = TeamProvider.shared.teamInfo(teamId: message.session?.sessionId) - if team?.type == .normalTeam || (team?.type == .advancedTeam && team?.nimTeam?.clientCustomInfo?.contains(discussTeamKey) == true) { + let team = TeamProvider.shared.getTeam(teamId: message.session?.sessionId ?? "") + if team?.isDisscuss() == true { return .discussTeam } else { return .advanceTeam diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/Model/MessageCallRecordModel.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/Model/MessageCallRecordModel.swift index 05d24c96..79800eab 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/Model/MessageCallRecordModel.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/Model/MessageCallRecordModel.swift @@ -3,6 +3,7 @@ // Use of this source code is governed by a MIT license that can be // found in the LICENSE file. +import NECommonKit import NIMSDK import UIKit @@ -56,12 +57,12 @@ class MessageCallRecordModel: MessageContentModel { attributeStr?.insert(NSAttributedString(attachment: attachment), at: 0) } - attributeStr?.addAttribute(NSAttributedString.Key.font, value: NEKitChatConfig.shared.ui.messageTextSize, range: NSMakeRange(0, attributeStr?.length ?? 0)) + attributeStr?.addAttribute(NSAttributedString.Key.font, value: UIFont.systemFont(ofSize: NEKitChatConfig.shared.ui.messageProperties.messageTextSize), range: NSMakeRange(0, attributeStr?.length ?? 0)) - attributeStr?.addAttribute(NSAttributedString.Key.foregroundColor, value: NEKitChatConfig.shared.ui.messageTextColor, range: NSMakeRange(0, attributeStr?.length ?? 0)) + attributeStr?.addAttribute(NSAttributedString.Key.foregroundColor, value: NEKitChatConfig.shared.ui.messageProperties.messageTextColor, range: NSMakeRange(0, attributeStr?.length ?? 0)) } - let textSize = attributeStr?.finalSize(NEKitChatConfig.shared.ui.messageTextSize, CGSize(width: chat_content_maxW, height: CGFloat.greatestFiniteMagnitude)) ?? .zero + let textSize = attributeStr?.finalSize(.systemFont(ofSize: NEKitChatConfig.shared.ui.messageProperties.messageTextSize), CGSize(width: chat_content_maxW, height: CGFloat.greatestFiniteMagnitude)) ?? .zero var h = chat_min_h h = textSize.height + (isAuiodRecord ? 20 : 24) diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/Model/MessageTextModel.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/Model/MessageTextModel.swift index b0afadef..14b6776d 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/Model/MessageTextModel.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/Model/MessageTextModel.swift @@ -4,6 +4,7 @@ // found in the LICENSE file. import Foundation +import NECommonKit import NIMSDK @objcMembers @@ -17,7 +18,7 @@ class MessageTextModel: MessageContentModel { attributeStr = NEEmotionTool.getAttWithStr( str: message?.text ?? "", - font: NEKitChatConfig.shared.ui.messageTextSize + font: UIFont.systemFont(ofSize: NEKitChatConfig.shared.ui.messageProperties.messageTextSize) ) if let remoteExt = message?.remoteExt, let dic = remoteExt[yxAtMsg] as? [String: AnyObject] { @@ -36,7 +37,7 @@ class MessageTextModel: MessageContentModel { } } - let textSize = attributeStr?.finalSize(NEKitChatConfig.shared.ui.messageTextSize, CGSize(width: chat_text_maxW, height: CGFloat.greatestFiniteMagnitude)) ?? .zero + let textSize = attributeStr?.finalSize(.systemFont(ofSize: NEKitChatConfig.shared.ui.messageProperties.messageTextSize), CGSize(width: chat_text_maxW, height: CGFloat.greatestFiniteMagnitude)) ?? .zero textHeight = textSize.height contentSize = CGSize(width: textSize.width + chat_content_margin * 2, height: textHeight + chat_content_margin * 2) diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/Model/MessageTipsModel.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/Model/MessageTipsModel.swift index 98a36570..641d7163 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/Model/MessageTipsModel.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/Model/MessageTipsModel.swift @@ -51,7 +51,7 @@ class MessageTipsModel: NSObject, MessageModel { tipTimeStamp = msg.timestamp } - var font: UIFont = .systemFont(ofSize: NEKitChatConfig.shared.ui.timeTextSize) + var font: UIFont = .systemFont(ofSize: NEKitChatConfig.shared.ui.messageProperties.timeTextSize) contentSize = String.getTextRectSize(text ?? "", font: font, diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/NEBaseChatMessageCell.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/NEBaseChatMessageCell.swift index afb25678..2fb2393f 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/NEBaseChatMessageCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/NEBaseChatMessageCell.swift @@ -108,13 +108,13 @@ open class NEBaseChatMessageCell: NEChatBaseCell { // name nameLabelLeft.textAlignment = .center nameLabelLeft.translatesAutoresizingMaskIntoConstraints = false - nameLabelLeft.font = UIFont.systemFont(ofSize: NEKitChatConfig.shared.ui.userNickTextSize) - nameLabelLeft.textColor = NEKitChatConfig.shared.ui.userNickColor + nameLabelLeft.font = UIFont.systemFont(ofSize: NEKitChatConfig.shared.ui.messageProperties.userNickTextSize) + nameLabelLeft.textColor = NEKitChatConfig.shared.ui.messageProperties.userNickColor nameLabelRight.textAlignment = .center nameLabelRight.translatesAutoresizingMaskIntoConstraints = false - nameLabelRight.font = UIFont.systemFont(ofSize: NEKitChatConfig.shared.ui.userNickTextSize) - nameLabelRight.textColor = NEKitChatConfig.shared.ui.userNickColor + nameLabelRight.font = UIFont.systemFont(ofSize: NEKitChatConfig.shared.ui.messageProperties.userNickTextSize) + nameLabelRight.textColor = NEKitChatConfig.shared.ui.messageProperties.userNickColor // fullName fullNameLabel.translatesAutoresizingMaskIntoConstraints = false @@ -123,15 +123,15 @@ open class NEBaseChatMessageCell: NEChatBaseCell { fullNameLabel.accessibilityIdentifier = "id.fullNameLabel" // bubbleImage - bubbleImageLeft.backgroundColor = NEKitChatConfig.shared.ui.receiveMessageBg - var image = NEKitChatConfig.shared.ui.leftBubbleBg ?? UIImage.ne_imageNamed(name: "chat_message_receive") + bubbleImageLeft.backgroundColor = NEKitChatConfig.shared.ui.messageProperties.receiveMessageBg + var image = NEKitChatConfig.shared.ui.messageProperties.leftBubbleBg ?? UIImage.ne_imageNamed(name: "chat_message_receive") bubbleImageLeft.image = image? .resizableImage(withCapInsets: UIEdgeInsets(top: 35, left: 25, bottom: 10, right: 25)) bubbleImageLeft.translatesAutoresizingMaskIntoConstraints = false bubbleImageLeft.isUserInteractionEnabled = true - bubbleImageRight.backgroundColor = NEKitChatConfig.shared.ui.selfMessageBg - image = NEKitChatConfig.shared.ui.rightBubbleBg ?? UIImage.ne_imageNamed(name: "chat_message_send") + bubbleImageRight.backgroundColor = NEKitChatConfig.shared.ui.messageProperties.selfMessageBg + image = NEKitChatConfig.shared.ui.messageProperties.rightBubbleBg ?? UIImage.ne_imageNamed(name: "chat_message_send") bubbleImageRight.image = image? .resizableImage(withCapInsets: UIEdgeInsets(top: 35, left: 25, bottom: 10, right: 25)) bubbleImageRight.translatesAutoresizingMaskIntoConstraints = false @@ -332,11 +332,11 @@ open class NEBaseChatMessageCell: NEChatBaseCell { } open func initSubviewsLayout() { - if NEKitChatConfig.shared.ui.avatarType == .rectangle, - let radius = NEKitChatConfig.shared.ui.avatarCornerRadius { - avatarImageRight.layer.cornerRadius = radius - avatarImageLeft.layer.cornerRadius = radius - } else if NEKitChatConfig.shared.ui.avatarType == .cycle { + if NEKitChatConfig.shared.ui.messageProperties.avatarType == .rectangle, + NEKitChatConfig.shared.ui.messageProperties.avatarCornerRadius > 0 { + avatarImageRight.layer.cornerRadius = NEKitChatConfig.shared.ui.messageProperties.avatarCornerRadius + avatarImageLeft.layer.cornerRadius = NEKitChatConfig.shared.ui.messageProperties.avatarCornerRadius + } else if NEKitChatConfig.shared.ui.messageProperties.avatarType == .cycle { avatarImageRight.layer.cornerRadius = 16.0 avatarImageLeft.layer.cornerRadius = 16.0 } else { @@ -464,8 +464,8 @@ open class NEBaseChatMessageCell: NEChatBaseCell { if model.message?.session?.sessionType == .P2P { let receiptEnable = model.message?.setting?.teamReceiptEnabled ?? false if receiptEnable, - IMKitClient.instance.repo.getShowReadStatus(), - NEKitChatConfig.shared.ui.showP2pMessageStatus == true { + IMKitClient.instance.getSettingRepo().getShowReadStatus(), + NEKitChatConfig.shared.ui.messageProperties.showP2pMessageStatus == true { readView.isHidden = false if let read = model.message?.isRemoteRead, read { readView.progress = 1 @@ -486,8 +486,8 @@ open class NEBaseChatMessageCell: NEChatBaseCell { } else if model.message?.session?.sessionType == .team { let receiptEnable = model.message?.setting?.teamReceiptEnabled ?? false if receiptEnable, - IMKitClient.instance.repo.getShowReadStatus(), - NEKitChatConfig.shared.ui.showTeamMessageStatus == true { + IMKitClient.instance.getSettingRepo().getShowReadStatus(), + NEKitChatConfig.shared.ui.messageProperties.showTeamMessageStatus == true { readView.isHidden = false let readCount = model.message?.teamReceiptInfo?.readCount ?? 0 let unreadCount = model.message?.teamReceiptInfo?.unreadCount ?? 0 @@ -546,7 +546,7 @@ open class NEBaseChatMessageCell: NEChatBaseCell { pinLabel.isHidden = !model.isPined pinImage.isHidden = !model.isPined contentView.backgroundColor = model.isPined ? NEKitChatConfig.shared.ui - .signalBgColor : .clear + .messageProperties.signalBgColor : .clear if model.isPined { let pinText = model.message?.session?.sessionType == .P2P ? chatLocalizable("pin_text_P2P") : chatLocalizable("pin_text_team") if model.pinAccount == nil { diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/NEBaseChatMessageTipCell.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/NEBaseChatMessageTipCell.swift index dec78f77..9ce2e8a9 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/NEBaseChatMessageTipCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/NEBaseChatMessageTipCell.swift @@ -38,8 +38,8 @@ open class NEBaseChatMessageTipCell: UITableViewCell { public lazy var timeLabel: UILabel = { let label = UILabel() - label.font = .systemFont(ofSize: NEKitChatConfig.shared.ui.timeTextSize) - label.textColor = NEKitChatConfig.shared.ui.timeTextColor + label.font = .systemFont(ofSize: NEKitChatConfig.shared.ui.messageProperties.timeTextSize) + label.textColor = NEKitChatConfig.shared.ui.messageProperties.timeTextColor label.textAlignment = .center label.translatesAutoresizingMaskIntoConstraints = false label.accessibilityIdentifier = "id.messageTipText" diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/NEBaseUserSettingSwitchCell.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/NEBaseUserSettingSwitchCell.swift index 3483d3c0..3058f94a 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/NEBaseUserSettingSwitchCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/NEBaseUserSettingSwitchCell.swift @@ -11,6 +11,7 @@ open class NEBaseUserSettingSwitchCell: NEBaseUserSettingCell { let q = UISwitch() q.translatesAutoresizingMaskIntoConstraints = false q.onTintColor = NEConstant.hexRGB(0x337EFF) + q.accessibilityIdentifier = "id.tSwitch" return q }() diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageAudioCell.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageAudioCell.swift index 29207e25..b33504d0 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageAudioCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/Cell/PinCell/NEBasePinMessageAudioCell.swift @@ -21,7 +21,7 @@ open class NEBasePinMessageAudioCell: NEBasePinMessageCell { override open func setupUI() { super.setupUI() - let image = NEKitChatConfig.shared.ui.leftBubbleBg ?? UIImage.ne_imageNamed(name: "chat_message_receive") + let image = NEKitChatConfig.shared.ui.messageProperties.leftBubbleBg ?? UIImage.ne_imageNamed(name: "chat_message_receive") bubbleImage.image = image? .resizableImage(withCapInsets: UIEdgeInsets(top: 35, left: 25, bottom: 10, right: 25)) bubbleImage.translatesAutoresizingMaskIntoConstraints = false diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/MessageOperationView.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/MessageOperationView.swift index 777b826c..03f74cdf 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/MessageOperationView.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/MessageOperationView.swift @@ -32,16 +32,11 @@ public class MessageOperationView: UIView, UICollectionViewDataSource, UICollect super.init(frame: frame) backgroundColor = .white -// self.layer.cornerRadius = 8 -// self.layer.shadowRadius = 4 -// self.layer.shadowColor = UIColor.black.cgColor -// self.layer.shadowOffset = CGSize(width: 4.0, height: 4.0) -// -// collcetionView.layer.shadowRadius = 4 -// collcetionView.layer.shadowColor = UIColor.black.cgColor -// collcetionView.layer.shadowOffset = CGSize(width: 4.0, height: 4.0) -// collcetionView.layer.shadowOpacity = 0.8 -// + layer.cornerRadius = 8 + layer.shadowOffset = CGSize(width: 0, height: 4) + layer.shadowColor = UIColor.ne_operationBorderColor.cgColor + layer.shadowOpacity = 0.25 + layer.shadowRadius = 8 collcetionView.dataSource = self collcetionView.delegate = self diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/NEBaseChatInputView.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/NEBaseChatInputView.swift index 8da473d8..bd6ce8e3 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/NEBaseChatInputView.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/View/ChatView/NEBaseChatInputView.swift @@ -95,6 +95,7 @@ open class NEBaseChatInputView: UIView, ChatRecordViewDelegate, public func addMoreActionView() { currentType = .addMore + textView.resignFirstResponder() contentSubView?.isHidden = true contentSubView = chatAddMoreView contentSubView?.isHidden = false @@ -270,7 +271,7 @@ open class NEBaseChatInputView: UIView, ChatRecordViewDelegate, delegate?.willSelectItem(button: button, index: button.tag - 5) } - // MARK: InputEmoticonContainerViewDelegate + // MARK: NIMInputEmoticonContainerViewDelegate public func selectedEmoticon(emoticonID: String, emotCatalogID: String, description: String) { if emoticonID.isEmpty { // 删除键 diff --git a/NEChatUIKit/NEChatUIKit/Classes/Chat/ViewModel/ChatViewModel.swift b/NEChatUIKit/NEChatUIKit/Classes/Chat/ViewModel/ChatViewModel.swift index 2c5f68b1..d6616f66 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Chat/ViewModel/ChatViewModel.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Chat/ViewModel/ChatViewModel.swift @@ -1217,19 +1217,16 @@ public class ChatViewModel: NSObject, ChatRepoMessageDelegate, NIMChatManagerDel return model } - private func getUserInfo(_ userId: String, _ completion: @escaping (User?, NSError?) -> Void) { + public func getUserInfo(_ userId: String, _ completion: @escaping (User?, NSError?) -> Void) { NELog.infoLog(ModuleName + " " + className, desc: #function + ", userId: " + userId) - if let user = userInfo[userId] { - completion(user, nil) - } - if let user = repo.getUserInfo(userId: userId) { - userInfo[userId] = user + if let user = newUserInfoDic[userId] { completion(user, nil) + return } UserInfoProvider.shared.fetchUserInfo([userId]) { [weak self] error, users in if let user = users?.first { - self?.userInfo[userId] = user + self?.newUserInfoDic[userId] = user completion(user, nil) } else { completion(nil, error) diff --git a/NEChatUIKit/NEChatUIKit/Classes/ChatConfig/ChatUIConfig.swift b/NEChatUIKit/NEChatUIKit/Classes/ChatConfig/ChatUIConfig.swift index 830e8098..ba722371 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/ChatConfig/ChatUIConfig.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/ChatConfig/ChatUIConfig.swift @@ -14,10 +14,38 @@ import UIKit @objcMembers public class ChatUIConfig: NSObject { - /// UI 元素自定义 + /// 消息页面的 UI 个性化定制 + public var messageItemClick: ((UITableViewCell, MessageContentModel?) -> Void)? + /// 消息页面的 UI 个性化定制 + public var messageProperties = MessageProperties() + + /// 文本输入框下方 tab 按钮定制 + public var chatInputBar: ((inout [UIButton]) -> Void)? + + /// 【更多】区域功能列表 + public var chatInputMenu: ((inout [NEMoreItemModel]) -> Void)? + + /// 消息长按弹出菜单回调, 回调中会返回长按弹出菜单列表 + public var chatPopMenu: ((inout [OperationItem], MessageContentModel?) -> Void)? + + /// 消息长按弹出菜单点击事件回调 + public var popMenuClick: ((OperationItem) -> Void)? + + /// 消息列表的视图控制器回调,回调中会返回消息列表的视图控制器 + public var customController: ((ChatViewController) -> Void)? + + /// 用户可自定义参数 + + // 发送文件大小限制(单位:MB) + public var fileSizeLimit: Double = 200 +} + +/// 消息页面的 UI 个性化定制 +@objcMembers +public class MessageProperties: NSObject { // 头像圆角大小 - public var avatarCornerRadius: CGFloat? + public var avatarCornerRadius: CGFloat = 0 // 头像类型 public var avatarType: NEChatAvatarType? @@ -38,7 +66,7 @@ public class ChatUIConfig: NSObject { public var leftBubbleBg: UIImage? // 聊天字体大小(文本类型) - public var messageTextSize = UIFont.systemFont(ofSize: 16) + public var messageTextSize: CGFloat = 16 // 聊天字体颜色(文本类型) public var messageTextColor = UIColor.ne_darkText @@ -69,9 +97,4 @@ public class ChatUIConfig: NSObject { public var titleBarRightClick: (() -> Void)? // 设置会话界面背景色 public var chatViewBackground: UIColor? - - /// 用户可自定义参数 - - // 发送文件大小限制(单位:MB) - public var fileSizeLimit: Double = 200 } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Common/NEChatUIKitClient.swift b/NEChatUIKit/NEChatUIKit/Classes/Common/NEChatUIKitClient.swift index 8ae7b4a4..16a7ce23 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Common/NEChatUIKitClient.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Common/NEChatUIKitClient.swift @@ -52,6 +52,11 @@ public class NEChatUIKitClient: NSObject { more.append(model) } } + + if let chatInputMenu = NEKitChatConfig.shared.ui.chatInputMenu { + chatInputMenu(&more) + } + return more } diff --git a/NEChatUIKit/NEChatUIKit/Classes/Common/NEChatUITool.swift b/NEChatUIKit/NEChatUIKit/Classes/Common/NEChatUITool.swift deleted file mode 100644 index 44385449..00000000 --- a/NEChatUIKit/NEChatUIKit/Classes/Common/NEChatUITool.swift +++ /dev/null @@ -1,26 +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 Foundation - -@objcMembers -public class NEChatUITool { - // 计算富文本size - class func getSizeWithAtt(att: NSAttributedString, font: UIFont, maxSize: CGSize) -> CGSize { - if att.length == 0 { - return CGSize.zero - } - var size = att.boundingRect( - with: maxSize, - options: [.usesLineFragmentOrigin, .usesFontLeading], - context: nil - ).size - - if att.length > 0, size.width == 0, size.height == 0 { - size = maxSize - } - return CGSize(width: ceil(size.width), height: ceil(size.height)) - } -} diff --git a/NEChatUIKit/NEChatUIKit/Classes/Extension/ChatStringExtension.swift b/NEChatUIKit/NEChatUIKit/Classes/Extension/ChatStringExtension.swift index 20889428..fe86ebc8 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/Extension/ChatStringExtension.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/Extension/ChatStringExtension.swift @@ -80,23 +80,3 @@ extension String { return format.date(from: "\(year)-01-01") } } - -extension String { - // 利用 sizeThatFits 计算 UIlabel 纯文本大小 - func finalSize(_ font: UIFont, _ size: CGSize, _ lines: Int = 0) -> CGSize { - tempLabelForCalc.numberOfLines = lines - tempLabelForCalc.font = font - tempLabelForCalc.text = self - return tempLabelForCalc.sizeThatFits(size) - } -} - -extension NSAttributedString { - // 利用 sizeThatFits 计算 UIlabel 富文本大小 - func finalSize(_ font: UIFont, _ size: CGSize, _ lines: Int = 0) -> CGSize { - tempLabelForCalc.numberOfLines = lines - tempLabelForCalc.font = font - tempLabelForCalc.attributedText = self - return tempLabelForCalc.sizeThatFits(size) - } -} diff --git a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/FunChatMessageBaseCell.swift b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/FunChatMessageBaseCell.swift index 76e5ca33..06eeacb3 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/FunChatMessageBaseCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/FunChatMessageBaseCell.swift @@ -12,11 +12,11 @@ open class FunChatMessageBaseCell: NEBaseChatMessageCell { readView.borderLayer.strokeColor = UIColor.funChatThemeColor.cgColor readView.sectorLayer.fillColor = UIColor.funChatThemeColor.cgColor - var image = NEKitChatConfig.shared.ui.leftBubbleBg ?? UIImage.ne_imageNamed(name: "chat_message_receive_fun") + var image = NEKitChatConfig.shared.ui.messageProperties.leftBubbleBg ?? UIImage.ne_imageNamed(name: "chat_message_receive_fun") bubbleImageLeft.image = image? .resizableImage(withCapInsets: UIEdgeInsets(top: 35, left: 25, bottom: 10, right: 25)) - image = NEKitChatConfig.shared.ui.rightBubbleBg ?? UIImage.ne_imageNamed(name: "chat_message_send_fun") + image = NEKitChatConfig.shared.ui.messageProperties.rightBubbleBg ?? UIImage.ne_imageNamed(name: "chat_message_send_fun") bubbleImageRight.image = image? .resizableImage(withCapInsets: UIEdgeInsets(top: 35, left: 25, bottom: 10, right: 25)) } @@ -31,11 +31,11 @@ open class FunChatMessageBaseCell: NEBaseChatMessageCell { } override open func initSubviewsLayout() { - if NEKitChatConfig.shared.ui.avatarType == .rectangle, - let radius = NEKitChatConfig.shared.ui.avatarCornerRadius { - avatarImageRight.layer.cornerRadius = radius - avatarImageLeft.layer.cornerRadius = radius - } else if NEKitChatConfig.shared.ui.avatarType == .cycle { + if NEKitChatConfig.shared.ui.messageProperties.avatarType == .rectangle, + NEKitChatConfig.shared.ui.messageProperties.avatarCornerRadius > 0 { + avatarImageRight.layer.cornerRadius = NEKitChatConfig.shared.ui.messageProperties.avatarCornerRadius + avatarImageLeft.layer.cornerRadius = NEKitChatConfig.shared.ui.messageProperties.avatarCornerRadius + } else if NEKitChatConfig.shared.ui.messageProperties.avatarType == .cycle { avatarImageRight.layer.cornerRadius = 21.0 avatarImageLeft.layer.cornerRadius = 21.0 } else { diff --git a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/FunChatMessageCallCell.swift b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/FunChatMessageCallCell.swift index 8f800203..bc5fe7a6 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/FunChatMessageCallCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/FunChatMessageCallCell.swift @@ -27,7 +27,7 @@ open class FunChatMessageCallCell: FunChatMessageBaseCell { contentLabelLeft.isEnabled = false contentLabelLeft.numberOfLines = 0 contentLabelLeft.isUserInteractionEnabled = false - contentLabelLeft.font = NEKitChatConfig.shared.ui.messageTextSize + contentLabelLeft.font = .systemFont(ofSize: NEKitChatConfig.shared.ui.messageProperties.messageTextSize) contentLabelLeft.textAlignment = .center contentLabelLeft.backgroundColor = .clear bubbleImageLeft.addSubview(contentLabelLeft) @@ -43,7 +43,7 @@ open class FunChatMessageCallCell: FunChatMessageBaseCell { contentLabelRight.isEnabled = false contentLabelRight.numberOfLines = 0 contentLabelRight.isUserInteractionEnabled = false - contentLabelRight.font = NEKitChatConfig.shared.ui.messageTextSize + contentLabelRight.font = .systemFont(ofSize: NEKitChatConfig.shared.ui.messageProperties.messageTextSize) contentLabelRight.textAlignment = .center contentLabelRight.backgroundColor = .clear bubbleImageRight.addSubview(contentLabelRight) diff --git a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/FunChatMessageTextCell.swift b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/FunChatMessageTextCell.swift index 2a84a01e..7ae9c753 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/FunChatMessageTextCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/FunChatMessageTextCell.swift @@ -12,7 +12,7 @@ open class FunChatMessageTextCell: FunChatMessageBaseCell { label.isEnabled = false label.numberOfLines = 0 label.isUserInteractionEnabled = false - label.font = NEKitChatConfig.shared.ui.messageTextSize + label.font = .systemFont(ofSize: NEKitChatConfig.shared.ui.messageProperties.messageTextSize) label.backgroundColor = .clear label.textAlignment = .justified return label @@ -24,7 +24,7 @@ open class FunChatMessageTextCell: FunChatMessageBaseCell { label.isEnabled = false label.numberOfLines = 0 label.isUserInteractionEnabled = false - label.font = NEKitChatConfig.shared.ui.messageTextSize + label.font = .systemFont(ofSize: NEKitChatConfig.shared.ui.messageProperties.messageTextSize) label.backgroundColor = .clear label.textAlignment = .justified return label diff --git a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/PinCell/FunPinMessageAudioCell.swift b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/PinCell/FunPinMessageAudioCell.swift index 582f438d..c88c50d8 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/PinCell/FunPinMessageAudioCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Cell/PinCell/FunPinMessageAudioCell.swift @@ -13,7 +13,7 @@ open class FunPinMessageAudioCell: NEBasePinMessageAudioCell { backRightConstraint?.constant = 0 backView.layer.cornerRadius = 0 headerView.layer.cornerRadius = 4.0 - let image = NEKitChatConfig.shared.ui.leftBubbleBg ?? UIImage.ne_imageNamed(name: "fun_pin_message_audio_bg") + let image = NEKitChatConfig.shared.ui.messageProperties.leftBubbleBg ?? UIImage.ne_imageNamed(name: "fun_pin_message_audio_bg") bubbleImage.image = image? .resizableImage(withCapInsets: UIEdgeInsets(top: 35, left: 25, bottom: 10, right: 25)) } diff --git a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunChatViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunChatViewController.swift index 11b2e500..18265aed 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunChatViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunChatViewController.swift @@ -13,7 +13,7 @@ open class FunChatViewController: ChatViewController, FunChatInputViewDelegate, override public init(session: NIMSession) { super.init(session: session) - registerCellDic = [ + cellRegisterDic = [ "\(MessageType.text.rawValue)": FunChatMessageTextCell.self, "\(MessageType.rtcCallRecord.rawValue)": FunChatMessageCallCell.self, "\(MessageType.audio.rawValue)": FunChatMessageAudioCell.self, @@ -27,8 +27,8 @@ open class FunChatViewController: ChatViewController, FunChatInputViewDelegate, ] normalInputHeight = 90 - networkToolHeight = 48 - customNavigationView.bottomLine.backgroundColor = .funChatNavigationBottomLineColor + brokenNetworkViewHeight = 48 + navigationView.titleBarBottomLine.backgroundColor = .funChatNavigationBottomLineColor } public required init?(coder: NSCoder) { @@ -38,18 +38,13 @@ open class FunChatViewController: ChatViewController, FunChatInputViewDelegate, override open func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .funChatBackgroundColor // 换肤颜色提取 - view.bringSubviewToFront(menuView) + view.bringSubviewToFront(chatInputView) brokenNetworkView.errorIcon.isHidden = false brokenNetworkView.backgroundColor = .funChatNetworkBrokenBackgroundColor brokenNetworkView.content.textColor = .funChatNetworkBrokenTitleColor getFunInputView()?.funDelegate = self } - override open func didLongTouchMessageView(_ cell: UITableViewCell, _ model: MessageContentModel?) { - super.didLongTouchMessageView(cell, model) - operationView?.layer.cornerRadius = 8 - } - override open func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { let m = viewmodel.messages[indexPath.row] if m.type == .custom { @@ -106,7 +101,7 @@ open class FunChatViewController: ChatViewController, FunChatInputViewDelegate, public func didShowReplyMode() { viewmodel.isReplying = true - menuView.textView.becomeFirstResponder() + chatInputView.textView.becomeFirstResponder() } override open func expandMoreAction() { @@ -118,12 +113,12 @@ open class FunChatViewController: ChatViewController, FunChatInputViewDelegate, photo.customDelegate = self photo.action = #selector(openPhoto) items.insert(photo, at: 0) - menuView.chatAddMoreView.configData(data: items) + chatInputView.chatAddMoreView.configData(data: items) } func openPhoto() { NELog.infoLog(className(), desc: "open photo") - willSelectItem(button: menuView.currentButton, index: showPhotoTag) + willSelectItem(button: chatInputView.currentButton, index: showPhotoTag) } override open func showRtcCallAction() { @@ -148,22 +143,26 @@ open class FunChatViewController: ChatViewController, FunChatInputViewDelegate, override open func forwardMessage() { if let message = viewmodel.operationModel?.message { - weak var weakSelf = self - let userAction = NECustomAlertAction(title: chatLocalizable("contact_user")) { - weakSelf?.forwardMessageToUser(message: message) - } + if IMKitClient.instance.getConfigCenter().teamEnable { + weak var weakSelf = self + let userAction = NECustomAlertAction(title: chatLocalizable("contact_user")) { + weakSelf?.forwardMessageToUser(message: message) + } - let teamAction = NECustomAlertAction(title: chatLocalizable("team")) { - weakSelf?.forwardMessageToTeam(message: message) - } + let teamAction = NECustomAlertAction(title: chatLocalizable("team")) { + weakSelf?.forwardMessageToTeam(message: message) + } - showCustomActionSheet([teamAction, userAction]) + showCustomActionSheet([teamAction, userAction]) + } else { + forwardMessageToUser(message: message) + } } } /// 设置按钮点击事件 override open func toSetting() { - if let block = NEKitChatConfig.shared.ui.titleBarRightClick { + if let block = NEKitChatConfig.shared.ui.messageProperties.titleBarRightClick { block() return } @@ -175,8 +174,7 @@ open class FunChatViewController: ChatViewController, FunChatInputViewDelegate, closure: nil ) } else if viewmodel.session.sessionType == .P2P { - let userSetting = FunUserSettingViewController() - userSetting.userId = viewmodel.session.sessionId + let userSetting = FunUserSettingViewController(userId: viewmodel.session.sessionId) navigationController?.pushViewController(userSetting, animated: true) } } @@ -287,7 +285,7 @@ open class FunChatViewController: ChatViewController, FunChatInputViewDelegate, } func getFunInputView() -> FunChatInputView? { - if let funInput = menuView as? FunChatInputView { + if let funInput = inputView as? FunChatInputView { return funInput } return nil @@ -346,15 +344,15 @@ open class FunChatViewController: ChatViewController, FunChatInputViewDelegate, default: text += "[\(chatLocalizable("msg_unknown"))]" } - replyView.replyLabel.attributedText = NEEmotionTool.getAttWithStr(str: text, - font: .systemFont(ofSize: 13), - color: .ne_greyText) + getFunInputView()?.replyLabel.attributedText = NEEmotionTool.getAttWithStr(str: text, + font: .systemFont(ofSize: 13), + color: .ne_greyText) } - if menuView.textView.isFirstResponder { + if chatInputView.textView.isFirstResponder { normalOffset = -10 layoutInputView(offset: currentKeyboardHeight) } else { - menuView.textView.becomeFirstResponder() + chatInputView.textView.becomeFirstResponder() } } } diff --git a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunGroupChatViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunGroupChatViewController.swift index 033e9340..f52f99fa 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunGroupChatViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunGroupChatViewController.swift @@ -81,16 +81,16 @@ open class FunGroupChatViewController: FunChatViewController, TeamChatViewModelD title = team.getShowName() if team.inAllMuteMode(), team.owner != NIMSDK.shared().loginManager.currentAccount() { // 群禁言 - menuView.textView.attributedPlaceholder = getPlaceHolder(text: chatLocalizable("team_mute")) - menuView.textView.backgroundColor = .funChatInputViewBackgroundColorInMute + chatInputView.textView.attributedPlaceholder = getPlaceHolder(text: chatLocalizable("team_mute")) + chatInputView.textView.backgroundColor = .funChatInputViewBackgroundColorInMute layoutInputView(offset: 0) getFunInputView()?.hideRecordMode() - menuView.isUserInteractionEnabled = false + chatInputView.isUserInteractionEnabled = false } else { // 解除群禁言 - menuView.textView.attributedPlaceholder = getPlaceHolder(text: chatLocalizable("fun_chat_input_placeholder")) - menuView.textView.backgroundColor = .white - menuView.isUserInteractionEnabled = true + chatInputView.textView.attributedPlaceholder = getPlaceHolder(text: chatLocalizable("fun_chat_input_placeholder")) + chatInputView.textView.backgroundColor = .white + chatInputView.isUserInteractionEnabled = true } } @@ -98,7 +98,7 @@ open class FunGroupChatViewController: FunChatViewController, TeamChatViewModelD open func onTeamRemoved(team: NIMTeam) { // 退出讨论组 - if team.clientCustomInfo?.contains(discussTeamKey) == true { + if team.isDisscuss() == true { navigationController?.popViewController(animated: true) return } diff --git a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunP2PChatViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunP2PChatViewController.swift index a4851ebe..eb8282d6 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunP2PChatViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunP2PChatViewController.swift @@ -2,6 +2,7 @@ // Use of this source code is governed by a MIT license that can be // found in the LICENSE file. +import NEChatKit import NIMSDK import UIKit @@ -19,19 +20,25 @@ open class FunP2PChatViewController: FunChatViewController { } override open func getSessionInfo(session: NIMSession) { - let user = viewmodel.getUserInfo(userId: session.sessionId) - let showName = user?.showName() ?? "" - title = showName - titleContent = showName - let text = chatLocalizable("fun_chat_input_placeholder") - let attribute = NSMutableAttributedString(string: text) - let style = NSMutableParagraphStyle() - style.lineBreakMode = .byTruncatingTail - style.alignment = .left - attribute.addAttribute(.font, value: UIFont.systemFont(ofSize: 16), range: NSMakeRange(0, text.utf16.count)) - attribute.addAttribute(.foregroundColor, value: UIColor.funChatInputViewPlaceholderTextColor, range: NSMakeRange(0, text.utf16.count)) - attribute.addAttribute(.paragraphStyle, value: style, range: NSMakeRange(0, text.utf16.count)) - menuView.textView.attributedPlaceholder = attribute + var showName = session.sessionId + viewmodel.getUserInfo(session.sessionId) { [weak self] user, error in + if let name = user?.showName() { + showName = name + } + + self?.title = showName + self?.titleContent = showName + let text = chatLocalizable("fun_chat_input_placeholder") + let attribute = NSMutableAttributedString(string: text) + let style = NSMutableParagraphStyle() + style.lineBreakMode = .byTruncatingTail + style.alignment = .left + attribute.addAttribute(.font, value: UIFont.systemFont(ofSize: 16), range: NSMakeRange(0, text.utf16.count)) + attribute.addAttribute(.foregroundColor, value: UIColor.funChatInputViewPlaceholderTextColor, range: NSMakeRange(0, text.utf16.count)) + attribute.addAttribute(.paragraphStyle, value: style, range: NSMakeRange(0, text.utf16.count)) + self?.chatInputView.textView.attributedPlaceholder = attribute + self?.chatInputView.textView.setNeedsLayout() + } } /// 创建个人聊天页构造方法 diff --git a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunPinMessageViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunPinMessageViewController.swift index db921385..7e87e147 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunPinMessageViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunPinMessageViewController.swift @@ -57,14 +57,18 @@ open class FunPinMessageViewController: NEBasePinMessageViewController { } override open func forwardMessage(_ message: NIMMessage) { - let userAction = NECustomAlertAction(title: chatLocalizable("contact_user")) { [weak self] in - self?.forwardMessageToUser(message) - } + if IMKitClient.instance.getConfigCenter().teamEnable { + let userAction = NECustomAlertAction(title: chatLocalizable("contact_user")) { [weak self] in + self?.forwardMessageToUser(message) + } - let teamAction = NECustomAlertAction(title: chatLocalizable("team")) { [weak self] in - self?.forwardMessageToTeam(message) - } + let teamAction = NECustomAlertAction(title: chatLocalizable("team")) { [weak self] in + self?.forwardMessageToTeam(message) + } - showCustomActionSheet([teamAction, userAction]) + showCustomActionSheet([teamAction, userAction]) + } else { + forwardMessageToUser(message) + } } } diff --git a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunReadViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunReadViewController.swift index 122a58a6..513e8cfd 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunReadViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunReadViewController.swift @@ -12,7 +12,7 @@ open class FunReadViewController: NEBaseReadViewController { override public func commonUI() { super.commonUI() navigationController?.navigationBar.backgroundColor = .white - customNavigationView.backgroundColor = .white + navigationView.backgroundColor = .white readButton.setTitleColor(UIColor.funChatThemeColor, for: .normal) line.backgroundColor = UIColor.funChatThemeColor diff --git a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunUserSettingViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunUserSettingViewController.swift index 9f81eac0..f3994163 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunUserSettingViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/FunUI/Controller/FunUserSettingViewController.swift @@ -8,8 +8,8 @@ import UIKit @objcMembers open class FunUserSettingViewController: NEBaseUserSettingViewController { - override public init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { - super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) + override public init(userId: String) { + super.init(userId: userId) cellClassDic = [ UserSettingType.SwitchType.rawValue: FunUserSettingSwitchCell.self, UserSettingType.SelectType.rawValue: FunUserSettingSelectCell.self, @@ -31,8 +31,8 @@ open class FunUserSettingViewController: NEBaseUserSettingViewController { override func setupUI() { super.setupUI() navigationController?.navigationBar.backgroundColor = .white - customNavigationView.backgroundColor = .white - customNavigationView.bottomLine.isHidden = false + navigationView.backgroundColor = .white + navigationView.titleBarBottomLine.isHidden = false userHeader.layer.cornerRadius = 4.0 addBtn.setImage(coreLoader.loadImage("fun_setting_add"), for: .normal) contentTable.rowHeight = 56 @@ -53,12 +53,7 @@ open class FunUserSettingViewController: NEBaseUserSettingViewController { ]) cornerBack.addSubview(userHeader) - NSLayoutConstraint.activate([ - userHeader.leftAnchor.constraint(equalTo: cornerBack.leftAnchor, constant: 22), - userHeader.topAnchor.constraint(equalTo: cornerBack.topAnchor, constant: 22), - userHeader.widthAnchor.constraint(equalToConstant: 50), - userHeader.heightAnchor.constraint(equalToConstant: 50), - ]) + let tap = UITapGestureRecognizer() userHeader.addGestureRecognizer(tap) tap.numberOfTapsRequired = 1 @@ -74,22 +69,49 @@ open class FunUserSettingViewController: NEBaseUserSettingViewController { userHeader.backgroundColor = UIColor.colorWithString(string: viewmodel.userInfo?.userId) } - cornerBack.addSubview(addBtn) - NSLayoutConstraint.activate([ - addBtn.leftAnchor.constraint(equalTo: userHeader.rightAnchor, constant: 20.0), - addBtn.topAnchor.constraint(equalTo: userHeader.topAnchor), - addBtn.widthAnchor.constraint(equalToConstant: 50.0), - addBtn.heightAnchor.constraint(equalToConstant: 50.0), - ]) - addBtn.addTarget(self, action: #selector(createDiscuss), for: .touchUpInside) - - cornerBack.addSubview(nameLabel) - NSLayoutConstraint.activate([ - nameLabel.topAnchor.constraint(equalTo: userHeader.bottomAnchor, constant: 3.0), - nameLabel.centerXAnchor.constraint(equalTo: userHeader.centerXAnchor), - nameLabel.widthAnchor.constraint(equalTo: userHeader.widthAnchor), - ]) nameLabel.text = viewmodel.userInfo?.showName() + cornerBack.addSubview(nameLabel) + + if IMKitClient.instance.getConfigCenter().teamEnable { + NSLayoutConstraint.activate([ + userHeader.leftAnchor.constraint(equalTo: cornerBack.leftAnchor, constant: 22), + userHeader.topAnchor.constraint(equalTo: cornerBack.topAnchor, constant: 22), + userHeader.widthAnchor.constraint(equalToConstant: 50), + userHeader.heightAnchor.constraint(equalToConstant: 50), + ]) + + nameLabel.font = NEConstant.defaultTextFont(12) + nameLabel.textAlignment = .center + NSLayoutConstraint.activate([ + nameLabel.topAnchor.constraint(equalTo: userHeader.bottomAnchor, constant: 3.0), + nameLabel.centerXAnchor.constraint(equalTo: userHeader.centerXAnchor), + nameLabel.widthAnchor.constraint(equalTo: userHeader.widthAnchor), + ]) + + addBtn.addTarget(self, action: #selector(createDiscuss), for: .touchUpInside) + cornerBack.addSubview(addBtn) + NSLayoutConstraint.activate([ + addBtn.leftAnchor.constraint(equalTo: userHeader.rightAnchor, constant: 20.0), + addBtn.topAnchor.constraint(equalTo: userHeader.topAnchor), + addBtn.widthAnchor.constraint(equalToConstant: 50.0), + addBtn.heightAnchor.constraint(equalToConstant: 50.0), + ]) + } else { + NSLayoutConstraint.activate([ + userHeader.leftAnchor.constraint(equalTo: cornerBack.leftAnchor, constant: 16), + userHeader.centerYAnchor.constraint(equalTo: cornerBack.centerYAnchor), + userHeader.widthAnchor.constraint(equalToConstant: 60), + userHeader.heightAnchor.constraint(equalToConstant: 60), + ]) + + nameLabel.font = NEConstant.defaultTextFont(16) + nameLabel.textAlignment = .left + NSLayoutConstraint.activate([ + nameLabel.leftAnchor.constraint(equalTo: userHeader.rightAnchor, constant: 16.0), + nameLabel.rightAnchor.constraint(equalTo: cornerBack.rightAnchor), + nameLabel.centerYAnchor.constraint(equalTo: userHeader.centerYAnchor), + ]) + } return header } diff --git a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/ChatMessageCallCell.swift b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/ChatMessageCallCell.swift index d86b189e..7cb6175b 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/ChatMessageCallCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/ChatMessageCallCell.swift @@ -27,7 +27,7 @@ open class ChatMessageCallCell: NormalChatMessageBaseCell { contentLabelLeft.isEnabled = false contentLabelLeft.numberOfLines = 0 contentLabelLeft.isUserInteractionEnabled = false - contentLabelLeft.font = NEKitChatConfig.shared.ui.messageTextSize + contentLabelLeft.font = .systemFont(ofSize: NEKitChatConfig.shared.ui.messageProperties.messageTextSize) contentLabelLeft.textAlignment = .center contentLabelLeft.backgroundColor = .clear contentLabelLeft.accessibilityIdentifier = "id.chatMessageCallText" @@ -45,7 +45,7 @@ open class ChatMessageCallCell: NormalChatMessageBaseCell { contentLabelRight.isEnabled = false contentLabelRight.numberOfLines = 0 contentLabelRight.isUserInteractionEnabled = false - contentLabelRight.font = NEKitChatConfig.shared.ui.messageTextSize + contentLabelRight.font = .systemFont(ofSize: NEKitChatConfig.shared.ui.messageProperties.messageTextSize) contentLabelRight.textAlignment = .center contentLabelRight.backgroundColor = .clear contentLabelRight.accessibilityIdentifier = "id.chatMessageCallText" diff --git a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/ChatMessageReplyCell.swift b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/ChatMessageReplyCell.swift index c70c7d6b..30ff3250 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/ChatMessageReplyCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/ChatMessageReplyCell.swift @@ -93,11 +93,7 @@ open class ChatMessageReplyCell: ChatMessageTextCell { font: font, color: replyLabel.textColor) if let attriText = replyLabel.attributedText { - let textSize = NEChatUITool.getSizeWithAtt( - att: attriText, - font: font, - maxSize: CGSize(width: chat_text_maxW, height: CGFloat.greatestFiniteMagnitude) - ) + let textSize = attriText.finalSize(font, CGSize(width: chat_text_maxW, height: CGFloat.greatestFiniteMagnitude)) model.contentSize.width = max(textSize.width + chat_content_margin * 2, model.contentSize.width) } } diff --git a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/ChatMessageTextCell.swift b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/ChatMessageTextCell.swift index 72ac2ebe..a5bb8cac 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/ChatMessageTextCell.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Cell/ChatMessageTextCell.swift @@ -13,7 +13,7 @@ open class ChatMessageTextCell: NormalChatMessageBaseCell { label.isEnabled = false label.numberOfLines = 0 label.isUserInteractionEnabled = false - label.font = NEKitChatConfig.shared.ui.messageTextSize + label.font = .systemFont(ofSize: NEKitChatConfig.shared.ui.messageProperties.messageTextSize) label.backgroundColor = .clear label.textAlignment = .justified label.accessibilityIdentifier = "id.messageText" @@ -26,7 +26,7 @@ open class ChatMessageTextCell: NormalChatMessageBaseCell { label.isEnabled = false label.numberOfLines = 0 label.isUserInteractionEnabled = false - label.font = NEKitChatConfig.shared.ui.messageTextSize + label.font = .systemFont(ofSize: NEKitChatConfig.shared.ui.messageProperties.messageTextSize) label.backgroundColor = .clear label.textAlignment = .justified label.accessibilityIdentifier = "id.messageText" diff --git a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/GroupChatViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/GroupChatViewController.swift index 67cc161f..ff512a0a 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/GroupChatViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/GroupChatViewController.swift @@ -83,16 +83,16 @@ open class GroupChatViewController: NormalChatViewController, TeamChatViewModelD open func updateTeamInfo(team: NIMTeam) { title = team.getShowName() if team.inAllMuteMode(), team.owner != NIMSDK.shared().loginManager.currentAccount() { - menuView.textView.isEditable = false - menuView.textView.attributedPlaceholder = getPlaceHolder(text: chatLocalizable("team_mute")) - menuView.textView.backgroundColor = UIColor(hexString: "#E3E4E4") + chatInputView.textView.isEditable = false + chatInputView.textView.attributedPlaceholder = getPlaceHolder(text: chatLocalizable("team_mute")) + chatInputView.textView.backgroundColor = UIColor(hexString: "#E3E4E4") layoutInputView(offset: 0) - menuView.stackView.isUserInteractionEnabled = false + chatInputView.stackView.isUserInteractionEnabled = false } else { - menuView.textView.isEditable = true - menuView.textView.attributedPlaceholder = getPlaceHolder(text: "\(chatLocalizable("send_to"))\(team.getShowName())") - menuView.textView.backgroundColor = .white - menuView.stackView.isUserInteractionEnabled = true + chatInputView.textView.isEditable = true + chatInputView.textView.attributedPlaceholder = getPlaceHolder(text: "\(chatLocalizable("send_to"))\(team.getShowName())") + chatInputView.textView.backgroundColor = .white + chatInputView.stackView.isUserInteractionEnabled = true } } @@ -100,7 +100,7 @@ open class GroupChatViewController: NormalChatViewController, TeamChatViewModelD open func onTeamRemoved(team: NIMTeam) { // 退出讨论组 - if team.clientCustomInfo?.contains(discussTeamKey) == true { + if team.isDisscuss() == true { navigationController?.popViewController(animated: true) return } diff --git a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/NormalChatViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/NormalChatViewController.swift index adf87c48..0d74d428 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/NormalChatViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/NormalChatViewController.swift @@ -9,9 +9,9 @@ import UIKit open class NormalChatViewController: ChatViewController { override public init(session: NIMSession) { super.init(session: session) - customNavigationView.backgroundColor = .white + navigationView.backgroundColor = .white navigationController?.navigationBar.backgroundColor = .white - registerCellDic = [ + cellRegisterDic = [ "\(MessageType.text.rawValue)": ChatMessageTextCell.self, "\(MessageType.rtcCallRecord.rawValue)": ChatMessageCallCell.self, "\(MessageType.audio.rawValue)": ChatMessageAudioCell.self, @@ -46,7 +46,7 @@ open class NormalChatViewController: ChatViewController { } override open func toSetting() { - if let block = NEKitChatConfig.shared.ui.titleBarRightClick { + if let block = NEKitChatConfig.shared.ui.messageProperties.titleBarRightClick { block() return } @@ -58,19 +58,11 @@ open class NormalChatViewController: ChatViewController { closure: nil ) } else if viewmodel.session.sessionType == .P2P { - let userSetting = UserSettingViewController() - userSetting.userId = viewmodel.session.sessionId + let userSetting = UserSettingViewController(userId: viewmodel.session.sessionId) navigationController?.pushViewController(userSetting, animated: true) } } - override open func didLongTouchMessageView(_ cell: UITableViewCell, _ model: MessageContentModel?) { - super.didLongTouchMessageView(cell, model) - operationView?.layer.cornerRadius = 8 - operationView?.layer.borderColor = UIColor.ne_darkText.cgColor - operationView?.layer.borderWidth = 0.2 - } - override open func didTapReadView(_ cell: UITableViewCell, _ model: MessageContentModel?) { if let msg = model?.message, msg.session?.sessionType == .team { let readVC = ReadViewController(message: msg) diff --git a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/P2PChatViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/P2PChatViewController.swift index 6604c061..a68daf8f 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/P2PChatViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/P2PChatViewController.swift @@ -3,6 +3,7 @@ // Use of this source code is governed by a MIT license that can be // found in the LICENSE file. +import NEChatKit import NIMSDK import UIKit @@ -20,19 +21,25 @@ open class P2PChatViewController: NormalChatViewController { } override open func getSessionInfo(session: NIMSession) { - let user = viewmodel.getUserInfo(userId: session.sessionId) - let showName = user?.showName() ?? "" - title = showName - titleContent = showName - let text = "\(chatLocalizable("send_to"))\(showName)" - let attribute = NSMutableAttributedString(string: text) - let style = NSMutableParagraphStyle() - style.lineBreakMode = .byTruncatingTail - style.alignment = .left - attribute.addAttribute(.font, value: UIFont.systemFont(ofSize: 16), range: NSMakeRange(0, text.utf16.count)) - attribute.addAttribute(.foregroundColor, value: UIColor.gray, range: NSMakeRange(0, text.utf16.count)) - attribute.addAttribute(.paragraphStyle, value: style, range: NSMakeRange(0, text.utf16.count)) - menuView.textView.attributedPlaceholder = attribute + var showName = session.sessionId + viewmodel.getUserInfo(session.sessionId) { [weak self] user, error in + if let name = user?.showName() { + showName = name + } + + self?.title = showName + self?.titleContent = showName + let text = "\(chatLocalizable("send_to"))\(showName)" + let attribute = NSMutableAttributedString(string: text) + let style = NSMutableParagraphStyle() + style.lineBreakMode = .byTruncatingTail + style.alignment = .left + attribute.addAttribute(.font, value: UIFont.systemFont(ofSize: 16), range: NSMakeRange(0, text.utf16.count)) + attribute.addAttribute(.foregroundColor, value: UIColor.gray, range: NSMakeRange(0, text.utf16.count)) + attribute.addAttribute(.paragraphStyle, value: style, range: NSMakeRange(0, text.utf16.count)) + self?.chatInputView.textView.attributedPlaceholder = attribute + self?.chatInputView.textView.setNeedsLayout() + } } /// 创建个人聊天页构造方法 diff --git a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/PinMessageViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/PinMessageViewController.swift index 5b8a3b5b..9f2b85d5 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/PinMessageViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/PinMessageViewController.swift @@ -10,7 +10,7 @@ open class PinMessageViewController: NEBasePinMessageViewController { override public func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .ne_lightBackgroundColor - customNavigationView.backgroundColor = .ne_lightBackgroundColor + navigationView.backgroundColor = .ne_lightBackgroundColor navigationController?.navigationBar.backgroundColor = .ne_lightBackgroundColor } diff --git a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/ReadViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/ReadViewController.swift index 2b7e5d87..2fe49747 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/ReadViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/ReadViewController.swift @@ -12,7 +12,7 @@ import UIKit open class ReadViewController: NEBaseReadViewController { override init(message: NIMMessage) { super.init(message: message) - customNavigationView.backgroundColor = .white + navigationView.backgroundColor = .white navigationController?.navigationBar.backgroundColor = .white } @@ -22,7 +22,7 @@ open class ReadViewController: NEBaseReadViewController { override public func commonUI() { super.commonUI() - customNavigationView.bottomLine.isHidden = false + navigationView.titleBarBottomLine.isHidden = false readButton.setTitleColor(UIColor.ne_darkText, for: .normal) line.backgroundColor = UIColor.ne_blueText diff --git a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/UserSettingViewController.swift b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/UserSettingViewController.swift index 0cfa964f..c2b1c882 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/UserSettingViewController.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/Controller/UserSettingViewController.swift @@ -9,9 +9,9 @@ import UIKit @objcMembers open class UserSettingViewController: NEBaseUserSettingViewController { - override public init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { - super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) - customNavigationView.backgroundColor = .white + override public init(userId: String) { + super.init(userId: userId) + navigationView.backgroundColor = .white navigationController?.navigationBar.backgroundColor = .white cellClassDic = [ UserSettingType.SwitchType.rawValue: UserSettingSwitchCell.self, @@ -25,7 +25,7 @@ open class UserSettingViewController: NEBaseUserSettingViewController { override func setupUI() { super.setupUI() - userHeader.layer.cornerRadius = 21.0 + userHeader.layer.cornerRadius = IMKitClient.instance.getConfigCenter().teamEnable ? 21.0 : 30.0 } override func getPinMessageViewController(session: NIMSession) -> NEBasePinMessageViewController { diff --git a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/View/ChatInpuView.swift b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/View/ChatInpuView.swift index 72c4217a..110df866 100644 --- a/NEChatUIKit/NEChatUIKit/Classes/NormalUI/View/ChatInpuView.swift +++ b/NEChatUIKit/NEChatUIKit/Classes/NormalUI/View/ChatInpuView.swift @@ -24,7 +24,7 @@ open class ChatInputView: NEBaseChatInputView { let imageNamesSelected = ["mic_selected", "emoji_selected", "photo", "add_selected"] var items = [UIButton]() - for i in 0 ... 3 { + for i in 0 ..< imageNames.count { let button = UIButton(type: .custom) button.setImage(UIImage.ne_imageNamed(name: imageNames[i]), for: .normal) button.setImage(UIImage.ne_imageNamed(name: imageNamesSelected[i]), for: .selected) @@ -35,6 +35,10 @@ open class ChatInputView: NEBaseChatInputView { items.append(button) } + if let chatInputBar = NEKitChatConfig.shared.ui.chatInputBar { + chatInputBar(&items) + } + stackView = UIStackView(arrangedSubviews: items) stackView.translatesAutoresizingMaskIntoConstraints = false stackView.distribution = .fillEqually diff --git a/NEContactUIKit/NEContactUIKit.podspec b/NEContactUIKit/NEContactUIKit.podspec index 73561da7..4e12d7f4 100644 --- a/NEContactUIKit/NEContactUIKit.podspec +++ b/NEContactUIKit/NEContactUIKit.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'NEContactUIKit' - s.version = '9.6.3' + s.version = '9.6.5' s.summary = 'Netease XKit' # This description is used to generate tags and improve search results. @@ -27,7 +27,7 @@ Pod::Spec.new do |s| 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64', 'BUILD_LIBRARY_FOR_DISTRIBUTION' => 'YES' } - s.ios.deployment_target = '10.0' + s.ios.deployment_target = '11.0' s.swift_version = '5.0' s.source_files = 'NEContactUIKit/Classes/**/*' diff --git a/NEContactUIKit/NEContactUIKit/Assets/en.lproj/Localizable.strings b/NEContactUIKit/NEContactUIKit/Assets/en.lproj/Localizable.strings index e441bef8..52e6ae8a 100644 --- a/NEContactUIKit/NEContactUIKit/Assets/en.lproj/Localizable.strings +++ b/NEContactUIKit/NEContactUIKit/Assets/en.lproj/Localizable.strings @@ -24,7 +24,7 @@ "email"="e-mail"; "sign"="What's Up"; "delete_friend"="Delete Contact"; -"delete_title"="Delete \"XXX\" Contact"; +"delete_title"="Delete \"%@\" Contact"; "add_friend"="Add Contact"; "add_blackList"="block"; "send_friend_apply"="Contact request sent"; diff --git a/NEContactUIKit/NEContactUIKit/Assets/zh-Hans.lproj/Localizable.strings b/NEContactUIKit/NEContactUIKit/Assets/zh-Hans.lproj/Localizable.strings index 516c19ba..0c42b4d0 100644 --- a/NEContactUIKit/NEContactUIKit/Assets/zh-Hans.lproj/Localizable.strings +++ b/NEContactUIKit/NEContactUIKit/Assets/zh-Hans.lproj/Localizable.strings @@ -24,7 +24,7 @@ "email"="邮箱"; "sign"="个性签名"; "delete_friend"="删除好友"; -"delete_title"="将联系人\“XXX\”删除"; +"delete_title"="将联系人\“%@\”删除"; "add_friend"="添加好友"; "add_blackList"="加入黑名单"; "send_friend_apply"="好友申请已发送"; diff --git a/NEContactUIKit/NEContactUIKit/Classes/Base/NEBaseContactViewCell.swift b/NEContactUIKit/NEContactUIKit/Classes/Base/NEBaseContactViewCell.swift index 9926d17e..edd1ad32 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Base/NEBaseContactViewCell.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Base/NEBaseContactViewCell.swift @@ -45,6 +45,7 @@ open class NEBaseContactViewCell: UITableViewCell { name.textAlignment = .center name.font = UIFont.systemFont(ofSize: 14.0) name.adjustsFontSizeToFitWidth = true + name.accessibilityIdentifier = "id.avatar" return name }() diff --git a/NEContactUIKit/NEContactUIKit/Classes/BlackList/ViewController/NEBaseBlackListViewController.swift b/NEContactUIKit/NEContactUIKit/Classes/BlackList/ViewController/NEBaseBlackListViewController.swift index a62cb6ce..6e2bce8e 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/BlackList/ViewController/NEBaseBlackListViewController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/BlackList/ViewController/NEBaseBlackListViewController.swift @@ -11,7 +11,7 @@ import UIKit @objcMembers open class NEBaseBlackListViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, BlackListCellDelegate, UIGestureRecognizerDelegate { - public let customNavigationView = NENavigationView() + public let navigationView = NENavigationView() var tableView = UITableView(frame: .zero, style: .plain) var viewModel = BlackListViewModel() public var blackList: [User]? @@ -34,7 +34,7 @@ open class NEBaseBlackListViewController: UIViewController, UITableViewDelegate, func commonUI() { title = localizable("blacklist") - customNavigationView.navTitle.text = title + navigationView.navTitle.text = title let image = UIImage.ne_imageNamed(name: "backArrow")?.withRenderingMode(.alwaysOriginal) let backItem = UIBarButtonItem( image: image, @@ -55,16 +55,16 @@ open class NEBaseBlackListViewController: UIViewController, UITableViewDelegate, addItem.accessibilityIdentifier = "id.threePoint" navigationItem.rightBarButtonItem = addItem - customNavigationView.translatesAutoresizingMaskIntoConstraints = false - customNavigationView.addBackButtonTarget(target: self, selector: #selector(backEvent)) - customNavigationView.setMoreButtonImage(UIImage.ne_imageNamed(name: "add")) - customNavigationView.addMoreButtonTarget(target: self, selector: #selector(addBlack)) - view.addSubview(customNavigationView) + navigationView.translatesAutoresizingMaskIntoConstraints = false + navigationView.addBackButtonTarget(target: self, selector: #selector(backEvent)) + navigationView.setMoreButtonImage(UIImage.ne_imageNamed(name: "add")) + navigationView.addMoreButtonTarget(target: self, selector: #selector(addBlack)) + view.addSubview(navigationView) NSLayoutConstraint.activate([ - customNavigationView.leftAnchor.constraint(equalTo: view.leftAnchor), - customNavigationView.rightAnchor.constraint(equalTo: view.rightAnchor), - customNavigationView.topAnchor.constraint(equalTo: view.topAnchor), - customNavigationView.heightAnchor.constraint(equalToConstant: NEConstant.navigationAndStatusHeight), + navigationView.leftAnchor.constraint(equalTo: view.leftAnchor), + navigationView.rightAnchor.constraint(equalTo: view.rightAnchor), + navigationView.topAnchor.constraint(equalTo: view.topAnchor), + navigationView.heightAnchor.constraint(equalToConstant: NEConstant.navigationAndStatusHeight), ]) tableView.separatorStyle = .none diff --git a/NEContactUIKit/NEContactUIKit/Classes/Common/ContactConst.swift b/NEContactUIKit/NEContactUIKit/Classes/Common/ContactConst.swift index a14f82b5..1f5c61cd 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Common/ContactConst.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Common/ContactConst.swift @@ -14,9 +14,6 @@ public enum ContactCellType: Int { case ContactCutom = 50 // custom type start with 50 } -public typealias ContactClickCallBack = (_ index: Int, _ section: Int?) - -> Void // parameter type contain ContactCellType and custom type - public typealias ContactsSelectCompletion = ([ContactInfo]) -> Void? let coreLoader = CoreLoader() diff --git a/NEContactUIKit/NEContactUIKit/Classes/ContactConfig/ContactUIConfig.swift b/NEContactUIKit/NEContactUIKit/Classes/ContactConfig/ContactUIConfig.swift index 0ebefc87..ef846f09 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/ContactConfig/ContactUIConfig.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/ContactConfig/ContactUIConfig.swift @@ -12,23 +12,66 @@ import UIKit @objcMembers public class ContactUIConfig: NSObject { + // 标题栏文案 + public var title: String? + + /// 标题栏文案颜色 + public var titleColor: UIColor? + + /// 是否展示标题栏 + public var showTitleBar = true + + /// 是否展示标题栏的次最右侧图标 + public var showTitleBarRight2Icon = true + + /// 是否展示标题栏的最右侧图标 + public var showTitleBarRightIcon = true + + /// 标题栏的最右侧图标 + public var titleBarRightRes: UIImage? + + /// 标题栏的次最右侧图标 + public var titleBarRight2Res: UIImage? + + /// 标题栏最右侧按钮点击事件 + public var titleBarRightClick: (() -> Void)? + + /// 标题栏次最右侧按钮点击事件 + public var titleBarRight2Click: (() -> Void)? + + /// 是否在通讯录界面显示头部模块 + public var showHeader = true + + /// 通讯录列表头部模块的数据回调 + public var headerData: (([ContactHeadItem]) -> Void)? + + /// 通讯录列表头部模块 cell 点击事件 + public var headerItemClick: ((ContactInfo, IndexPath) -> Void)? + + /// 通讯录列表好友 cell 点击事件 + public var friendItemClick: ((ContactInfo, IndexPath) -> Void)? + + /// 通讯录好友列表的 UI 个性化定制 + public var contactProperties = ContactProperties() + + /// 通讯录列表的视图控制器回调,回调中会返回通讯录列表的视图控制器 + public var customController: ((NEBaseContactsViewController) -> Void)? +} + +/// 通讯录页面的 UI 个性化定制 +@objcMembers +public class ContactProperties: NSObject { /// 头像圆角大小 public var avatarCornerRadius = 4.0 /// 头像类型 public var avatarType: NEContactAvatarType? - // 通讯录标题大小 - public var titleFont: UIFont? - - /// 通讯录标题颜色 - public var titleColor = UIColor.ne_darkText - - /// 是否隐藏通讯录搜索按钮 - public var hiddenSearchBtn = false + // 通讯录好友标题大小 + public var itemTitleSize: CGFloat = 0 - /// 是否把顶部添加好友和搜索按钮都隐藏 - public var hiddenRightBtns = false + /// 通讯录好友标题颜色 + public var itemTitleColor = UIColor.ne_darkText /// 通讯录间隔线颜色 public var divideLineColor = UIColor.ne_borderColor diff --git a/NEContactUIKit/NEContactUIKit/Classes/FunUI/Cell/FunContactSelectedCell.swift b/NEContactUIKit/NEContactUIKit/Classes/FunUI/Cell/FunContactSelectedCell.swift index 8b8f9d5a..c55db64e 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/FunUI/Cell/FunContactSelectedCell.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/FunUI/Cell/FunContactSelectedCell.swift @@ -28,9 +28,9 @@ open class FunContactSelectedCell: NEBaseContactSelectedCell { } override open func initSubviewsLayout() { - if NEKitContactConfig.shared.ui.avatarType == .rectangle { - avatarImage.layer.cornerRadius = NEKitContactConfig.shared.ui.avatarCornerRadius - } else if NEKitContactConfig.shared.ui.avatarType == .cycle { + if NEKitContactConfig.shared.ui.contactProperties.avatarType == .rectangle { + avatarImage.layer.cornerRadius = NEKitContactConfig.shared.ui.contactProperties.avatarCornerRadius + } else if NEKitContactConfig.shared.ui.contactProperties.avatarType == .cycle { avatarImage.layer.cornerRadius = 20.0 } else { avatarImage.layer.cornerRadius = 4.0 // Fun UI @@ -39,7 +39,7 @@ open class FunContactSelectedCell: NEBaseContactSelectedCell { override open func setConfig() { super.setConfig() - titleLabel.font = NEKitContactConfig.shared.ui.titleFont ?? UIFont.systemFont(ofSize: 17) + titleLabel.font = .systemFont(ofSize: NEKitContactConfig.shared.ui.contactProperties.itemTitleSize > 0 ? NEKitContactConfig.shared.ui.contactProperties.itemTitleSize : 17) } override open func setModel(_ model: ContactInfo) { diff --git a/NEContactUIKit/NEContactUIKit/Classes/FunUI/Cell/FunContactTableViewCell.swift b/NEContactUIKit/NEContactUIKit/Classes/FunUI/Cell/FunContactTableViewCell.swift index 418625bd..dae4c46b 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/FunUI/Cell/FunContactTableViewCell.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/FunUI/Cell/FunContactTableViewCell.swift @@ -25,9 +25,9 @@ open class FunContactTableViewCell: NEBaseContactTableViewCell { } override open func initSubviewsLayout() { - if NEKitContactConfig.shared.ui.avatarType == .rectangle { - avatarImage.layer.cornerRadius = NEKitContactConfig.shared.ui.avatarCornerRadius - } else if NEKitContactConfig.shared.ui.avatarType == .cycle { + if NEKitContactConfig.shared.ui.contactProperties.avatarType == .rectangle { + avatarImage.layer.cornerRadius = NEKitContactConfig.shared.ui.contactProperties.avatarCornerRadius + } else if NEKitContactConfig.shared.ui.contactProperties.avatarType == .cycle { avatarImage.layer.cornerRadius = 20.0 } else { avatarImage.layer.cornerRadius = 4.0 // Fun UI @@ -36,7 +36,7 @@ open class FunContactTableViewCell: NEBaseContactTableViewCell { override open func setConfig() { super.setConfig() - titleLabel.font = NEKitContactConfig.shared.ui.titleFont ?? UIFont.systemFont(ofSize: 17) + titleLabel.font = .systemFont(ofSize: NEKitContactConfig.shared.ui.contactProperties.itemTitleSize > 0 ? NEKitContactConfig.shared.ui.contactProperties.itemTitleSize : 17) } override open func setModel(_ model: ContactInfo) { diff --git a/NEContactUIKit/NEContactUIKit/Classes/FunUI/FunContactRouter.swift b/NEContactUIKit/NEContactUIKit/Classes/FunUI/FunContactRouter.swift index de54d386..a404f3f3 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/FunUI/FunContactRouter.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/FunUI/FunContactRouter.swift @@ -47,10 +47,35 @@ public extension ContactRouter { } } + Router.shared.register(ContactPageRouter) { param in + if let nav = param["nav"] as? UINavigationController { + let contactVC = FunContactsViewController() + nav.pushViewController(contactVC, animated: true) + } + } + + Router.shared.register(ValidationMessageRouter) { param in + if let nav = param["nav"] as? UINavigationController { + let validationController = FunValidationMessageViewController() + nav.pushViewController(validationController, animated: true) + } + } + + Router.shared.register(ContactBlackListRouter) { param in + if let nav = param["nav"] as? UINavigationController { + let blackVC = FunBlackListViewController() + nav.pushViewController(blackVC, animated: true) + } + } + Router.shared.register(ContactTeamListRouter) { param in if let nav = param["nav"] as? UINavigationController { let team = FunTeamListViewController() - team.isClickCallBack = true + + if let isClickCallBack = param["isClickCallBack"] as? Bool { + team.isClickCallBack = isClickCallBack + } + nav.pushViewController(team, animated: true) } } diff --git a/NEContactUIKit/NEContactUIKit/Classes/FunUI/ViewController/FunContactRemakNameViewController.swift b/NEContactUIKit/NEContactUIKit/Classes/FunUI/ViewController/FunContactRemakNameViewController.swift index 7d919774..306847c9 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/FunUI/ViewController/FunContactRemakNameViewController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/FunUI/ViewController/FunContactRemakNameViewController.swift @@ -19,7 +19,7 @@ open class FunContactRemakNameViewController: NEBaseContactRemakNameViewControll clearItem.tintColor = .funContactThemeColor navigationItem.rightBarButtonItem = clearItem - customNavigationView.moreButton.setTitleColor(.funContactThemeColor, for: .normal) + navigationView.moreButton.setTitleColor(.funContactThemeColor, for: .normal) NSLayoutConstraint.activate([ aliasInput.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 0), diff --git a/NEContactUIKit/NEContactUIKit/Classes/FunUI/ViewController/FunContactUserViewController.swift b/NEContactUIKit/NEContactUIKit/Classes/FunUI/ViewController/FunContactUserViewController.swift index 650bec76..904d4bcc 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/FunUI/ViewController/FunContactUserViewController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/FunUI/ViewController/FunContactUserViewController.swift @@ -61,7 +61,7 @@ open class FunContactUserViewController: NEBaseContactUserViewController { } override public func deleteFriend(user: User?) { - let titleAction = NECustomAlertAction(title: localizable("delete_title").replacingOccurrences(of: "XXX", with: user?.showName(true) ?? "")) {} + let titleAction = NECustomAlertAction(title: String(format: localizable("delete_title"), user?.showName(true) ?? "")) {} titleAction.contentText.font = .systemFont(ofSize: 13) titleAction.contentText.textColor = UIColor(hexString: "#8F8F8F") diff --git a/NEContactUIKit/NEContactUIKit/Classes/FunUI/ViewController/FunContactsSelectedViewController.swift b/NEContactUIKit/NEContactUIKit/Classes/FunUI/ViewController/FunContactsSelectedViewController.swift index c6d53d1f..4436ca01 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/FunUI/ViewController/FunContactsSelectedViewController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/FunUI/ViewController/FunContactsSelectedViewController.swift @@ -32,7 +32,7 @@ open class FunContactsSelectedViewController: NEBaseContactsSelectedViewControll override open func setupNavRightItem() { super.setupNavRightItem() - customNavigationView.moreButton.backgroundColor = .funContactThemeColor + navigationView.moreButton.backgroundColor = .funContactThemeColor sureBtn.backgroundColor = .funContactThemeColor } @@ -41,7 +41,7 @@ open class FunContactsSelectedViewController: NEBaseContactsSelectedViewControll .dequeueReusableHeaderFooterView( withIdentifier: "\(NSStringFromClass(ContactSectionView.self))" ) as! ContactSectionView - sectionView.titleLabel.textColor = NEKitContactConfig.shared.ui.indexTitleColor ?? .ne_greyText + sectionView.titleLabel.textColor = NEKitContactConfig.shared.ui.contactProperties.indexTitleColor ?? .ne_greyText sectionView.line.isHidden = true sectionView.titleLabel.text = viewModel.contacts[section].initial return sectionView diff --git a/NEContactUIKit/NEContactUIKit/Classes/FunUI/ViewController/FunContactsViewController.swift b/NEContactUIKit/NEContactUIKit/Classes/FunUI/ViewController/FunContactsViewController.swift index 2deb6ac9..7b212dcd 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/FunUI/ViewController/FunContactsViewController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/FunUI/ViewController/FunContactsViewController.swift @@ -18,27 +18,38 @@ open class FunContactsViewController: NEBaseContactsViewController { override public init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { super.init(nibName: nil, bundle: nil) - viewModel = ContactViewModel(contactHeaders: [ - ContactHeadItem( - name: localizable("validation_message"), - imageName: "funValid", - router: ValidationMessageRouter, - color: UIColor(hexString: "#60CFA7") - ), - ContactHeadItem( - name: localizable("blacklist"), - imageName: "funBlackName", - router: ContactBlackListRouter, - color: UIColor(hexString: "#53C3F3") - ), - ContactHeadItem( - name: localizable("mine_groupchat"), - imageName: "funGroup", - router: ContactGroupRouter, - color: UIColor(hexString: "#BE65D9") - ), - ]) - customCells = [ + var contactHeaders = [ContactHeadItem]() + if NEKitContactConfig.shared.ui.showHeader { + contactHeaders = [ + ContactHeadItem( + name: localizable("validation_message"), + imageName: "funValid", + router: ValidationMessageRouter, + color: UIColor(hexString: "#60CFA7") + ), + ContactHeadItem( + name: localizable("blacklist"), + imageName: "funBlackName", + router: ContactBlackListRouter, + color: UIColor(hexString: "#53C3F3") + ), + ] + + if IMKitClient.instance.getConfigCenter().teamEnable { + contactHeaders.append(ContactHeadItem( + name: localizable("mine_groupchat"), + imageName: "funGroup", + router: ContactTeamListRouter, + color: UIColor(hexString: "#BE65D9") + )) + } + + if let headerDataCallback = NEKitContactConfig.shared.ui.headerData { + headerDataCallback(contactHeaders) + } + } + viewModel = ContactViewModel(contactHeaders: contactHeaders) + cellRegisterDic = [ ContactCellType.ContactPerson.rawValue: FunContactTableViewCell.self, ContactCellType.ContactOthers.rawValue: FunContactTableViewCell.self, ] @@ -48,11 +59,6 @@ open class FunContactsViewController: NEBaseContactsViewController { super.init(coder: coder) } - override open func viewDidLoad() { - super.viewDidLoad() - view.backgroundColor = .funContactBackgroundColor - } - deinit { if let searchViewGestures = searchView.gestureRecognizers { searchViewGestures.forEach { gesture in @@ -63,24 +69,20 @@ open class FunContactsViewController: NEBaseContactsViewController { override open func commonUI() { super.commonUI() + view.backgroundColor = .funContactBackgroundColor let tap = UITapGestureRecognizer(target: self, action: #selector(searchAction)) tap.cancelsTouchesInView = false searchView.addGestureRecognizer(tap) - view.addSubview(searchView) + bodyTopView.addSubview(searchView) + bodyTopViewHeight = 60 NSLayoutConstraint.activate([ - searchView.topAnchor.constraint(equalTo: view.topAnchor, constant: topConstant + 12), - searchView.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 8), - searchView.rightAnchor.constraint(equalTo: view.rightAnchor, constant: -8), + searchView.topAnchor.constraint(equalTo: bodyTopView.topAnchor, constant: 12), + searchView.leftAnchor.constraint(equalTo: bodyTopView.leftAnchor, constant: 8), + searchView.rightAnchor.constraint(equalTo: bodyTopView.rightAnchor, constant: -8), searchView.heightAnchor.constraint(equalToConstant: 36), ]) - NSLayoutConstraint.activate([ - topView.topAnchor.constraint(equalTo: searchView.bottomAnchor, constant: 12), - topView.leftAnchor.constraint(equalTo: view.leftAnchor), - topView.rightAnchor.constraint(equalTo: view.rightAnchor), - ]) - tableView.backgroundColor = .clear tableView.register( @@ -88,7 +90,7 @@ open class FunContactsViewController: NEBaseContactsViewController { forHeaderFooterViewReuseIdentifier: "\(NSStringFromClass(ContactSectionView.self))" ) - customCells.forEach { (key: Int, value: NEBaseContactTableViewCell.Type) in + cellRegisterDic.forEach { (key: Int, value: NEBaseContactTableViewCell.Type) in tableView.register(value, forCellReuseIdentifier: "\(key)") } @@ -121,51 +123,6 @@ open class FunContactsViewController: NEBaseContactsViewController { 64 } - override open func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - let info = viewModel.contacts[indexPath.section].contacts[indexPath.row] - if let callBack = clickCallBacks[info.contactCellType] { - callBack(indexPath.row, indexPath.section) - return - } - if info.contactCellType == ContactCellType.ContactOthers.rawValue { - switch info.router { - case ValidationMessageRouter: - let validationController = FunValidationMessageViewController() - validationController.hidesBottomBarWhenPushed = true - navigationController?.pushViewController(validationController, animated: true) - case ContactBlackListRouter: - let blackVC = FunBlackListViewController() - blackVC.hidesBottomBarWhenPushed = true - navigationController?.pushViewController(blackVC, animated: true) - - case ContactGroupRouter: - // My Team - let teamVC = FunTeamListViewController() - teamVC.hidesBottomBarWhenPushed = true - navigationController?.pushViewController(teamVC, animated: true) - - case ContactPersonRouter: - - break - - case ContactComputerRouter: - // let select = ContactsSelectedViewController() - // select.CallBack = { contacts in - // print("select contacs : ", contacts) - // } - // select.hidesBottomBarWhenPushed = true - // self.navigationController?.pushViewController(select, animated: true) - break - default: - break - } - } else { - let userInfoVC = FunContactUserViewController(user: info.user) - userInfoVC.hidesBottomBarWhenPushed = true - navigationController?.pushViewController(userInfoVC, animated: true) - } - } - override open func getFindFriendViewController() -> NEBaseFindFriendViewController { FunFindFriendViewController() } @@ -175,7 +132,7 @@ extension FunContactsViewController { override open func initSystemNav() { edgesForExtendedLayout = [] let addItem = UIBarButtonItem( - image: UIImage.ne_imageNamed(name: "funAdd"), + image: NEKitContactConfig.shared.ui.titleBarRightRes ?? UIImage.ne_imageNamed(name: "funAdd"), style: .plain, target: self, action: #selector(goToFindFriend) @@ -183,19 +140,19 @@ extension FunContactsViewController { addItem.tintColor = UIColor(hexString: "333333") navigationItem.rightBarButtonItems = [addItem] - navView.addBtn.setImage(UIImage.ne_imageNamed(name: "funAdd"), for: .normal) + navigationView.addBtn.setImage(UIImage.ne_imageNamed(name: "funAdd"), for: .normal) - if NEKitContactConfig.shared.ui.hiddenRightBtns { + if !NEKitContactConfig.shared.ui.showTitleBarRightIcon { navigationItem.rightBarButtonItems = [] - navView.addBtn.isHidden = true + navigationView.addBtn.isHidden = true } title = localizable("contact") - navView.navigationTitle.text = localizable("contact") - navView.backgroundColor = .funContactBackgroundColor - navView.bottomLine.isHidden = true - navView.brandBtn.isHidden = true - navView.navigationTitle.isHidden = false - navView.searchBtn.isHidden = true + navigationView.navigationTitle.text = localizable("contact") + navigationView.backgroundColor = .funContactBackgroundColor + navigationView.titleBarBottomLine.isHidden = true + navigationView.brandBtn.isHidden = true + navigationView.navigationTitle.isHidden = false + navigationView.searchBtn.isHidden = true } } diff --git a/NEContactUIKit/NEContactUIKit/Classes/FunUI/ViewController/FunValidationMessageViewController.swift b/NEContactUIKit/NEContactUIKit/Classes/FunUI/ViewController/FunValidationMessageViewController.swift index 9b38c77f..baa49432 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/FunUI/ViewController/FunValidationMessageViewController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/FunUI/ViewController/FunValidationMessageViewController.swift @@ -32,7 +32,7 @@ open class FunValidationMessageViewController: NEBaseValidationMessageViewContro clearItem.setTitleTextAttributes(textAttributes, for: .normal) navigationItem.rightBarButtonItem = clearItem - customNavigationView.moreButton.titleLabel?.font = .systemFont(ofSize: 16) + navigationView.moreButton.titleLabel?.font = .systemFont(ofSize: 16) tableView.register( FunSystemNotificationCell.self, diff --git a/NEContactUIKit/NEContactUIKit/Classes/NormalUI/Cell/ContactSelectedCell.swift b/NEContactUIKit/NEContactUIKit/Classes/NormalUI/Cell/ContactSelectedCell.swift index 7638e4ce..bfc10d15 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/NormalUI/Cell/ContactSelectedCell.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/NormalUI/Cell/ContactSelectedCell.swift @@ -17,7 +17,7 @@ open class ContactSelectedCell: NEBaseContactSelectedCell { override open func setConfig() { super.setConfig() - titleLabel.font = NEKitContactConfig.shared.ui.titleFont ?? UIFont.systemFont(ofSize: 14) + titleLabel.font = .systemFont(ofSize: NEKitContactConfig.shared.ui.contactProperties.itemTitleSize > 0 ? NEKitContactConfig.shared.ui.contactProperties.itemTitleSize : 14) } override open func setupCommonCircleHeader() { diff --git a/NEContactUIKit/NEContactUIKit/Classes/NormalUI/Cell/ContactTableViewCell.swift b/NEContactUIKit/NEContactUIKit/Classes/NormalUI/Cell/ContactTableViewCell.swift index 954fd8f4..ba12e5db 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/NormalUI/Cell/ContactTableViewCell.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/NormalUI/Cell/ContactTableViewCell.swift @@ -12,7 +12,7 @@ import UIKit open class ContactTableViewCell: NEBaseContactTableViewCell { override open func setConfig() { super.setConfig() - titleLabel.font = NEKitContactConfig.shared.ui.titleFont ?? UIFont.systemFont(ofSize: 14) + titleLabel.font = .systemFont(ofSize: NEKitContactConfig.shared.ui.contactProperties.itemTitleSize > 0 ? NEKitContactConfig.shared.ui.contactProperties.itemTitleSize : 14) } override open func commonUI() { diff --git a/NEContactUIKit/NEContactUIKit/Classes/NormalUI/NromalContactRouter.swift b/NEContactUIKit/NEContactUIKit/Classes/NormalUI/NromalContactRouter.swift index 38433150..601161a6 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/NormalUI/NromalContactRouter.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/NormalUI/NromalContactRouter.swift @@ -47,10 +47,35 @@ public extension ContactRouter { } } + Router.shared.register(ContactPageRouter) { param in + if let nav = param["nav"] as? UINavigationController { + let contactVC = ContactsViewController() + nav.pushViewController(contactVC, animated: true) + } + } + + Router.shared.register(ValidationMessageRouter) { param in + if let nav = param["nav"] as? UINavigationController { + let validationController = ValidationMessageViewController() + nav.pushViewController(validationController, animated: true) + } + } + + Router.shared.register(ContactBlackListRouter) { param in + if let nav = param["nav"] as? UINavigationController { + let blackVC = BlackListViewController() + nav.pushViewController(blackVC, animated: true) + } + } + Router.shared.register(ContactTeamListRouter) { param in if let nav = param["nav"] as? UINavigationController { let team = TeamListViewController() - team.isClickCallBack = true + + if let isClickCallBack = param["isClickCallBack"] as? Bool { + team.isClickCallBack = isClickCallBack + } + nav.pushViewController(team, animated: true) } } diff --git a/NEContactUIKit/NEContactUIKit/Classes/NormalUI/ViewController/BlackListViewController.swift b/NEContactUIKit/NEContactUIKit/Classes/NormalUI/ViewController/BlackListViewController.swift index bf8ded50..b4b3e5e9 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/NormalUI/ViewController/BlackListViewController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/NormalUI/ViewController/BlackListViewController.swift @@ -13,7 +13,7 @@ open class BlackListViewController: NEBaseBlackListViewController { override public init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) className = "BlackListViewController" - customNavigationView.backgroundColor = .white + navigationView.backgroundColor = .white navigationController?.navigationBar.backgroundColor = .white } diff --git a/NEContactUIKit/NEContactUIKit/Classes/NormalUI/ViewController/ContactsSelectedViewController.swift b/NEContactUIKit/NEContactUIKit/Classes/NormalUI/ViewController/ContactsSelectedViewController.swift index 298c8805..71928f50 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/NormalUI/ViewController/ContactsSelectedViewController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/NormalUI/ViewController/ContactsSelectedViewController.swift @@ -12,7 +12,7 @@ open class ContactsSelectedViewController: NEBaseContactsSelectedViewController super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) customCells = [ContactCellType.ContactPerson.rawValue: ContactSelectedCell.self] view.backgroundColor = .ne_backcolor - customNavigationView.backgroundColor = .white + navigationView.backgroundColor = .white navigationController?.navigationBar.backgroundColor = .white } @@ -32,8 +32,8 @@ open class ContactsSelectedViewController: NEBaseContactsSelectedViewController override open func setupNavRightItem() { super.setupNavRightItem() - customNavigationView.moreButton.backgroundColor = .white - customNavigationView.moreButton.setTitleColor(UIColor(hexString: "337EFF"), for: .normal) + navigationView.moreButton.backgroundColor = .white + navigationView.moreButton.setTitleColor(UIColor(hexString: "337EFF"), for: .normal) sureBtn.backgroundColor = .white sureBtn.setTitleColor(UIColor(hexString: "337EFF"), for: .normal) } diff --git a/NEContactUIKit/NEContactUIKit/Classes/NormalUI/ViewController/ContactsViewController.swift b/NEContactUIKit/NEContactUIKit/Classes/NormalUI/ViewController/ContactsViewController.swift index 438d8a9f..e93b878c 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/NormalUI/ViewController/ContactsViewController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/NormalUI/ViewController/ContactsViewController.swift @@ -10,27 +10,38 @@ import UIKit open class ContactsViewController: NEBaseContactsViewController { override public init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { super.init(nibName: nil, bundle: nil) - viewModel = ContactViewModel(contactHeaders: [ - ContactHeadItem( - name: localizable("validation_message"), - imageName: "valid", - router: ValidationMessageRouter, - color: UIColor(hexString: "#60CFA7") - ), - ContactHeadItem( - name: localizable("blacklist"), - imageName: "blackName", - router: ContactBlackListRouter, - color: UIColor(hexString: "#53C3F3") - ), - ContactHeadItem( - name: localizable("mine_groupchat"), - imageName: "group", - router: ContactGroupRouter, - color: UIColor(hexString: "#BE65D9") - ), - ]) - customCells = [ + var contactHeaders = [ContactHeadItem]() + if NEKitContactConfig.shared.ui.showHeader { + contactHeaders = [ + ContactHeadItem( + name: localizable("validation_message"), + imageName: "valid", + router: ValidationMessageRouter, + color: UIColor(hexString: "#60CFA7") + ), + ContactHeadItem( + name: localizable("blacklist"), + imageName: "blackName", + router: ContactBlackListRouter, + color: UIColor(hexString: "#53C3F3") + ), + ] + + if IMKitClient.instance.getConfigCenter().teamEnable { + contactHeaders.append(ContactHeadItem( + name: localizable("mine_groupchat"), + imageName: "group", + router: ContactTeamListRouter, + color: UIColor(hexString: "#BE65D9") + )) + } + + if let headerDataCallback = NEKitContactConfig.shared.ui.headerData { + headerDataCallback(contactHeaders) + } + } + viewModel = ContactViewModel(contactHeaders: contactHeaders) + cellRegisterDic = [ ContactCellType.ContactPerson.rawValue: ContactTableViewCell.self, ContactCellType.ContactOthers.rawValue: ContactTableViewCell.self, ] @@ -40,26 +51,15 @@ open class ContactsViewController: NEBaseContactsViewController { super.init(coder: coder) } - override open func viewDidLoad() { - super.viewDidLoad() - commonUI() - } - override open func commonUI() { super.commonUI() - NSLayoutConstraint.activate([ - topView.topAnchor.constraint(equalTo: view.topAnchor, constant: topConstant), - topView.leftAnchor.constraint(equalTo: view.leftAnchor), - topView.rightAnchor.constraint(equalTo: view.rightAnchor), - ]) - tableView.register( ContactSectionView.self, forHeaderFooterViewReuseIdentifier: "\(NSStringFromClass(ContactSectionView.self))" ) - customCells.forEach { (key: Int, value: NEBaseContactTableViewCell.Type) in + cellRegisterDic.forEach { (key: Int, value: NEBaseContactTableViewCell.Type) in tableView.register(value, forCellReuseIdentifier: "\(key)") } } @@ -79,65 +79,20 @@ open class ContactsViewController: NEBaseContactsViewController { } return cell } - - override open func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - let info = viewModel.contacts[indexPath.section].contacts[indexPath.row] - if let callBack = clickCallBacks[info.contactCellType] { - callBack(indexPath.row, indexPath.section) - return - } - if info.contactCellType == ContactCellType.ContactOthers.rawValue { - switch info.router { - case ValidationMessageRouter: - let validationController = ValidationMessageViewController() - validationController.hidesBottomBarWhenPushed = true - navigationController?.pushViewController(validationController, animated: true) - case ContactBlackListRouter: - let blackVC = BlackListViewController() - blackVC.hidesBottomBarWhenPushed = true - navigationController?.pushViewController(blackVC, animated: true) - - case ContactGroupRouter: - // My Team - let teamVC = TeamListViewController() - teamVC.hidesBottomBarWhenPushed = true - navigationController?.pushViewController(teamVC, animated: true) - - case ContactPersonRouter: - - break - - case ContactComputerRouter: - // let select = ContactsSelectedViewController() - // select.CallBack = { contacts in - // print("select contacs : ", contacts) - // } - // select.hidesBottomBarWhenPushed = true - // self.navigationController?.pushViewController(select, animated: true) - break - default: - break - } - } else { - let userInfoVC = ContactUserViewController(user: info.user) - userInfoVC.hidesBottomBarWhenPushed = true - navigationController?.pushViewController(userInfoVC, animated: true) - } - } } extension ContactsViewController { override open func initSystemNav() { super.initSystemNav() let addItem = UIBarButtonItem( - image: UIImage.ne_imageNamed(name: "add"), + image: NEKitContactConfig.shared.ui.titleBarRightRes ?? UIImage.ne_imageNamed(name: "add"), style: .plain, target: self, action: #selector(goToFindFriend) ) addItem.tintColor = UIColor(hexString: "333333") let searchItem = UIBarButtonItem( - image: UIImage.ne_imageNamed(name: "contact_search"), + image: NEKitContactConfig.shared.ui.titleBarRight2Res ?? UIImage.ne_imageNamed(name: "contact_search"), style: .plain, target: self, action: #selector(searchContact) @@ -146,25 +101,25 @@ extension ContactsViewController { searchItem.tintColor = UIColor(hexString: "333333") navigationItem.rightBarButtonItems = [addItem, searchItem] - if NEKitContactConfig.shared.ui.hiddenSearchBtn { + if !NEKitContactConfig.shared.ui.showTitleBarRight2Icon { navigationItem.rightBarButtonItems = [addItem] - navView.searchBtn.isHidden = true + navigationView.searchBtn.isHidden = true } - if NEKitContactConfig.shared.ui.hiddenRightBtns { - navigationItem.rightBarButtonItems = [] - navView.searchBtn.isHidden = true - navView.addBtn.isHidden = true + if !NEKitContactConfig.shared.ui.showTitleBarRightIcon { + navigationItem.rightBarButtonItems = [searchItem] + navigationView.addBtn.isHidden = true } let brandBarBtn = UIButton() - brandBarBtn.setTitle(localizable("contact"), for: .normal) - brandBarBtn.setTitleColor(UIColor.black, for: .normal) + brandBarBtn.setTitle(NEKitContactConfig.shared.ui.title ?? localizable("contact"), for: .normal) + brandBarBtn.setTitleColor(NEKitContactConfig.shared.ui.titleColor ?? UIColor.black, for: .normal) brandBarBtn.titleLabel?.font = NEConstant.textFont("PingFangSC-Medium", 20) let brandBtn = UIBarButtonItem(customView: brandBarBtn) navigationItem.leftBarButtonItem = brandBtn - navView.brandBtn.setImage(nil, for: .normal) - navView.brandBtn.setTitle(localizable("contact"), for: .normal) - navView.brandBtn.titleEdgeInsets = UIEdgeInsets.zero + navigationView.brandBtn.setImage(nil, for: .normal) + navigationView.brandBtn.setTitle(NEKitContactConfig.shared.ui.title ?? localizable("contact"), for: .normal) + navigationView.brandBtn.setTitleColor(NEKitContactConfig.shared.ui.titleColor ?? UIColor.black, for: .normal) + navigationView.brandBtn.titleEdgeInsets = UIEdgeInsets.zero } } diff --git a/NEContactUIKit/NEContactUIKit/Classes/NormalUI/ViewController/FindFriendViewController.swift b/NEContactUIKit/NEContactUIKit/Classes/NormalUI/ViewController/FindFriendViewController.swift index b4e2a2b8..a5a6f29e 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/NormalUI/ViewController/FindFriendViewController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/NormalUI/ViewController/FindFriendViewController.swift @@ -8,7 +8,7 @@ import UIKit open class FindFriendViewController: NEBaseFindFriendViewController { override public init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) - customNavigationView.backgroundColor = .white + navigationView.backgroundColor = .white navigationController?.navigationBar.backgroundColor = .white } diff --git a/NEContactUIKit/NEContactUIKit/Classes/NormalUI/ViewController/TeamListViewController.swift b/NEContactUIKit/NEContactUIKit/Classes/NormalUI/ViewController/TeamListViewController.swift index 50d0be12..de64abf2 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/NormalUI/ViewController/TeamListViewController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/NormalUI/ViewController/TeamListViewController.swift @@ -11,7 +11,7 @@ import UIKit open class TeamListViewController: NEBaseTeamListViewController { override func commonUI() { super.commonUI() - customNavigationView.backgroundColor = .white + navigationView.backgroundColor = .white navigationController?.navigationBar.backgroundColor = .white tableView.register( TeamTableViewCell.self, diff --git a/NEContactUIKit/NEContactUIKit/Classes/NormalUI/ViewController/ValidationMessageViewController.swift b/NEContactUIKit/NEContactUIKit/Classes/NormalUI/ViewController/ValidationMessageViewController.swift index 8432d477..22b9487d 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/NormalUI/ViewController/ValidationMessageViewController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/NormalUI/ViewController/ValidationMessageViewController.swift @@ -12,7 +12,7 @@ open class ValidationMessageViewController: NEBaseValidationMessageViewControlle override public init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) tag = "ValidationMessageViewController" - customNavigationView.backgroundColor = .white + navigationView.backgroundColor = .white navigationController?.navigationBar.backgroundColor = .white } @@ -35,7 +35,7 @@ open class ValidationMessageViewController: NEBaseValidationMessageViewControlle clearItem.setTitleTextAttributes(textAttributes, for: .normal) navigationItem.rightBarButtonItem = clearItem - customNavigationView.moreButton.titleLabel?.font = .systemFont(ofSize: 16) + navigationView.moreButton.titleLabel?.font = .systemFont(ofSize: 16) tableView.register( SystemNotificationCell.self, diff --git a/NEContactUIKit/NEContactUIKit/Classes/Team/ViewController/NEBaseTeamListViewController.swift b/NEContactUIKit/NEContactUIKit/Classes/Team/ViewController/NEBaseTeamListViewController.swift index db875289..5588d158 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Team/ViewController/NEBaseTeamListViewController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Team/ViewController/NEBaseTeamListViewController.swift @@ -9,7 +9,7 @@ import UIKit @objcMembers open class NEBaseTeamListViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, UIGestureRecognizerDelegate { - public let customNavigationView = NENavigationView() + public let navigationView = NENavigationView() var tableView = UITableView(frame: .zero, style: .plain) var viewModel = TeamListViewModel() var isClickCallBack = false @@ -34,7 +34,7 @@ open class NEBaseTeamListViewController: UIViewController, UITableViewDelegate, func commonUI() { title = localizable("mine_groupchat") - customNavigationView.navTitle.text = title + navigationView.navTitle.text = title let image = UIImage.ne_imageNamed(name: "backArrow")?.withRenderingMode(.alwaysOriginal) let backItem = UIBarButtonItem( image: image, @@ -46,15 +46,15 @@ open class NEBaseTeamListViewController: UIViewController, UITableViewDelegate, navigationItem.leftBarButtonItem = backItem - customNavigationView.translatesAutoresizingMaskIntoConstraints = false - customNavigationView.addBackButtonTarget(target: self, selector: #selector(backEvent)) - customNavigationView.moreButton.isHidden = true - view.addSubview(customNavigationView) + navigationView.translatesAutoresizingMaskIntoConstraints = false + navigationView.addBackButtonTarget(target: self, selector: #selector(backEvent)) + navigationView.moreButton.isHidden = true + view.addSubview(navigationView) NSLayoutConstraint.activate([ - customNavigationView.leftAnchor.constraint(equalTo: view.leftAnchor), - customNavigationView.rightAnchor.constraint(equalTo: view.rightAnchor), - customNavigationView.topAnchor.constraint(equalTo: view.topAnchor), - customNavigationView.heightAnchor.constraint(equalToConstant: NEConstant.navigationAndStatusHeight), + navigationView.leftAnchor.constraint(equalTo: view.leftAnchor), + navigationView.rightAnchor.constraint(equalTo: view.rightAnchor), + navigationView.topAnchor.constraint(equalTo: view.topAnchor), + navigationView.heightAnchor.constraint(equalToConstant: NEConstant.navigationAndStatusHeight), ]) tableView.separatorStyle = .none diff --git a/NEContactUIKit/NEContactUIKit/Classes/UserInfo/Views/CenterTextCell.swift b/NEContactUIKit/NEContactUIKit/Classes/UserInfo/Views/CenterTextCell.swift index b6137a5f..06edabf2 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/UserInfo/Views/CenterTextCell.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/UserInfo/Views/CenterTextCell.swift @@ -15,6 +15,7 @@ open class CenterTextCell: UITableViewCell { titleLabel.translatesAutoresizingMaskIntoConstraints = false titleLabel.textColor = .red titleLabel.textAlignment = .center + titleLabel.accessibilityIdentifier = "id.titleLabel" contentView.addSubview(titleLabel) NSLayoutConstraint.activate([ titleLabel.leftAnchor.constraint(equalTo: contentView.leftAnchor, constant: 36), diff --git a/NEContactUIKit/NEContactUIKit/Classes/UserInfo/Views/TextWithDetailTextCell.swift b/NEContactUIKit/NEContactUIKit/Classes/UserInfo/Views/TextWithDetailTextCell.swift index d422ac69..1dbd77e4 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/UserInfo/Views/TextWithDetailTextCell.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/UserInfo/Views/TextWithDetailTextCell.swift @@ -14,6 +14,7 @@ open class TextWithDetailTextCell: ContactBaseTextCell { detailTitleLabel.font = UIFont.systemFont(ofSize: 12) detailTitleLabel.textColor = UIColor(hexString: "#A6ADB6") detailTitleLabel.textAlignment = .right + detailTitleLabel.accessibilityIdentifier = "id.detailTitleLabel" contentView.addSubview(detailTitleLabel) NSLayoutConstraint.activate([ detailTitleLabel.leftAnchor.constraint(equalTo: titleLabel.rightAnchor), diff --git a/NEContactUIKit/NEContactUIKit/Classes/UserInfo/Views/TextWithSwitchCell.swift b/NEContactUIKit/NEContactUIKit/Classes/UserInfo/Views/TextWithSwitchCell.swift index 6b4b44e6..65b51add 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/UserInfo/Views/TextWithSwitchCell.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/UserInfo/Views/TextWithSwitchCell.swift @@ -14,6 +14,7 @@ open class TextWithSwitchCell: ContactBaseTextCell { super.init(style: style, reuseIdentifier: reuseIdentifier) switchButton.translatesAutoresizingMaskIntoConstraints = false switchButton.onTintColor = UIColor(hexString: "#337EFF") + switchButton.accessibilityIdentifier = "id.tSwitch" switchButton.addTarget(self, action: #selector(valueChanged), for: .touchUpInside) contentView.addSubview(switchButton) diff --git a/NEContactUIKit/NEContactUIKit/Classes/Validation/Controller/NEBaseValidationMessageViewController.swift b/NEContactUIKit/NEContactUIKit/Classes/Validation/Controller/NEBaseValidationMessageViewController.swift index 264c22f6..a0c17c8f 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Validation/Controller/NEBaseValidationMessageViewController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Validation/Controller/NEBaseValidationMessageViewController.swift @@ -61,10 +61,10 @@ open class NEBaseValidationMessageViewController: NEBaseContactViewController { navigationItem.rightBarButtonItem = clearItem title = localizable("validation_message") - customNavigationView.navTitle.text = title - customNavigationView.setMoreButtonTitle(localizable("clear")) - customNavigationView.moreButton.setTitleColor(.ne_darkText, for: .normal) - customNavigationView.addMoreButtonTarget(target: self, selector: #selector(clearMessage)) + navigationView.navTitle.text = title + navigationView.setMoreButtonTitle(localizable("clear")) + navigationView.moreButton.setTitleColor(.ne_darkText, for: .normal) + navigationView.addMoreButtonTarget(target: self, selector: #selector(clearMessage)) tableView.translatesAutoresizingMaskIntoConstraints = false view.addSubview(tableView) diff --git a/NEContactUIKit/NEContactUIKit/Classes/Views/Cell/NEBaseContactTableViewCell.swift b/NEContactUIKit/NEContactUIKit/Classes/Views/Cell/NEBaseContactTableViewCell.swift index e049d2df..3fbc0b60 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Views/Cell/NEBaseContactTableViewCell.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Views/Cell/NEBaseContactTableViewCell.swift @@ -69,9 +69,9 @@ open class NEBaseContactTableViewCell: NEBaseContactViewCell, ContactCellDataPro } open func initSubviewsLayout() { - if NEKitContactConfig.shared.ui.avatarType == .rectangle { - avatarImage.layer.cornerRadius = NEKitContactConfig.shared.ui.avatarCornerRadius - } else if NEKitContactConfig.shared.ui.avatarType == .cycle { + if NEKitContactConfig.shared.ui.contactProperties.avatarType == .rectangle { + avatarImage.layer.cornerRadius = NEKitContactConfig.shared.ui.contactProperties.avatarCornerRadius + } else if NEKitContactConfig.shared.ui.contactProperties.avatarType == .cycle { avatarImage.layer.cornerRadius = 18.0 } else { avatarImage.layer.cornerRadius = 18.0 // Normal UI @@ -79,7 +79,7 @@ open class NEBaseContactTableViewCell: NEBaseContactViewCell, ContactCellDataPro } open func setConfig() { - titleLabel.textColor = NEKitContactConfig.shared.ui.titleColor + titleLabel.textColor = NEKitContactConfig.shared.ui.contactProperties.itemTitleColor nameLabel.font = UIFont.systemFont(ofSize: 14.0) nameLabel.textColor = UIColor.white } diff --git a/NEContactUIKit/NEContactUIKit/Classes/Views/ContactSectionView.swift b/NEContactUIKit/NEContactUIKit/Classes/Views/ContactSectionView.swift index 9e9fbd4e..0a5d6376 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Views/ContactSectionView.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Views/ContactSectionView.swift @@ -23,7 +23,7 @@ open class ContactSectionView: UITableViewHeaderFooterView { contentView.backgroundColor = .white titleLabel.translatesAutoresizingMaskIntoConstraints = false titleLabel.backgroundColor = .white - titleLabel.textColor = NEKitContactConfig.shared.ui.indexTitleColor ?? UIColor.ne_emptyTitleColor + titleLabel.textColor = NEKitContactConfig.shared.ui.contactProperties.indexTitleColor ?? UIColor.ne_emptyTitleColor titleLabel.font = UIFont.systemFont(ofSize: 14.0) contentView.addSubview(titleLabel) NSLayoutConstraint.activate([ @@ -34,7 +34,7 @@ open class ContactSectionView: UITableViewHeaderFooterView { ]) line.translatesAutoresizingMaskIntoConstraints = false - line.backgroundColor = NEKitContactConfig.shared.ui.divideLineColor + line.backgroundColor = NEKitContactConfig.shared.ui.contactProperties.divideLineColor contentView.addSubview(line) NSLayoutConstraint.activate([ line.leftAnchor.constraint(equalTo: titleLabel.leftAnchor), diff --git a/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactRemakNameViewController.swift b/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactRemakNameViewController.swift index 8a2715b8..a3cb1c48 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactRemakNameViewController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactRemakNameViewController.swift @@ -49,11 +49,12 @@ open class NEBaseContactRemakNameViewController: NEBaseContactViewController, UI func setupUI() { title = localizable("noteName") - customNavigationView.navTitle.text = title - view.backgroundColor = UIColor(hexString: "F2F4F5") + navigationView.navTitle.text = title + view.backgroundColor = .ne_lightBackgroundColor - customNavigationView.setMoreButtonTitle(localizable("save")) - customNavigationView.addMoreButtonTarget(target: self, selector: #selector(saveAlias)) + navigationView.setMoreButtonTitle(localizable("save")) + navigationView.addMoreButtonTarget(target: self, selector: #selector(saveAlias)) + navigationView.backgroundColor = .ne_lightBackgroundColor view.addSubview(aliasInput) aliasInput.placeholder = localizable("input_noteName") diff --git a/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactUserViewController.swift b/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactUserViewController.swift index 7a39d028..01ba9f47 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactUserViewController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactUserViewController.swift @@ -67,7 +67,7 @@ open class NEBaseContactUserViewController: NEBaseContactViewController, UITable open func commonUI() { navigationController?.navigationBar.backgroundColor = .white - customNavigationView.backgroundColor = .white + navigationView.backgroundColor = .white tableView.separatorStyle = .none tableView.delegate = self @@ -205,18 +205,8 @@ open class NEBaseContactUserViewController: NEBaseContactViewController, UITable c.titleLabel.text = item.title c.detailTitleLabel.text = item.detailTitle if item.title == localizable("sign") { - c.detailTitleLabel.accessibilityIdentifier = "id.signature" c.detailTitleLabel.numberOfLines = 2 } - if item.title == localizable("email") { - c.detailTitleLabel.accessibilityIdentifier = "id.email" - } - if item.title == localizable("phone") { - c.detailTitleLabel.accessibilityIdentifier = "id.phone" - } - if item.title == localizable("birthday") { - c.detailTitleLabel.accessibilityIdentifier = "id.birthday" - } return c } @@ -226,7 +216,6 @@ open class NEBaseContactUserViewController: NEBaseContactViewController, UITable c.block = { [weak self] title, value in print("title:\(title) value\(value)") if title == localizable("add_blackList") { - c.switchButton.accessibilityIdentifier = "id.blackList" self?.blackList(isBlack: value) { c.switchButton.isOn = !c.switchButton.isOn } @@ -239,15 +228,6 @@ open class NEBaseContactUserViewController: NEBaseContactViewController, UITable if let c = cell as? CenterTextCell { c.titleLabel.text = item.title c.titleLabel.textColor = item.textColor - if item.title == localizable("chat") { - c.titleLabel.accessibilityIdentifier = "id.chat" - } - if item.title == localizable("delete_friend") { - c.titleLabel.accessibilityIdentifier = "id.delete" - } - if item.title == localizable("add_friend") { - c.titleLabel.accessibilityIdentifier = "id.chat" - } return c } return cell @@ -360,16 +340,20 @@ open class NEBaseContactUserViewController: NEBaseContactViewController, UITable } func chat(user: User?) { - print("edit remarks") guard let accid = self.user?.userId else { return } let session = NIMSession(accid, type: .P2P) Router.shared.use( PushP2pChatVCRouter, - parameters: ["nav": navigationController, "session": session] - ) { obj, routerState, str in - print("obj:\(obj) routerState:\(routerState) str:\(str)") + parameters: ["nav": navigationController as Any, "session": session], + closure: nil + ) + + // 移除当前页面 + if let selfVCIndex = navigationController?.viewControllers.firstIndex(of: self), + selfVCIndex > 0 { + navigationController?.viewControllers.remove(at: selfVCIndex) } } @@ -395,13 +379,13 @@ open class NEBaseContactUserViewController: NEBaseContactViewController, UITable } open func deleteFriend(user: User?) { - let alertTitle = localizable("delete_title").replacingOccurrences(of: "XXX", with: user?.showName(true) ?? "") + let alertTitle = String(format: localizable("delete_title"), user?.showName(true) ?? "") let alertController = UIAlertController( title: alertTitle, message: nil, preferredStyle: .actionSheet ) - alertController.getUILabel(string: alertTitle)?.accessibilityIdentifier = "id.title" + alertController.view.findLabel(with: alertTitle)?.accessibilityIdentifier = "id.action1" let cancelAction = UIAlertAction( title: commonLocalizable("cancel"), @@ -409,14 +393,14 @@ open class NEBaseContactUserViewController: NEBaseContactViewController, UITable handler: nil ) cancelAction.setValue(UIColor.ne_darkText, forKey: "_titleTextColor") - cancelAction.accessibilityIdentifier = "id.negative" + cancelAction.accessibilityIdentifier = "id.action3" let deleteAction = UIAlertAction(title: localizable("delete_friend"), style: .default) { [weak self] action in self?.deleteFriendAction(user: user) } deleteAction.setValue(UIColor.ne_redText, forKey: "_titleTextColor") - deleteAction.accessibilityIdentifier = "id.positive" + deleteAction.accessibilityIdentifier = "id.action2" alertController.addAction(cancelAction) alertController.addAction(deleteAction) diff --git a/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactViewController.swift b/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactViewController.swift index 4ef8cde6..0cf505a0 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactViewController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactViewController.swift @@ -8,7 +8,7 @@ import UIKit @objcMembers open class NEBaseContactViewController: UIViewController, UIGestureRecognizerDelegate { var topConstant: CGFloat = 0 - public let customNavigationView = NENavigationView() + public let navigationView = NENavigationView() public lazy var emptyView: NEEmptyDataView = { let view = NEEmptyDataView( @@ -37,15 +37,15 @@ open class NEBaseContactViewController: UIViewController, UIGestureRecognizerDel } else { navigationController?.isNavigationBarHidden = true topConstant = NEConstant.navigationAndStatusHeight - customNavigationView.translatesAutoresizingMaskIntoConstraints = false - customNavigationView.addBackButtonTarget(target: self, selector: #selector(backToPrevious)) - customNavigationView.moreButton.isHidden = true - view.addSubview(customNavigationView) + navigationView.translatesAutoresizingMaskIntoConstraints = false + navigationView.addBackButtonTarget(target: self, selector: #selector(backToPrevious)) + navigationView.moreButton.isHidden = true + view.addSubview(navigationView) NSLayoutConstraint.activate([ - customNavigationView.leftAnchor.constraint(equalTo: view.leftAnchor), - customNavigationView.rightAnchor.constraint(equalTo: view.rightAnchor), - customNavigationView.topAnchor.constraint(equalTo: view.topAnchor), - customNavigationView.heightAnchor.constraint(equalToConstant: topConstant), + navigationView.leftAnchor.constraint(equalTo: view.leftAnchor), + navigationView.rightAnchor.constraint(equalTo: view.rightAnchor), + navigationView.topAnchor.constraint(equalTo: view.topAnchor), + navigationView.heightAnchor.constraint(equalToConstant: topConstant), ]) } } diff --git a/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactsSelectedViewController.swift b/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactsSelectedViewController.swift index b21a4cb6..41b99150 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactsSelectedViewController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactsSelectedViewController.swift @@ -80,7 +80,7 @@ open class NEBaseContactsSelectedViewController: NEBaseContactViewController, UI override open func viewDidLoad() { super.viewDidLoad() title = localizable("select") - customNavigationView.navTitle.text = title + navigationView.navTitle.text = title emptyView.settingContent(content: localizable("no_friend")) setupUI() setupNavRightItem() @@ -152,14 +152,14 @@ open class NEBaseContactsSelectedViewController: NEBaseContactViewController, UI sureBtn.contentHorizontalAlignment = .center sureBtn.titleLabel?.font = UIFont.systemFont(ofSize: 16.0) } else { - customNavigationView.setMoreButtonTitle(localizable("alert_sure")) - customNavigationView.moreButton.setTitleColor(.white, for: .normal) - customNavigationView.moreButton.layer.cornerRadius = 4 - customNavigationView.moreButton.contentHorizontalAlignment = .center - customNavigationView.addMoreButtonTarget(target: self, selector: #selector(sureClick(_:))) - customNavigationView.setBackButtonTitle(localizable("close")) - customNavigationView.backButton.setTitleColor(.ne_darkText, for: .normal) - sureBtn = customNavigationView.moreButton + navigationView.setMoreButtonTitle(localizable("alert_sure")) + navigationView.moreButton.setTitleColor(.white, for: .normal) + navigationView.moreButton.layer.cornerRadius = 4 + navigationView.moreButton.contentHorizontalAlignment = .center + navigationView.addMoreButtonTarget(target: self, selector: #selector(sureClick(_:))) + navigationView.setBackButtonTitle(localizable("close")) + navigationView.backButton.setTitleColor(.ne_darkText, for: .normal) + sureBtn = navigationView.moreButton } } diff --git a/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactsViewController.swift b/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactsViewController.swift index c17cec88..25c53333 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactsViewController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseContactsViewController.swift @@ -7,70 +7,39 @@ import NECoreKit import UIKit @objc -public protocol ContactsViewControllerDelegate { +public protocol NEBaseContactsViewControllerDelegate { func onDataLoaded() } @objcMembers open class NEBaseContactsViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, SystemMessageProviderDelegate, FriendProviderDelegate, TabNavigationViewDelegate { - public var delegate: ContactsViewControllerDelegate? + public var delegate: NEBaseContactsViewControllerDelegate? // custom ui cell - public var customCells = [Int: NEBaseContactTableViewCell.Type]() + public var cellRegisterDic = [Int: NEBaseContactTableViewCell.Type]() - public var clickCallBacks = [Int: ContactClickCallBack]() - var lastTitleIndex = 0 - - public lazy var navView: TabNavigationView = { - let nav = TabNavigationView(frame: CGRect.zero) - nav.translatesAutoresizingMaskIntoConstraints = false - nav.delegate = self - return nav - }() - - public var topConstant: CGFloat = 0 + public var viewModel = ContactViewModel(contactHeaders: nil) + private var lastTitleIndex = 0 - public var topViewHeight: CGFloat = 0 { + public var bodyTopViewHeight: CGFloat = 0 { didSet { - topViewHeightAnchor?.constant = topViewHeight - topView.isHidden = topViewHeight <= 0 + bodyTopViewHeightAnchor?.constant = bodyTopViewHeight + bodyTopView.isHidden = bodyTopViewHeight <= 0 } } - public var topViewHeightAnchor: NSLayoutConstraint? - public lazy var topView: UIView = { - let view = UIView() - view.translatesAutoresizingMaskIntoConstraints = false - view.backgroundColor = .clear - return view - }() - - public lazy var tableView: UITableView = { - let tableView = UITableView(frame: .zero, style: .grouped) - tableView.translatesAutoresizingMaskIntoConstraints = false - tableView.separatorStyle = .none - tableView.delegate = self - tableView.dataSource = self - tableView.backgroundColor = UIColor.ne_backgroundColor - tableView.rowHeight = 52 - tableView.sectionHeaderHeight = 40 - tableView.sectionFooterHeight = 0 - tableView.sectionIndexColor = .ne_greyText - - tableView.tableHeaderView = UIView(frame: CGRect(x: 0, y: 0, width: 0, height: 0.1)) - return tableView - }() + public var bodyBottomViewHeight: CGFloat = 0 { + didSet { + bodyBottomViewHeightAnchor?.constant = bodyBottomViewHeight + bodyBottomView.isHidden = bodyBottomViewHeight <= 0 + } + } - lazy var emptyView: NEEmptyDataView = { - let view = NEEmptyDataView(imageName: "user_empty", content: localizable("no_friend"), frame: .zero) - view.translatesAutoresizingMaskIntoConstraints = false - view.backgroundColor = .clear - view.isHidden = true - return view - }() + public var topConstant: CGFloat = 0 + private var bodyTopViewHeightAnchor: NSLayoutConstraint? + private var bodyBottomViewHeightAnchor: NSLayoutConstraint? - public var viewModel = ContactViewModel(contactHeaders: nil) override public init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { super.init(nibName: nil, bundle: nil) viewModel.contactRepo.addNotificationDelegate(delegate: self) @@ -81,69 +50,191 @@ open class NEBaseContactsViewController: UIViewController, UITableViewDelegate, super.init(coder: coder) } + override open func viewWillAppear(_ animated: Bool) { + // 刷新数据 + viewModel.reLoadData { [weak self] error, userSectionCount in + self?.emptyView.isHidden = userSectionCount > 0 + if error == nil { + self?.delegate?.onDataLoaded() + self?.tableView.reloadData() + } + } + } + override open func viewDidLoad() { super.viewDidLoad() - if let useSystemNav = NEConfigManager.instance.getParameter(key: useSystemNav) as? Bool, useSystemNav { - navigationController?.isNavigationBarHidden = false - topConstant = 0 - } else { - navigationController?.isNavigationBarHidden = true - topConstant = NEConstant.navigationAndStatusHeight - view.addSubview(navView) - NSLayoutConstraint.activate([ - navView.topAnchor.constraint(equalTo: view.topAnchor), - navView.leftAnchor.constraint(equalTo: view.leftAnchor), - navView.rightAnchor.constraint(equalTo: view.rightAnchor), - navView.heightAnchor - .constraint(equalToConstant: NEConstant.navigationAndStatusHeight), - ]) - } + showTitleBar() commonUI() viewModel.refresh = { [weak self] in self?.tableView.reloadData() } } - override open func viewWillAppear(_ animated: Bool) { + deinit { + viewModel.contactRepo.removeNotificationDelegate(delegate: self) + viewModel.contactRepo.removeContactDelegate(delegate: self) + } + + open func showTitleBar() { if let useSystemNav = NEConfigManager.instance.getParameter(key: useSystemNav) as? Bool, useSystemNav { - navigationController?.isNavigationBarHidden = false + navigationView.isHidden = true + topConstant = 0 + if NEKitContactConfig.shared.ui.showTitleBar { + navigationController?.isNavigationBarHidden = false + } else { + navigationController?.isNavigationBarHidden = true + if #available(iOS 10, *) { + topConstant += NEConstant.statusBarHeight + } + } } else { navigationController?.isNavigationBarHidden = true - } - - // 刷新数据 - viewModel.reLoadData { [weak self] error, userSectionCount in - self?.emptyView.isHidden = userSectionCount > 0 - if error == nil { - self?.delegate?.onDataLoaded() - self?.tableView.reloadData() + if NEKitContactConfig.shared.ui.showTitleBar { + navigationView.isHidden = false + topConstant = NEConstant.navigationHeight + } else { + navigationView.isHidden = true + topConstant = 0 + } + if #available(iOS 10, *) { + topConstant += NEConstant.statusBarHeight } } } open func commonUI() { initSystemNav() + view.addSubview(navigationView) + view.addSubview(bodyTopView) + view.addSubview(bodyView) + view.addSubview(bodyBottomView) + + NSLayoutConstraint.activate([ + navigationView.topAnchor.constraint(equalTo: view.topAnchor), + navigationView.leftAnchor.constraint(equalTo: view.leftAnchor), + navigationView.rightAnchor.constraint(equalTo: view.rightAnchor), + navigationView.heightAnchor + .constraint(equalToConstant: NEConstant.navigationAndStatusHeight), + ]) + + NSLayoutConstraint.activate([ + bodyTopView.topAnchor.constraint(equalTo: view.topAnchor, constant: topConstant), + bodyTopView.leftAnchor.constraint(equalTo: view.leftAnchor), + bodyTopView.rightAnchor.constraint(equalTo: view.rightAnchor), + ]) + bodyTopViewHeightAnchor = bodyTopView.heightAnchor.constraint(equalToConstant: bodyTopViewHeight) + bodyTopViewHeightAnchor?.isActive = true + + NSLayoutConstraint.activate([ + bodyView.topAnchor.constraint(equalTo: bodyTopView.bottomAnchor), + bodyView.leftAnchor.constraint(equalTo: view.leftAnchor), + bodyView.rightAnchor.constraint(equalTo: view.rightAnchor), + bodyView.bottomAnchor.constraint(equalTo: bodyBottomView.topAnchor), + ]) - view.addSubview(topView) - topViewHeightAnchor = topView.heightAnchor.constraint(equalToConstant: topViewHeight) - topViewHeightAnchor?.isActive = true + NSLayoutConstraint.activate([ + bodyBottomView.bottomAnchor.constraint(equalTo: view.bottomAnchor), + bodyBottomView.leftAnchor.constraint(equalTo: view.leftAnchor), + bodyBottomView.rightAnchor.constraint(equalTo: view.rightAnchor), + ]) + bodyBottomViewHeightAnchor = bodyBottomView.heightAnchor.constraint(equalToConstant: bodyBottomViewHeight) + bodyBottomViewHeightAnchor?.isActive = true + + if let customController = NEKitContactConfig.shared.ui.customController { + customController(self) + } + } + + // MARK: lazy load + + public lazy var navigationView: TabNavigationView = { + let nav = TabNavigationView(frame: CGRect.zero) + nav.translatesAutoresizingMaskIntoConstraints = false + nav.delegate = self + + if let addImg = NEKitContactConfig.shared.ui.titleBarRightRes { + nav.addBtn.setImage(addImg, for: .normal) + } + if let searchImg = NEKitContactConfig.shared.ui.titleBarRight2Res { + nav.searchBtn.setImage(searchImg, for: .normal) + } + return nav + }() + + public lazy var bodyTopView: UIView = { + let view = UIView() + view.translatesAutoresizingMaskIntoConstraints = false + view.backgroundColor = .clear + return view + }() + + public lazy var bodyView: UIView = { + let view = UIView() + view.translatesAutoresizingMaskIntoConstraints = false + view.backgroundColor = .clear + view.addSubview(contentView) + + NSLayoutConstraint.activate([ + contentView.topAnchor.constraint(equalTo: view.topAnchor), + contentView.leftAnchor.constraint(equalTo: view.leftAnchor), + contentView.rightAnchor.constraint(equalTo: view.rightAnchor), + contentView.bottomAnchor.constraint(equalTo: view.bottomAnchor), + ]) + return view + }() + public lazy var contentView: UIView = { + let view = UIView() + view.translatesAutoresizingMaskIntoConstraints = false + view.backgroundColor = .clear view.addSubview(tableView) + view.addSubview(emptyView) + NSLayoutConstraint.activate([ tableView.leftAnchor.constraint(equalTo: view.leftAnchor), tableView.rightAnchor.constraint(equalTo: view.rightAnchor), - tableView.topAnchor.constraint(equalTo: topView.bottomAnchor), + tableView.topAnchor.constraint(equalTo: view.topAnchor), tableView.bottomAnchor.constraint(equalTo: view.bottomAnchor), ]) - view.addSubview(emptyView) NSLayoutConstraint.activate([ - emptyView.leftAnchor.constraint(equalTo: view.leftAnchor), - emptyView.rightAnchor.constraint(equalTo: view.rightAnchor), - emptyView.topAnchor.constraint(equalTo: view.topAnchor, constant: NEConstant.screenHeight / 2), - emptyView.bottomAnchor.constraint(equalTo: view.bottomAnchor), + emptyView.leftAnchor.constraint(equalTo: tableView.leftAnchor), + emptyView.rightAnchor.constraint(equalTo: tableView.rightAnchor), + emptyView.topAnchor.constraint(equalTo: tableView.topAnchor, constant: 100), + emptyView.bottomAnchor.constraint(equalTo: tableView.bottomAnchor), ]) - } + + return view + }() + + public lazy var tableView: UITableView = { + let tableView = UITableView(frame: .zero, style: .grouped) + tableView.translatesAutoresizingMaskIntoConstraints = false + tableView.separatorStyle = .none + tableView.delegate = self + tableView.dataSource = self + tableView.backgroundColor = UIColor.ne_backgroundColor + tableView.sectionFooterHeight = 0 + tableView.sectionIndexColor = .ne_greyText + + tableView.tableHeaderView = UIView(frame: CGRect(x: 0, y: 0, width: 0, height: 0.1)) + return tableView + }() + + lazy var emptyView: NEEmptyDataView = { + let view = NEEmptyDataView(imageName: "user_empty", content: localizable("no_friend"), frame: .zero) + view.translatesAutoresizingMaskIntoConstraints = false + view.backgroundColor = .clear + view.isHidden = true + return view + }() + + public lazy var bodyBottomView: UIView = { + let view = UIView() + view.translatesAutoresizingMaskIntoConstraints = false + view.backgroundColor = .clear + return view + }() open func loadData() { viewModel.loadData { [weak self] error, userSectionCount in @@ -221,7 +312,53 @@ open class NEBaseContactsViewController: UIViewController, UITableViewDelegate, 52 } - open func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {} + open func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + let info = viewModel.contacts[indexPath.section].contacts[indexPath.row] + + if info.contactCellType == ContactCellType.ContactOthers.rawValue { + if let headerItemClick = NEKitContactConfig.shared.ui.headerItemClick { + headerItemClick(info, indexPath) + return + } + + switch info.router { + case ValidationMessageRouter: + Router.shared.use(ValidationMessageRouter, + parameters: ["nav": navigationController as Any], + closure: nil) + case ContactBlackListRouter: + Router.shared.use(ContactBlackListRouter, + parameters: ["nav": navigationController as Any], + closure: nil) + + case ContactTeamListRouter: + // My Team + Router.shared.use(ContactTeamListRouter, + parameters: ["nav": navigationController as Any], + closure: nil) + + case ContactPersonRouter: + break + + case ContactComputerRouter: + break + + default: + break + } + } else { + if let friendItemClick = NEKitContactConfig.shared.ui.friendItemClick { + friendItemClick(info, indexPath) + return + } + + Router.shared.use( + ContactUserInfoPageRouter, + parameters: ["nav": navigationController as Any, "user": info.user as Any], + closure: nil + ) + } + } // MARK: SystemMessageProviderDelegate @@ -267,13 +404,12 @@ extension NEBaseContactsViewController { NEBaseFindFriendViewController() } - @objc open func goToFindFriend() { + @objc public func goToFindFriend() { let findFriendController = getFindFriendViewController() - findFriendController.hidesBottomBarWhenPushed = true navigationController?.pushViewController(findFriendController, animated: true) } - @objc open func searchContact() { + @objc public func searchContact() { Router.shared.use( SearchContactPageRouter, parameters: ["nav": navigationController as Any], @@ -283,11 +419,19 @@ extension NEBaseContactsViewController { // MARK: TabNavigationViewDelegate - public func searchAction() { + open func searchAction() { + if let searchBlock = NEKitContactConfig.shared.ui.titleBarRight2Click { + searchBlock() + return + } searchContact() } - public func didClickAddBtn() { + open func didClickAddBtn() { + if let addBlock = NEKitContactConfig.shared.ui.titleBarRightClick { + addBlock() + return + } goToFindFriend() } } diff --git a/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseFindFriendViewController.swift b/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseFindFriendViewController.swift index a9ecd6b3..51005b01 100644 --- a/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseFindFriendViewController.swift +++ b/NEContactUIKit/NEContactUIKit/Classes/Views/NEBaseFindFriendViewController.swift @@ -16,9 +16,13 @@ open class NEBaseFindFriendViewController: NEBaseContactViewController, UITextFi override open func viewDidLoad() { super.viewDidLoad() title = localizable("add_friend") - customNavigationView.navTitle.text = title + navigationView.navTitle.text = title emptyView.settingContent(content: localizable("user_not_exist")) setupUI() + + DispatchQueue.main.asyncAfter(deadline: .now() + 0.52, execute: DispatchWorkItem(block: { [weak self] in + self?.searchInput.becomeFirstResponder() + })) } open func setupUI() { @@ -75,8 +79,9 @@ open class NEBaseFindFriendViewController: NEBaseContactViewController, UITextFi view.addSubview(emptyView) NSLayoutConstraint.activate([ emptyView.centerXAnchor.constraint(equalTo: view.centerXAnchor), - emptyView.topAnchor.constraint(equalTo: searchInput.bottomAnchor, constant: 74), - // emptyView.centerYAnchor.constraint(equalTo: view.centerYAnchor) + emptyView.topAnchor.constraint(equalTo: view.topAnchor, constant: 0), + emptyView.widthAnchor.constraint(equalToConstant: 200), + emptyView.heightAnchor.constraint(equalToConstant: 200), ]) } diff --git a/NEConversationUIKit/NEConversationUIKit.podspec b/NEConversationUIKit/NEConversationUIKit.podspec index 4fb23742..972776ca 100644 --- a/NEConversationUIKit/NEConversationUIKit.podspec +++ b/NEConversationUIKit/NEConversationUIKit.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'NEConversationUIKit' - s.version = '9.6.3' + s.version = '9.6.5' s.summary = 'Netease XKit' # This description is used to generate tags and improve search results. @@ -27,7 +27,7 @@ TODO: Add long description of the pod here. s.source = { :git => 'ssh://git@g.hz.netease.com:22222/yunxin-app/xkit-ios.git', :tag => s.version.to_s } # s.social_media_url = 'https://twitter.com/' - s.ios.deployment_target = '10.0' + s.ios.deployment_target = '11.0' s.swift_version = '5.0' s.source_files = 'NEConversationUIKit/Classes/**/*' diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Cell/NEBaseConversationListCell.swift b/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Cell/NEBaseConversationListCell.swift index 32864a84..b545372d 100644 --- a/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Cell/NEBaseConversationListCell.swift +++ b/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Cell/NEBaseConversationListCell.swift @@ -25,6 +25,10 @@ open class NEBaseConversationListCell: UITableViewCell { open func setupSubviews() { selectionStyle = .none + if let bgColor = NEKitConversationConfig.shared.ui.conversationProperties.itemBackground { + backgroundColor = bgColor + } + contentView.addSubview(headImge) contentView.addSubview(redAngleView) contentView.addSubview(title) @@ -106,12 +110,12 @@ open class NEBaseConversationListCell: UITableViewCell { let text = contentForRecentSession(message: lastMessage) let mutaAttri = NSMutableAttributedString(string: text) if let sessionId = sessionModel?.recentSession?.session?.sessionId { - let isAtMessage = NEAtMessageManager.instance.isAtCurrentUser(sessionId: sessionId) + let isAtMessage = NEAtMessageManager.instance?.isAtCurrentUser(sessionId: sessionId) if isAtMessage == true { let atStr = localizable("you_were_mentioned") mutaAttri.insert(NSAttributedString(string: atStr), at: 0) mutaAttri.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.ne_redText, range: NSMakeRange(0, atStr.count)) - mutaAttri.addAttribute(NSAttributedString.Key.font, value: NEKitConversationConfig.shared.ui.subTitleFont, range: NSMakeRange(0, mutaAttri.length)) + mutaAttri.addAttribute(NSAttributedString.Key.font, value: UIFont.systemFont(ofSize: NEKitConversationConfig.shared.ui.conversationProperties.itemContentSize > 0 ? NEKitConversationConfig.shared.ui.conversationProperties.itemContentSize : 13), range: NSMakeRange(0, mutaAttri.length)) } } subTitle.attributedText = mutaAttri // contentForRecentSession(message: lastMessage) @@ -209,8 +213,8 @@ open class NEBaseConversationListCell: UITableViewCell { public lazy var title: UILabel = { let label = UILabel() label.translatesAutoresizingMaskIntoConstraints = false - label.textColor = NEKitConversationConfig.shared.ui.titleColor - label.font = NEKitConversationConfig.shared.ui.titleFont ?? UIFont.systemFont(ofSize: 16) + label.textColor = NEKitConversationConfig.shared.ui.conversationProperties.itemTitleColor + label.font = .systemFont(ofSize: NEKitConversationConfig.shared.ui.conversationProperties.itemTitleSize > 0 ? NEKitConversationConfig.shared.ui.conversationProperties.itemTitleSize : 16) label.text = "Oliver" label.accessibilityIdentifier = "id.name" return label @@ -220,8 +224,8 @@ open class NEBaseConversationListCell: UITableViewCell { public lazy var subTitle: UILabel = { let label = UILabel() label.translatesAutoresizingMaskIntoConstraints = false - label.textColor = NEKitConversationConfig.shared.ui.subTitleColor - label.font = NEKitConversationConfig.shared.ui.subTitleFont + label.textColor = NEKitConversationConfig.shared.ui.conversationProperties.itemContentColor + label.font = UIFont.systemFont(ofSize: NEKitConversationConfig.shared.ui.conversationProperties.itemContentSize > 0 ? NEKitConversationConfig.shared.ui.conversationProperties.itemContentSize : 13) label.accessibilityIdentifier = "id.message" return label }() @@ -230,8 +234,8 @@ open class NEBaseConversationListCell: UITableViewCell { public lazy var timeLabel: UILabel = { let label = UILabel() label.translatesAutoresizingMaskIntoConstraints = false - label.textColor = NEKitConversationConfig.shared.ui.timeColor - label.font = NEKitConversationConfig.shared.ui.timeFont + label.textColor = NEKitConversationConfig.shared.ui.conversationProperties.itemDateColor + label.font = .systemFont(ofSize: NEKitConversationConfig.shared.ui.conversationProperties.itemDateSize > 0 ? NEKitConversationConfig.shared.ui.conversationProperties.itemDateSize : 12) label.textAlignment = .right label.accessibilityIdentifier = "id.time" return label diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBaseConversationController.swift b/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBaseConversationController.swift index 0c003176..f8a5b7f9 100644 --- a/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBaseConversationController.swift +++ b/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBaseConversationController.swift @@ -8,27 +8,123 @@ import NECoreKit import NIMSDK import UIKit +@objc +public protocol NEBaseConversationControllerDelegate { + func onDataLoaded() +} + @objcMembers open class NEBaseConversationController: UIViewController, NIMChatManagerDelegate { - public let viewmodel = ConversationViewModel() - public var listCtrl = NEBaseConversationListViewController() + var className = "NEBaseConversationController" + public var deleteBottonBackgroundColor: UIColor = NEConstant.hexRGB(0xA8ABB6) + + public var brokenNetworkViewHeight = 36.0 + private var bodyTopViewHeightAnchor: NSLayoutConstraint? + private var bodyBottomViewHeightAnchor: NSLayoutConstraint? + public var contentViewTopAnchor: NSLayoutConstraint? + public var topConstant: CGFloat = 0 + public var popListController = NEBasePopListViewController() + + public var delegate: NEBaseConversationControllerDelegate? + + public var bodyTopViewHeight: CGFloat = 0 { + didSet { + bodyTopViewHeightAnchor?.constant = bodyTopViewHeight + bodyTopView.isHidden = bodyTopViewHeight <= 0 + } + } + + public var bodyBottomViewHeight: CGFloat = 0 { + didSet { + bodyBottomViewHeightAnchor?.constant = bodyBottomViewHeight + bodyBottomView.isHidden = bodyBottomViewHeight <= 0 + } + } + + public var cellRegisterDic = [0: NEBaseConversationListCell.self] + public let viewModel = ConversationViewModel() + + override public init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { + super.init(nibName: nil, bundle: nil) + } + + 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 = NEKitConversationConfig.shared.ui.hiddenNav - } else { - navigationController?.isNavigationBarHidden = true + showTitleBar() + viewModel.loadStickTopSessionInfos { [weak self] error, sessionInfos in + NELog.infoLog( + ModuleName + " " + (self?.className ?? "NEBaseConversationController"), + desc: "CALLBACK loadStickTopSessionInfos " + (error?.localizedDescription ?? "no error") + ) + if let infos = sessionInfos { + self?.viewModel.stickTopInfos = infos + self?.reloadTableView() + self?.delegate?.onDataLoaded() + } + } + + NEChatDetectNetworkTool.shareInstance.netWorkReachability { [weak self] status in + if status == .notReachable { + self?.brokenNetworkView.isHidden = false + self?.contentViewTopAnchor?.constant = self?.brokenNetworkViewHeight ?? 36 + } else { + self?.brokenNetworkView.isHidden = true + self?.contentViewTopAnchor?.constant = 0 + } } } override open func viewDidLoad() { super.viewDidLoad() + showTitleBar() setupSubviews() + requestData() + initialConfig() NIMSDK.shared().chatManager.add(self) } + override open func viewWillDisappear(_ animated: Bool) { + popListController.removeSelf() + } + + deinit { + NIMSDK.shared().chatManager.remove(self) + } + + open func showTitleBar() { + if let useSystemNav = NEConfigManager.instance.getParameter(key: useSystemNav) as? Bool, useSystemNav { + navigationView.isHidden = true + topConstant = 0 + if NEKitConversationConfig.shared.ui.showTitleBar { + navigationController?.isNavigationBarHidden = false + } else { + navigationController?.isNavigationBarHidden = true + if #available(iOS 10, *) { + topConstant += NEConstant.statusBarHeight + } + } + } else { + navigationController?.isNavigationBarHidden = true + if NEKitConversationConfig.shared.ui.showTitleBar { + navigationView.isHidden = false + topConstant = NEConstant.navigationHeight + } else { + navigationView.isHidden = true + topConstant = 0 + } + if #available(iOS 10, *) { + topConstant += NEConstant.statusBarHeight + } + } + } + func initSystemNav() { + edgesForExtendedLayout = [] + let brandBarBtn = UIButton() brandBarBtn.accessibilityIdentifier = "id.titleBarTitle" brandBarBtn.setTitle(localizable("appName"), for: .normal) @@ -42,40 +138,291 @@ open class NEBaseConversationController: UIViewController, NIMChatManagerDelegat open func setupSubviews() { initSystemNav() - view.addSubview(navView) + view.addSubview(navigationView) + view.addSubview(bodyTopView) + view.addSubview(bodyView) + view.addSubview(bodyBottomView) + NSLayoutConstraint.activate([ - navView.topAnchor.constraint(equalTo: view.topAnchor), - navView.leftAnchor.constraint(equalTo: view.leftAnchor), - navView.rightAnchor.constraint(equalTo: view.rightAnchor), - navView.heightAnchor + navigationView.topAnchor.constraint(equalTo: view.topAnchor), + navigationView.leftAnchor.constraint(equalTo: view.leftAnchor), + navigationView.rightAnchor.constraint(equalTo: view.rightAnchor), + navigationView.heightAnchor .constraint(equalToConstant: NEConstant.navigationAndStatusHeight), ]) - listCtrl.view.translatesAutoresizingMaskIntoConstraints = false - addChild(listCtrl) - view.addSubview(listCtrl.view) + NSLayoutConstraint.activate([ + bodyTopView.topAnchor.constraint(equalTo: view.topAnchor, constant: topConstant), + bodyTopView.leftAnchor.constraint(equalTo: view.leftAnchor), + bodyTopView.rightAnchor.constraint(equalTo: view.rightAnchor), + ]) + bodyTopViewHeightAnchor = bodyTopView.heightAnchor.constraint(equalToConstant: bodyTopViewHeight) + bodyTopViewHeightAnchor?.isActive = true + + NSLayoutConstraint.activate([ + bodyView.topAnchor.constraint(equalTo: bodyTopView.bottomAnchor), + bodyView.leftAnchor.constraint(equalTo: view.leftAnchor), + bodyView.rightAnchor.constraint(equalTo: view.rightAnchor), + bodyView.bottomAnchor.constraint(equalTo: bodyBottomView.topAnchor), + ]) + + NSLayoutConstraint.activate([ + bodyBottomView.bottomAnchor.constraint(equalTo: view.bottomAnchor), + bodyBottomView.leftAnchor.constraint(equalTo: view.leftAnchor), + bodyBottomView.rightAnchor.constraint(equalTo: view.rightAnchor), + ]) + bodyBottomViewHeightAnchor = bodyBottomView.heightAnchor.constraint(equalToConstant: bodyBottomViewHeight) + bodyBottomViewHeightAnchor?.isActive = true + + cellRegisterDic.forEach { (key: Int, value: NEBaseConversationListCell.Type) in + tableView.register(value, forCellReuseIdentifier: "\(key)") + } + + if let customController = NEKitConversationConfig.shared.ui.customController { + customController(self) + } } - deinit { - NIMSDK.shared().chatManager.remove(self) + open func initialConfig() { + viewModel.delegate = self + } + + func requestData() { + let params = NIMFetchServerSessionOption() + params.minTimestamp = 0 + params.maxTimestamp = Date().timeIntervalSince1970 * 1000 + params.limit = 50 + weak var weakSelf = self + viewModel.fetchServerSessions(option: params) { error, recentSessions in + if error == nil { + NELog.infoLog(ModuleName + " " + self.className, desc: "✅CALLBACK fetchServerSessions SUCCESS") + if let recentList = recentSessions { + NELog.infoLog(ModuleName + " " + self.className, desc: "✅CALLBACK fetchServerSessions SUCCESS count : \(recentList.count)") + if recentList.count > 0 { + weakSelf?.emptyView.isHidden = true + weakSelf?.reloadTableView() + weakSelf?.delegate?.onDataLoaded() + } else { + weakSelf?.emptyView.isHidden = false + } + } + + } else { + NELog.errorLog( + ModuleName + " " + self.className, + desc: "❌CALLBACK fetchServerSessions failed,error = \(error!)" + ) + weakSelf?.emptyView.isHidden = false + } + } } // MARK: lazyMethod - public lazy var navView: TabNavigationView = { + public lazy var navigationView: TabNavigationView = { let nav = TabNavigationView(frame: CGRect.zero) nav.translatesAutoresizingMaskIntoConstraints = false nav.delegate = self - nav.isHidden = NEKitConversationConfig.shared.ui.hiddenNav + nav.brandBtn.addTarget(self, action: #selector(brandBtnClick), for: .touchUpInside) + + if let brandTitle = NEKitConversationConfig.shared.ui.titleBarTitle { + nav.brandBtn.setTitle(brandTitle, for: .normal) + } + if let brandTitleColor = NEKitConversationConfig.shared.ui.titleBarTitleColor { + nav.brandBtn.setTitleColor(brandTitleColor, for: .normal) + } + if !NEKitConversationConfig.shared.ui.showTitleBarLeftIcon { + nav.brandBtn.setImage(nil, for: .normal) + // 如果左侧图标为空,则左侧文案左对齐 + nav.brandBtn.layoutButtonImage(style: .left, space: 0) + } + if let brandImg = NEKitConversationConfig.shared.ui.titleBarLeftRes { + nav.brandBtn.setImage(brandImg, for: .normal) + if brandImg.size.width == 0, brandImg.size.height == 0 { + // 如果左侧图标为空,则左侧文案左对齐 + nav.brandBtn.layoutButtonImage(style: .left, space: 0) + } + } + if let rightImg = NEKitConversationConfig.shared.ui.titleBarRightRes { + nav.addBtn.setImage(rightImg, for: .normal) + } + if let right2Img = NEKitConversationConfig.shared.ui.titleBarRight2Res { + nav.searchBtn.setImage(right2Img, for: .normal) + } return nav }() + + public lazy var bodyTopView: UIView = { + let view = UIView() + view.translatesAutoresizingMaskIntoConstraints = false + view.backgroundColor = .clear + return view + }() + + public lazy var bodyView: UIView = { + let view = UIView() + view.translatesAutoresizingMaskIntoConstraints = false + view.backgroundColor = .clear + + view.addSubview(brokenNetworkView) + view.addSubview(contentView) + + NSLayoutConstraint.activate([ + brokenNetworkView.topAnchor.constraint(equalTo: view.topAnchor), + brokenNetworkView.leftAnchor.constraint(equalTo: view.leftAnchor), + brokenNetworkView.rightAnchor.constraint(equalTo: view.rightAnchor), + brokenNetworkView.heightAnchor.constraint(equalToConstant: brokenNetworkViewHeight), + ]) + + contentViewTopAnchor = contentView.topAnchor.constraint(equalTo: view.topAnchor) + contentViewTopAnchor?.isActive = true + NSLayoutConstraint.activate([ + contentView.leftAnchor.constraint(equalTo: view.leftAnchor), + contentView.rightAnchor.constraint(equalTo: view.rightAnchor), + contentView.bottomAnchor.constraint(equalTo: view.bottomAnchor), + ]) + + return view + }() + + public lazy var brokenNetworkView: NEBrokenNetworkView = { + let view = NEBrokenNetworkView() + view.translatesAutoresizingMaskIntoConstraints = false + view.isHidden = true + return view + }() + + public lazy var contentView: UIView = { + let view = UIView() + view.translatesAutoresizingMaskIntoConstraints = false + view.backgroundColor = .clear + view.addSubview(tableView) + view.addSubview(emptyView) + + NSLayoutConstraint.activate([ + tableView.topAnchor.constraint(equalTo: view.topAnchor), + tableView.bottomAnchor.constraint(equalTo: view.bottomAnchor), + tableView.leftAnchor.constraint(equalTo: view.leftAnchor), + tableView.rightAnchor.constraint(equalTo: view.rightAnchor), + ]) + + NSLayoutConstraint.activate([ + emptyView.topAnchor.constraint(equalTo: tableView.topAnchor, constant: 100), + emptyView.bottomAnchor.constraint(equalTo: tableView.bottomAnchor), + emptyView.leftAnchor.constraint(equalTo: tableView.leftAnchor), + emptyView.rightAnchor.constraint(equalTo: tableView.rightAnchor), + ]) + + return view + }() + + public lazy var emptyView: NEEmptyDataView = { + let view = NEEmptyDataView( + imageName: "user_empty", + content: localizable("session_empty"), + frame: CGRect.zero + ) + view.translatesAutoresizingMaskIntoConstraints = false + view.isHidden = true + view.backgroundColor = .clear + return view + }() + + public lazy var tableView: UITableView = { + let tableView = UITableView(frame: .zero, style: .plain) + tableView.translatesAutoresizingMaskIntoConstraints = false + tableView.separatorStyle = .none + tableView.delegate = self + tableView.dataSource = self + tableView.tableHeaderView = UIView(frame: CGRect(x: 0, y: 0, width: 0, height: 0.1)) + return tableView + }() + + public lazy var bodyBottomView: UIView = { + let view = UIView() + view.translatesAutoresizingMaskIntoConstraints = false + view.backgroundColor = .clear + return view + }() } extension NEBaseConversationController: TabNavigationViewDelegate { - open func searchAction() {} + /// 标题栏左侧按钮点击事件 + func brandBtnClick() { + NEKitConversationConfig.shared.ui.titleBarLeftClick?() + } - open func didClickAddBtn() {} + open func searchAction() { + if let searchBlock = NEKitConversationConfig.shared.ui.titleBarRight2Click { + searchBlock() + return + } + + Router.shared.use( + SearchContactPageRouter, + parameters: ["nav": navigationController as Any], + closure: nil + ) + } + + open func getPopListController() -> NEBasePopListViewController { + NEBasePopListViewController() + } + + open func getPopListItems() -> [PopListItem] { + weak var weakSelf = self + var items = [PopListItem]() + let addFriend = PopListItem() + addFriend.showName = localizable("add_friend") + addFriend.image = UIImage.ne_imageNamed(name: "add_friend") + addFriend.completion = { + Router.shared.use( + ContactAddFriendRouter, + parameters: ["nav": self.navigationController as Any], + closure: nil + ) + } + items.append(addFriend) + + let createGroup = PopListItem() + createGroup.showName = localizable("create_discussion_group") + createGroup.image = UIImage.ne_imageNamed(name: "create_discussion") + createGroup.completion = { + weakSelf?.createDiscussGroup() + } + items.append(createGroup) + + let createDicuss = PopListItem() + createDicuss.showName = localizable("create_senior_group") + createDicuss.image = UIImage.ne_imageNamed(name: "create_group") + createDicuss.completion = { + weakSelf?.createSeniorGroup() + } + items.append(createDicuss) + + return items + } + + open func didClickAddBtn() { + if let addBlock = NEKitConversationConfig.shared.ui.titleBarRightClick { + addBlock() + return + } + + if IMKitClient.instance.getConfigCenter().teamEnable { + popListController.itemDatas = getPopListItems() + popListController.view.frame = CGRect(origin: .zero, size: view.frame.size) + popListController.removeSelf() + view.addSubview(popListController.view) + } else { + Router.shared.use( + ContactAddFriendRouter, + parameters: ["nav": navigationController as Any], + closure: nil + ) + } + } open func createDiscussGroup() { Router.shared.register(ContactSelectedUsersRouter) { param in @@ -92,7 +439,7 @@ extension NEBaseConversationController: TabNavigationViewDelegate { print("create discuss ", param) if let code = param["code"] as? Int, let teamid = param["teamId"] as? String, code == 0 { - let session = weakSelf?.viewmodel.repo.createTeamSession(teamid) + let session = weakSelf?.viewModel.repo.createTeamSession(teamid) Router.shared.use( PushTeamChatVCRouter, parameters: ["nav": weakSelf?.navigationController as Any, @@ -119,7 +466,7 @@ extension NEBaseConversationController: TabNavigationViewDelegate { print("create senior : ", param) if let code = param["code"] as? Int, let teamid = param["teamId"] as? String, code == 0 { - let session = weakSelf?.viewmodel.repo.createTeamSession(teamid) + let session = weakSelf?.viewModel.repo.createTeamSession(teamid) Router.shared.use( PushTeamChatVCRouter, parameters: ["nav": weakSelf?.navigationController as Any, @@ -158,7 +505,289 @@ extension NEBaseConversationController: TabNavigationViewDelegate { setting.isSessionUpdate = false messageNew.setting = setting if let session = message.session { - viewmodel.repo.saveMessageToDB(messageNew, session, completion) + viewModel.repo.saveMessageToDB(messageNew, session, completion) + } + } +} + +// MARK: - UITableViewDelegate, UITableViewDataSource + +extension NEBaseConversationController: UITableViewDelegate, UITableViewDataSource { + open func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + let count = viewModel.conversationListArray?.count ?? 0 + NELog.infoLog(ModuleName + " " + "ConversationController", + desc: "numberOfRowsInSection count : \(count)") + return count + } + + open func tableView(_ tableView: UITableView, + cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let model = viewModel.conversationListArray?[indexPath.row] + let reusedId = "\(model?.customType ?? 0)" + let cell = tableView.dequeueReusableCell(withIdentifier: reusedId, for: indexPath) + + if let c = cell as? NEBaseConversationListCell { + c.topStickInfos = viewModel.stickTopInfos + c.configData(sessionModel: model) + } + + return cell + } + + open func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + let conversationModel = viewModel.conversationListArray?[indexPath.row] + + if let didClick = NEKitConversationConfig.shared.ui.itemClick { + didClick(conversationModel, indexPath) + return + } + + let sid = conversationModel?.recentSession?.session?.sessionId ?? "" + let sessionType = conversationModel?.recentSession?.session?.sessionType ?? .P2P + onselectedTableRow(sessionType: sessionType, sessionId: sid, indexPath: indexPath) + } + + open func tableView(_ tableView: UITableView, + editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? { + weak var weakSelf = self + var rowActions = [UITableViewRowAction]() + + let conversationModel = weakSelf?.viewModel.conversationListArray?[indexPath.row] + guard let recentSession = conversationModel?.recentSession, + let session = recentSession.session else { + return rowActions + } + + let deleteAction = UITableViewRowAction(style: .destructive, + title: NEKitConversationConfig.shared.ui.deleteBottonTitle) { action, indexPath in + weakSelf?.deleteActionHandler(action: action, indexPath: indexPath) + } + + // 置顶和取消置顶 + let isTop = viewModel.stickTopInfos[session] != nil + let topAction = UITableViewRowAction(style: .destructive, + title: isTop ? NEKitConversationConfig.shared.ui.stickTopBottonCancelTitle : + NEKitConversationConfig.shared.ui.stickTopBottonTitle) { action, indexPath in + weakSelf?.topActionHandler(action: action, indexPath: indexPath, isTop: isTop) + } + deleteAction.backgroundColor = NEKitConversationConfig.shared.ui.deleteBottonBackgroundColor ?? deleteBottonBackgroundColor + topAction.backgroundColor = NEKitConversationConfig.shared.ui.stickTopBottonBackgroundColor ?? NEConstant.hexRGB(0x337EFF) + rowActions.append(deleteAction) + rowActions.append(topAction) + + return rowActions + } + + /* + @available(iOS 11.0, *) + public func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { + + var rowActions = [UIContextualAction]() + + let deleteAction = UIContextualAction(style: .normal, title: "删除") { (action, sourceView, completionHandler) in + + // self.dataSource.remove(at: indexPath.row) + // tableView.deleteRows(at: [indexPath], with: .automatic) + // 需要返回true,否则没有反应 + completionHandler(true) + } + deleteAction.backgroundColor = NEConstant.hexRGB(0xA8ABB6) + rowActions.append(deleteAction) + + let topAction = UIContextualAction(style: .normal, title: "置顶") { (action, sourceView, completionHandler) in + + // self.dataSource.remove(at: indexPath.row) + // tableView.deleteRows(at: [indexPath], with: .automatic) + // 需要返回true,否则没有反应 + completionHandler(true) + } + topAction.backgroundColor = NEConstant.hexRGB(0x337EFF) + rowActions.append(topAction) + + let actionConfig = UISwipeActionsConfiguration.init(actions: rowActions) + actionConfig.performsFirstActionWithFullSwipe = false + + return actionConfig + } + */ + + open func deleteActionHandler(action: UITableViewRowAction?, indexPath: IndexPath) { + let conversationModel = viewModel.conversationListArray?[indexPath.row] + + if let deleteBottonClick = NEKitConversationConfig.shared.ui.deleteBottonClick { + deleteBottonClick(conversationModel, indexPath) + return + } + + if let recentSession = conversationModel?.recentSession { + viewModel.deleteRecentSession(recentSession: recentSession) + didDeleteConversationCell( + model: conversationModel ?? ConversationListModel(), + indexPath: indexPath + ) + } + } + + open func topActionHandler(action: UITableViewRowAction?, indexPath: IndexPath, isTop: Bool) { + if !NEChatDetectNetworkTool.shareInstance.isNetworkRecahability() { + showToast(localizable("network_error")) + return + } + let conversationModel = viewModel.conversationListArray?[indexPath.row] + + if let stickTopBottonClick = NEKitConversationConfig.shared.ui.stickTopBottonClick { + stickTopBottonClick(conversationModel, indexPath) + return + } + + if let recentSession = conversationModel?.recentSession { + onTopRecentAtIndexPath( + rencent: recentSession, + indexPath: indexPath, + isTop: isTop + ) { [weak self] error, sessionInfo in + if error == nil { + if isTop { + self?.didRemoveStickTopSession( + model: conversationModel ?? ConversationListModel(), + indexPath: indexPath + ) + } else { + self?.didAddStickTopSession( + model: conversationModel ?? ConversationListModel(), + indexPath: indexPath + ) + } + } + } } } + + private func onTopRecentAtIndexPath(rencent: NIMRecentSession, indexPath: IndexPath, + isTop: Bool, + _ completion: @escaping (NSError?, NIMStickTopSessionInfo?) + -> Void) { + guard let session = rencent.session else { + NELog.errorLog(ModuleName + " " + className, desc: "❌session is nil") + return + } + weak var weakSelf = self + if isTop { + guard let params = viewModel.stickTopInfos[session] else { + return + } + + viewModel.removeStickTopSession(params: params) { error, topSessionInfo in + if let err = error { + NELog.errorLog( + ModuleName + " " + (weakSelf?.className ?? "ConversationController"), + desc: "❌CALLBACK removeStickTopSession failed,error = \(err)" + ) + completion(error as NSError?, nil) + + return + } else { + NELog.infoLog( + ModuleName + " " + (weakSelf?.className ?? "ConversationController"), + desc: "✅CALLBACK removeStickTopSession SUCCESS" + ) + weakSelf?.viewModel.stickTopInfos[session] = nil + weakSelf?.viewModel.sortRecentSession() + weakSelf?.tableView.reloadData() + completion(nil, topSessionInfo) + } + } + + } else { + viewModel.addStickTopSession(session: session) { error, newInfo in + if let err = error { + NELog.errorLog( + ModuleName + " " + (weakSelf?.className ?? "ConversationController"), + desc: "❌CALLBACK addStickTopSession failed,error = \(err)" + ) + completion(error as NSError?, nil) + return + } else { + NELog.infoLog(ModuleName + " " + (weakSelf?.className ?? "ConversationController"), + desc: "✅CALLBACK addStickTopSession callback SUCCESS") + weakSelf?.viewModel.stickTopInfos[session] = newInfo + weakSelf?.viewModel.sortRecentSession() + weakSelf?.tableView.reloadData() + completion(nil, newInfo) + } + } + } + } +} + +// MARK: UI UIKit提供的重写方法 + +extension NEBaseConversationController { + /// cell点击事件,可重写该事件处理自己的逻辑业务,例如跳转到指定的会话页面 + /// - Parameters: + /// - sessionType: 会话类型 + /// - sessionId: 会话id + /// - indexPath: indexpath + open func onselectedTableRow(sessionType: NIMSessionType, sessionId: String, + indexPath: IndexPath) { + if sessionType == .P2P { + let session = NIMSession(sessionId, type: .P2P) + Router.shared.use( + PushP2pChatVCRouter, + parameters: ["nav": navigationController as Any, "session": session as Any], + closure: nil + ) + } else if sessionType == .team { + let session = NIMSession(sessionId, type: .team) + Router.shared.use( + PushTeamChatVCRouter, + parameters: ["nav": navigationController as Any, "session": session as Any], + closure: nil + ) + } + } + + /// 删除会话 + /// - Parameters: + /// - model: 会话模型 + /// - indexPath: indexpath + open func didDeleteConversationCell(model: ConversationListModel, indexPath: IndexPath) {} + + /// 删除一条置顶记录 + /// - Parameters: + /// - model: 会话模型 + /// - indexPath: indexpath + open func didRemoveStickTopSession(model: ConversationListModel, indexPath: IndexPath) {} + + /// 添加一条置顶记录 + /// - Parameters: + /// - model: 会话模型 + /// - indexPath: indexpath + open func didAddStickTopSession(model: ConversationListModel, indexPath: IndexPath) {} +} + +// MARK: ================= ConversationViewModelDelegate=================== + +extension NEBaseConversationController: ConversationViewModelDelegate { + open func didAddRecentSession() { + NELog.infoLog("ConversationController", desc: "didAddRecentSession") + emptyView.isHidden = (viewModel.conversationListArray?.count ?? 0) > 0 + viewModel.sortRecentSession() + tableView.reloadData() + } + + open func didUpdateRecentSession(index: Int) { + let indexPath = IndexPath(row: index, section: 0) + tableView.reloadRows(at: [indexPath], with: .none) + } + + open func reloadData() { + delegate?.onDataLoaded() + } + + open func reloadTableView() { + emptyView.isHidden = (viewModel.conversationListArray?.count ?? 0) > 0 + viewModel.sortRecentSession() + tableView.reloadData() + } } diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBaseConversationListViewController.swift b/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBaseConversationListViewController.swift deleted file mode 100644 index d587eb73..00000000 --- a/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBaseConversationListViewController.swift +++ /dev/null @@ -1,443 +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 NIMSDK -import UIKit - -@objc -public protocol ConversationListViewControllerDelegate { - func onDataLoaded() -} - -@objcMembers -open class NEBaseConversationListViewController: UIViewController { - public var viewModel = ConversationViewModel() - var className = "ConversationListViewController" - public var networkToolHeight: CGFloat = 36 - public var topViewHeight: CGFloat = 0 { - didSet { - topViewHeightAnchor?.constant = brokenNetworkView.isHidden ? topViewHeight : networkToolHeight - topView.isHidden = topViewHeight <= 0 - } - } - - public var deleteBottonColor: UIColor = NEConstant.hexRGB(0xA8ABB6) - public var topViewHeightAnchor: NSLayoutConstraint? - public var delegate: ConversationListViewControllerDelegate? - - public var registerCellDic = [0: NEBaseConversationListCell.self] - - override open func viewDidLoad() { - super.viewDidLoad() - setupSubviews() - requestData() - initialConfig() - } - - override open func viewWillAppear(_ animated: Bool) { - weak var weakSelf = self - - NEChatDetectNetworkTool.shareInstance.netWorkReachability { status in - if status == .notReachable { - weakSelf?.brokenNetworkView.isHidden = false - weakSelf?.topView.isHidden = true - weakSelf?.topViewHeightAnchor?.constant = weakSelf?.networkToolHeight ?? 0 - } else { - weakSelf?.brokenNetworkView.isHidden = true - weakSelf?.topView.isHidden = false - weakSelf?.topViewHeightAnchor?.constant = weakSelf?.topViewHeight ?? 0 - } - } - - viewModel.loadStickTopSessionInfos { error, sessionInfos in - NELog.infoLog( - ModuleName + " " + self.className, - desc: "CALLBACK loadStickTopSessionInfos " + (error?.localizedDescription ?? "no error") - ) - if let infos = sessionInfos { - weakSelf?.viewModel.stickTopInfos = infos - weakSelf?.reloadTableView() - weakSelf?.delegate?.onDataLoaded() - } - } - } - - open func initialConfig() { - viewModel.delegate = self - } - - open func setupSubviews() { - view.addSubview(topView) - view.addSubview(tableView) - view.addSubview(emptyView) - view.addSubview(brokenNetworkView) - - NSLayoutConstraint.activate([ - topView.rightAnchor.constraint(equalTo: view.rightAnchor), - topView.leftAnchor.constraint(equalTo: view.leftAnchor), - topView.topAnchor.constraint(equalTo: view.topAnchor), - - ]) - topViewHeightAnchor = topView.heightAnchor.constraint(equalToConstant: topViewHeight) - topViewHeightAnchor?.isActive = true - - NSLayoutConstraint.activate([ - tableView.rightAnchor.constraint(equalTo: view.rightAnchor), - tableView.leftAnchor.constraint(equalTo: view.leftAnchor), - tableView.topAnchor.constraint(equalTo: topView.bottomAnchor), - tableView.bottomAnchor.constraint(equalTo: view.bottomAnchor), - ]) - - registerCellDic.forEach { (key: Int, value: NEBaseConversationListCell.Type) in - tableView.register(value, forCellReuseIdentifier: "\(key)") - } - - NSLayoutConstraint.activate([ - emptyView.topAnchor.constraint(equalTo: tableView.topAnchor, constant: 100), - emptyView.bottomAnchor.constraint(equalTo: tableView.bottomAnchor), - emptyView.leftAnchor.constraint(equalTo: tableView.leftAnchor), - emptyView.rightAnchor.constraint(equalTo: tableView.rightAnchor), - ]) - } - - func requestData() { - let params = NIMFetchServerSessionOption() - params.minTimestamp = 0 - params.maxTimestamp = Date().timeIntervalSince1970 * 1000 - params.limit = 50 - weak var weakSelf = self - viewModel.fetchServerSessions(option: params) { error, recentSessions in - if error == nil { - NELog.infoLog(ModuleName + " " + self.className, desc: "✅CALLBACK fetchServerSessions SUCCESS") - if let recentList = recentSessions { - NELog.infoLog(ModuleName + " " + self.className, desc: "✅CALLBACK fetchServerSessions SUCCESS count : \(recentList.count)") - if recentList.count > 0 { - weakSelf?.emptyView.isHidden = true - weakSelf?.reloadTableView() - weakSelf?.delegate?.onDataLoaded() - } else { - weakSelf?.emptyView.isHidden = false - } - } - - } else { - NELog.errorLog( - ModuleName + " " + self.className, - desc: "❌CALLBACK fetchServerSessions failed,error = \(error!)" - ) - weakSelf?.emptyView.isHidden = false - } - } - } - - // MARK: lazy method - - public lazy var topView: UIView = { - let view = UIView() - view.translatesAutoresizingMaskIntoConstraints = false - view.backgroundColor = .clear - return view - }() - - public lazy var tableView: UITableView = { - let tableView = UITableView(frame: .zero, style: .plain) - tableView.translatesAutoresizingMaskIntoConstraints = false - tableView.separatorStyle = .none - tableView.delegate = self - tableView.dataSource = self - tableView.tableHeaderView = UIView(frame: CGRect(x: 0, y: 0, width: 0, height: 0.1)) - return tableView - }() - - public lazy var brokenNetworkView: NEBrokenNetworkView = { - let view = - NEBrokenNetworkView(frame: CGRect(x: 0, y: 0, width: NEConstant.screenWidth, height: networkToolHeight)) - view.isHidden = true - return view - }() - - public lazy var emptyView: NEEmptyDataView = { - let view = NEEmptyDataView( - imageName: "user_empty", - content: localizable("session_empty"), - frame: CGRect.zero - ) - view.translatesAutoresizingMaskIntoConstraints = false - view.isHidden = true - view.backgroundColor = .clear - return view - - }() -} - -// MARK: ====================== private method=========================== - -extension NEBaseConversationListViewController { - private func onTopRecentAtIndexPath(rencent: NIMRecentSession, indexPath: IndexPath, - isTop: Bool, - _ completion: @escaping (NSError?, NIMStickTopSessionInfo?) - -> Void) { - guard let session = rencent.session else { - NELog.errorLog(ModuleName + " " + className, desc: "❌session is nil") - return - } - weak var weakSelf = self - if isTop { - guard let params = viewModel.stickTopInfos[session] else { - return - } - - viewModel.removeStickTopSession(params: params) { error, topSessionInfo in - if let err = error { - NELog.errorLog( - ModuleName + " " + (weakSelf?.className ?? "ConversationListViewController"), - desc: "❌CALLBACK removeStickTopSession failed,error = \(err)" - ) - completion(error as NSError?, nil) - - return - } else { - NELog.infoLog( - ModuleName + " " + (weakSelf?.className ?? "ConversationListViewController"), - desc: "✅CALLBACK removeStickTopSession SUCCESS" - ) - weakSelf?.viewModel.stickTopInfos[session] = nil - weakSelf?.viewModel.sortRecentSession() - weakSelf?.tableView.reloadData() - completion(nil, topSessionInfo) - } - } - - } else { - viewModel.addStickTopSession(session: session) { error, newInfo in - if let err = error { - NELog.errorLog( - ModuleName + " " + (weakSelf?.className ?? "ConversationListViewController"), - desc: "❌CALLBACK addStickTopSession failed,error = \(err)" - ) - completion(error as NSError?, nil) - return - } else { - NELog.infoLog(ModuleName + " " + (weakSelf?.className ?? "ConversationListViewController"), - desc: "✅CALLBACK addStickTopSession callback SUCCESS") - weakSelf?.viewModel.stickTopInfos[session] = newInfo - weakSelf?.viewModel.sortRecentSession() - weakSelf?.tableView.reloadData() - completion(nil, newInfo) - } - } - } - } -} - -extension NEBaseConversationListViewController: UITableViewDelegate, UITableViewDataSource { - open func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - let count = viewModel.conversationListArray?.count ?? 0 - NELog.infoLog(ModuleName + " " + "ConversationListViewController", - desc: "numberOfRowsInSection count : \(count)") - return count - } - - open func tableView(_ tableView: UITableView, - cellForRowAt indexPath: IndexPath) -> UITableViewCell { - let model = viewModel.conversationListArray?[indexPath.row] - let reusedId = "\(model?.customType ?? 0)" - let cell = tableView.dequeueReusableCell(withIdentifier: reusedId, for: indexPath) - - if let c = cell as? NEBaseConversationListCell { - c.topStickInfos = viewModel.stickTopInfos - c.configData(sessionModel: model) - } - - return cell - } - - open func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - let conversationModel = viewModel.conversationListArray?[indexPath.row] - - guard let sid = conversationModel?.recentSession?.session?.sessionId else { - return - } - guard let sessionType = conversationModel?.recentSession?.session?.sessionType else { - return - } - onselectedTableRow(sessionType: sessionType, sessionId: sid, indexPath: indexPath) - } - - open func tableView(_ tableView: UITableView, - editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? { - weak var weakSelf = self - var rowActions = [UITableViewRowAction]() - - let conversationModel = weakSelf?.viewModel.conversationListArray?[indexPath.row] - guard let recentSession = conversationModel?.recentSession, - let session = recentSession.session else { - return rowActions - } - - let deleteAction = UITableViewRowAction(style: .destructive, - title: NEKitConversationConfig.shared.ui.deleteBottonTitle) { action, indexPath in - weakSelf?.deleteActionHandler(action: action, indexPath: indexPath) - } - - // 置顶和取消置顶 - let isTop = viewModel.stickTopInfos[session] != nil - let topAction = UITableViewRowAction(style: .destructive, - title: isTop ? NEKitConversationConfig.shared.ui.stickTopBottonCancelTitle : - NEKitConversationConfig.shared.ui.stickTopBottonTitle) { action, indexPath in - weakSelf?.topActionHandler(action: action, indexPath: indexPath, isTop: isTop) - } - deleteAction.backgroundColor = NEKitConversationConfig.shared.ui.deleteBottonColor ?? deleteBottonColor - topAction.backgroundColor = NEKitConversationConfig.shared.ui.stickTopBottonColor - rowActions.append(deleteAction) - rowActions.append(topAction) - - return rowActions - } - - /* - @available(iOS 11.0, *) - public func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { - - var rowActions = [UIContextualAction]() - - let deleteAction = UIContextualAction(style: .normal, title: "删除") { (action, sourceView, completionHandler) in - - // self.dataSource.remove(at: indexPath.row) - // tableView.deleteRows(at: [indexPath], with: .automatic) - // 需要返回true,否则没有反应 - completionHandler(true) - } - deleteAction.backgroundColor = NEConstant.hexRGB(0xA8ABB6) - rowActions.append(deleteAction) - - let topAction = UIContextualAction(style: .normal, title: "置顶") { (action, sourceView, completionHandler) in - - // self.dataSource.remove(at: indexPath.row) - // tableView.deleteRows(at: [indexPath], with: .automatic) - // 需要返回true,否则没有反应 - completionHandler(true) - } - topAction.backgroundColor = NEConstant.hexRGB(0x337EFF) - rowActions.append(topAction) - - let actionConfig = UISwipeActionsConfiguration.init(actions: rowActions) - actionConfig.performsFirstActionWithFullSwipe = false - - return actionConfig - } - */ - - open func deleteActionHandler(action: UITableViewRowAction?, indexPath: IndexPath) { - let conversationModel = viewModel.conversationListArray?[indexPath.row] - if let recentSession = conversationModel?.recentSession { - viewModel.deleteRecentSession(recentSession: recentSession) - didDeleteConversationCell( - model: conversationModel ?? ConversationListModel(), - indexPath: indexPath - ) - } - } - - open func topActionHandler(action: UITableViewRowAction?, indexPath: IndexPath, isTop: Bool) { - if !NEChatDetectNetworkTool.shareInstance.isNetworkRecahability() { - showToast(localizable("network_error")) - return - } - let conversationModel = viewModel.conversationListArray?[indexPath.row] - if let recentSession = conversationModel?.recentSession { - onTopRecentAtIndexPath( - rencent: recentSession, - indexPath: indexPath, - isTop: isTop - ) { [weak self] error, sessionInfo in - if error == nil { - if isTop { - self?.didRemoveStickTopSession( - model: conversationModel ?? ConversationListModel(), - indexPath: indexPath - ) - } else { - self?.didAddStickTopSession( - model: conversationModel ?? ConversationListModel(), - indexPath: indexPath - ) - } - } - } - } - } -} - -// MARK: UI UIKit提供的重写方法 - -extension NEBaseConversationListViewController { - /// cell点击事件,可重写该事件处理自己的逻辑业务,例如跳转到指定的会话页面 - /// - Parameters: - /// - sessionType: 会话类型 - /// - sessionId: 会话id - /// - indexPath: indexpath - open func onselectedTableRow(sessionType: NIMSessionType, sessionId: String, - indexPath: IndexPath) { - if sessionType == .P2P { - let session = NIMSession(sessionId, type: .P2P) - Router.shared.use( - PushP2pChatVCRouter, - parameters: ["nav": navigationController as Any, "session": session as Any], - closure: nil - ) - } else if sessionType == .team { - let session = NIMSession(sessionId, type: .team) - Router.shared.use( - PushTeamChatVCRouter, - parameters: ["nav": navigationController as Any, "session": session as Any], - closure: nil - ) - } - } - - /// 删除会话 - /// - Parameters: - /// - model: 会话模型 - /// - indexPath: indexpath - open func didDeleteConversationCell(model: ConversationListModel, indexPath: IndexPath) {} - - /// 删除一条置顶记录 - /// - Parameters: - /// - model: 会话模型 - /// - indexPath: indexpath - open func didRemoveStickTopSession(model: ConversationListModel, indexPath: IndexPath) {} - - /// 添加一条置顶记录 - /// - Parameters: - /// - model: 会话模型 - /// - indexPath: indexpath - open func didAddStickTopSession(model: ConversationListModel, indexPath: IndexPath) {} -} - -// MARK: ================= ConversationViewModelDelegate=================== - -extension NEBaseConversationListViewController: ConversationViewModelDelegate { - open func didAddRecentSession() { - NELog.infoLog("ConversationListViewController", desc: "didAddRecentSession") - emptyView.isHidden = (viewModel.conversationListArray?.count ?? 0) > 0 - viewModel.sortRecentSession() - tableView.reloadData() - } - - open func didUpdateRecentSession(index: Int) { - let indexPath = IndexPath(row: index, section: 0) - tableView.reloadRows(at: [indexPath], with: .none) - } - - open func reloadData() { - delegate?.onDataLoaded() - } - - open func reloadTableView() { - emptyView.isHidden = (viewModel.conversationListArray?.count ?? 0) > 0 - viewModel.sortRecentSession() - tableView.reloadData() - } -} diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBaseConversationNavigationController.swift b/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBaseConversationNavigationController.swift index 786a070d..b58564e4 100644 --- a/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBaseConversationNavigationController.swift +++ b/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBaseConversationNavigationController.swift @@ -8,7 +8,7 @@ import UIKit @objcMembers open class NEBaseConversationNavigationController: UIViewController, UIGestureRecognizerDelegate { var topConstant: CGFloat = 0 - public let customNavigationView = NENavigationView() + public let navigationView = NENavigationView() override open var title: String? { get { @@ -17,7 +17,7 @@ open class NEBaseConversationNavigationController: UIViewController, UIGestureRe set { super.title = newValue - customNavigationView.navTitle.text = newValue + navigationView.navTitle.text = newValue } } @@ -32,15 +32,15 @@ open class NEBaseConversationNavigationController: UIViewController, UIGestureRe } else { navigationController?.isNavigationBarHidden = true topConstant = NEConstant.navigationAndStatusHeight - customNavigationView.translatesAutoresizingMaskIntoConstraints = false - customNavigationView.addBackButtonTarget(target: self, selector: #selector(backEvent)) - customNavigationView.moreButton.isHidden = true - view.addSubview(customNavigationView) + navigationView.translatesAutoresizingMaskIntoConstraints = false + navigationView.addBackButtonTarget(target: self, selector: #selector(backEvent)) + navigationView.moreButton.isHidden = true + view.addSubview(navigationView) NSLayoutConstraint.activate([ - customNavigationView.leftAnchor.constraint(equalTo: view.leftAnchor), - customNavigationView.rightAnchor.constraint(equalTo: view.rightAnchor), - customNavigationView.topAnchor.constraint(equalTo: view.topAnchor), - customNavigationView.heightAnchor.constraint(equalToConstant: topConstant), + navigationView.leftAnchor.constraint(equalTo: view.leftAnchor), + navigationView.rightAnchor.constraint(equalTo: view.rightAnchor), + navigationView.topAnchor.constraint(equalTo: view.topAnchor), + navigationView.heightAnchor.constraint(equalToConstant: topConstant), ]) } } diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBaseConversationSearchController.swift b/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBaseConversationSearchController.swift index ae04522f..b0a596e4 100644 --- a/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBaseConversationSearchController.swift +++ b/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBaseConversationSearchController.swift @@ -12,16 +12,24 @@ open class NEBaseConversationSearchController: NEBaseConversationNavigationContr var viewModel = ConversationSearchViewModel() var tag = "ConversationSearchBaseController" var searchStr = "" - var headTitleArr = [ - localizable("friend"), - localizable("discussion_group"), - localizable("senior_group"), - ] + var headTitleArr = [localizable("friend")] override open func viewDidLoad() { super.viewDidLoad() - setupSubviews() initialConfig() + setupSubviews() + + DispatchQueue.main.asyncAfter(deadline: .now() + 0.5, execute: DispatchWorkItem(block: { [weak self] in + self?.searchTextField.becomeFirstResponder() + })) + } + + open func initialConfig() { + title = localizable("search") + + // 可在此处选择是否展示群聊结果 + headTitleArr.append(contentsOf: [localizable("discussion_group"), + localizable("senior_group")]) } open func setupSubviews() { @@ -30,17 +38,13 @@ open class NEBaseConversationSearchController: NEBaseConversationNavigationContr view.addSubview(emptyView) NSLayoutConstraint.activate([ - emptyView.rightAnchor.constraint(equalTo: tableView.rightAnchor), - emptyView.leftAnchor.constraint(equalTo: tableView.leftAnchor), - emptyView.bottomAnchor.constraint(equalTo: tableView.bottomAnchor), - emptyView.topAnchor.constraint(equalTo: tableView.topAnchor), + emptyView.centerXAnchor.constraint(equalTo: view.centerXAnchor), + emptyView.topAnchor.constraint(equalTo: view.topAnchor), + emptyView.widthAnchor.constraint(equalToConstant: 200), + emptyView.heightAnchor.constraint(equalToConstant: 200), ]) } - open func initialConfig() { - title = localizable("search") - } - // MARK: private method open func searchTextFieldChange(textfield: SearchTextField) { @@ -110,7 +114,7 @@ open class NEBaseConversationSearchController: NEBaseConversationNavigationContr textField.clearButtonMode = .always textField.returnKeyType = .search textField.addTarget(self, action: #selector(searchTextFieldChange), for: .editingChanged) - textField.placeholder = localizable("search") + if let clearButton = textField.value(forKey: "_clearButton") as? UIButton { clearButton.accessibilityIdentifier = "id.clear" } @@ -133,7 +137,7 @@ open class NEBaseConversationSearchController: NEBaseConversationNavigationContr // MARK: UITableViewDelegate, UITableViewDataSource open func numberOfSections(in tableView: UITableView) -> Int { - 3 + headTitleArr.count } open func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBasePopListViewController.swift b/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBasePopListViewController.swift index 508af45b..09627be4 100644 --- a/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBasePopListViewController.swift +++ b/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/Controller/NEBasePopListViewController.swift @@ -20,15 +20,28 @@ open class PopListItem: NSObject { @objcMembers open class NEBasePopListViewController: UIViewController { - public var itemDatas = [PopListItem]() public let shadowView = UIView() public var buttonHeight: CGFloat = 32.0 let popView = UIView() public var popViewWidth: CGFloat = 122.0 + var popViewHeight: CGFloat = 0 public var popViewRadius: CGFloat = 8.0 + public var topConstant: CGFloat = 0 + + public var itemDatas = [PopListItem]() { + didSet { + popViewHeight = CGFloat(itemDatas.count) * 32 + 16 + } + } override public func viewDidLoad() { super.viewDidLoad() + if let useSystemNav = NEConfigManager.instance.getParameter(key: useSystemNav) as? Bool, useSystemNav { + navigationController?.isNavigationBarHidden = false + topConstant = 10 + } else { + topConstant = NEConstant.navigationAndStatusHeight + } setupUI() } @@ -42,12 +55,17 @@ open class NEBasePopListViewController: UIViewController { shadowView.translatesAutoresizingMaskIntoConstraints = false shadowView.backgroundColor = .clear - view.addSubview(shadowView) shadowView.clipsToBounds = false shadowView.layer.shadowOffset = CGSize(width: 0, height: 4) - shadowView.layer.shadowColor = NEConstant.hexRGB(0x85888C).cgColor + shadowView.layer.shadowColor = UIColor.ne_operationBorderColor.cgColor shadowView.layer.shadowOpacity = 0.25 shadowView.layer.shadowRadius = 7 + view.addSubview(shadowView) + + NSLayoutConstraint.activate([ + shadowView.widthAnchor.constraint(equalToConstant: popViewWidth), + shadowView.heightAnchor.constraint(equalToConstant: popViewHeight), + ]) shadowView.addSubview(popView) popView.clipsToBounds = true diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/ViewModel/ConversationViewModel.swift b/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/ViewModel/ConversationViewModel.swift index b1386211..901e7929 100644 --- a/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/ViewModel/ConversationViewModel.swift +++ b/NEConversationUIKit/NEConversationUIKit/Classes/Conversation/ViewModel/ConversationViewModel.swift @@ -4,6 +4,7 @@ import Foundation import NEChatKit +import NECoreIMKit import NIMSDK let revokeLocalMessage = "revoke_message_local" @@ -89,6 +90,9 @@ public class ConversationViewModel: NSObject, ConversationRepoDelegate, } } weakSelf?.cacheAddSessionDic.removeAll() + + // 可在此处对会话列表进行过滤 + NELog.infoLog(ModuleName, desc: "conversationListArray count : \(weakSelf?.conversationListArray?.count ?? 0)") completion(error, weakSelf?.conversationListArray) } @@ -307,15 +311,11 @@ public class ConversationViewModel: NSObject, ConversationRepoDelegate, } listModel.recentSession = recentSession if recentSession.session?.sessionType == .P2P { - repo.getUserInfo(userId: targetId) { user, error in + repo.fetchUserInfo(accountList: [targetId]) { users, error in if error == nil { - listModel.userInfo = user + listModel.userInfo = users?.first if let model = weakSelf?.sessionIsExist(listModel) { - NELog.infoLog( - ModuleName, - desc: #function + "conversation session user : " + "\(user?.userId ?? "nil")" - ) - model.userInfo = user + model.userInfo = users?.first } else { weakSelf?.conversationListArray?.append(listModel) } @@ -327,27 +327,31 @@ public class ConversationViewModel: NSObject, ConversationRepoDelegate, repo.getTeamInfo(teamId: targetId) { error, teamInfo in listModel.teamInfo = teamInfo if let model = weakSelf?.sessionIsExist(listModel) { - NELog.infoLog( - ModuleName, - desc: #function + "conversation session team : " + "\(teamInfo?.teamId ?? "nil")" - ) model.teamInfo = teamInfo + weakSelf?.delegate?.didAddRecentSession() } else { + // 会话列表新增一项 weakSelf?.conversationListArray?.append(listModel) + weakSelf?.delegate?.didAddRecentSession() } - weakSelf?.delegate?.didAddRecentSession() } } } public func didUpdate(_ recentSession: NIMRecentSession, totalUnreadCount: Int) { + guard let targetId = recentSession.session?.sessionId else { + NELog.errorLog(ModuleName + " " + className, desc: "❌sessionId is nil") + return + } + NELog.infoLog( ModuleName + " " + className, - desc: #function + "recentSession, didUpdate sessionId: " + (recentSession.session?.sessionId ?? "nil" + " unread count : \(totalUnreadCount)") + desc: #function + "recentSession, didUpdate sessionId: \(targetId), unread count : \(totalUnreadCount)" ) - if let sessionId = recentSession.session?.sessionId, recentSession.unreadCount <= 0 { - if NEAtMessageManager.instance.isAtCurrentUser(sessionId: sessionId) == true { - NEAtMessageManager.instance.clearAtRecord(sessionId) + + if recentSession.unreadCount <= 0 { + if NEAtMessageManager.instance?.isAtCurrentUser(sessionId: targetId) == true { + NEAtMessageManager.instance?.clearAtRecord(targetId) } } @@ -356,7 +360,7 @@ public class ConversationViewModel: NSObject, ConversationRepoDelegate, if content.operationType == .dismiss || (content.operationType == .leave && content.sourceID == NIMSDK.shared().loginManager.currentAccount()) { NELog.infoLog( ModuleName + " " + className, - desc: #function + "didUpdate team dismiss or leave noti" + (recentSession.session?.sessionId ?? "nil") + desc: #function + "didUpdate team dismiss or leave noti: \(targetId)" ) repo.deleteLocalSession(recentSession: recentSession) return @@ -364,15 +368,14 @@ public class ConversationViewModel: NSObject, ConversationRepoDelegate, } } - if let sid = recentSession.session?.sessionId { - cacheUpdateSessionDic[sid] = recentSession - if let model = cacheAddSessionDic[sid], let recent = model.recentSession { - if let time1 = recentSession.lastMessage?.timestamp, let time2 = recent.lastMessage?.timestamp, time1 > time2 { - model.recentSession = recentSession - } + cacheUpdateSessionDic[targetId] = recentSession + if let model = cacheAddSessionDic[targetId], let recent = model.recentSession { + if let time1 = recentSession.lastMessage?.timestamp, let time2 = recent.lastMessage?.timestamp, time1 > time2 { + model.recentSession = recentSession } } + weak var weakSelf = self if let _ = conversationListArray { for i in 0 ..< conversationListArray!.count { let listModel = conversationListArray![i] @@ -380,9 +383,20 @@ public class ConversationViewModel: NSObject, ConversationRepoDelegate, ModuleName + " " + className, desc: #function + "update session id : " + (listModel.recentSession?.session?.sessionId ?? "nil") ) - if recentSession.session?.sessionId == listModel.recentSession?.session?.sessionId { + if targetId == listModel.recentSession?.session?.sessionId { listModel.recentSession = recentSession - delegate?.reloadTableView() + if recentSession.session?.sessionType == .P2P { + repo.fetchUserInfo(accountList: [targetId]) { users, error in + if error == nil { + listModel.userInfo = users?.first + } + } + } else if recentSession.session?.sessionType == .team { + repo.getTeamInfo(teamId: targetId) { error, teamInfo in + listModel.teamInfo = teamInfo + } + } + weakSelf?.delegate?.reloadTableView() break } } @@ -390,13 +404,18 @@ public class ConversationViewModel: NSObject, ConversationRepoDelegate, } public func didRemove(_ recentSession: NIMRecentSession, totalUnreadCount: Int) { + guard let targetId = recentSession.session?.sessionId else { + NELog.errorLog(ModuleName + " " + className, desc: "❌sessionId is nil") + return + } + NELog.infoLog( ModuleName + " " + className, - desc: #function + ",didRemove recentSession sessionId:" + (recentSession.session?.sessionId ?? "nil") + desc: #function + ",didRemove recentSession sessionId: \(targetId)" ) - if let sid = recentSession.session?.sessionId { - cacheUpdateSessionDic.removeValue(forKey: sid) - } + + cacheUpdateSessionDic.removeValue(forKey: targetId) + if let conversationArr = conversationListArray { for i in 0 ..< conversationArr.count { if conversationArr[i].recentSession?.session?.sessionId.count ?? 0 <= 0 { @@ -409,7 +428,7 @@ public class ConversationViewModel: NSObject, ConversationRepoDelegate, .sessionId { NELog.infoLog( ModuleName + " " + className, - desc: #function + ",remove session list at index : \(i) sessionid : \(recentSession.session?.sessionId ?? "")" + desc: #function + ",remove session list at index : \(i) sessionid : \(targetId)" ) conversationListArray?.remove(at: i) diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/ConversationConfig/ConversationUIConfig.swift b/NEConversationUIKit/NEConversationUIKit/Classes/ConversationConfig/ConversationUIConfig.swift index 0db27d38..67d155a8 100644 --- a/NEConversationUIKit/NEConversationUIKit/Classes/ConversationConfig/ConversationUIConfig.swift +++ b/NEConversationUIKit/NEConversationUIKit/Classes/ConversationConfig/ConversationUIConfig.swift @@ -14,48 +14,98 @@ public enum NEConversationAvatarType: Int { @objcMembers public class ConversationUIConfig: NSObject { - /// 头像圆角大小 - public var avatarCornerRadius = 4.0 + /// 是否展示界面顶部的标题栏 + public var showTitleBar = true - /// 头像类型 - public var avatarType: NEConversationAvatarType? + /// 是否展示标题栏左侧图标 + public var showTitleBarLeftIcon = true - /// 是否隐藏导航栏 - public var hiddenNav = false + /// 是否展示标题栏次最右侧图标 + public var showTitleBarRight2Icon = true - /// 是否隐藏搜索按钮 - public var hiddenSearchBtn = false + /// 是否展示标题栏最右侧图标 + public var showTitleBarRightIcon = true - /// 是否把顶部添加按钮和搜索按钮都隐藏 - public var hiddenRightBtns = false + /// 标题栏左侧图标 + public var titleBarLeftRes: UIImage? - // 主标题字体大小 - public var titleFont: UIFont? + /// 标题栏最右侧图标 + public var titleBarRightRes: UIImage? - // 副标题字体大小 - public var subTitleFont = UIFont.systemFont(ofSize: 13) + /// 标题栏次最右侧图标 + public var titleBarRight2Res: UIImage? - // 主标题字体颜色 - public var titleColor = UIColor.ne_darkText + /// 标题栏的文案 + public var titleBarTitle: String? - // 副标题字体颜色 - public var subTitleColor = UIColor.ne_lightText + /// 标题栏的颜色值 + public var titleBarTitleColor: UIColor? - /// 时间字体颜色 - public var timeColor = UIColor(hexString: "0xcccccc") - - /// 时间字体大小 - public var timeFont = UIFont.systemFont(ofSize: 12) + /// 会话列表页面的 UI 个性化定制 + public var conversationProperties = ConversationProperties() /// 会话列表 cell 左划置顶按钮文案内容 public var stickTopBottonTitle = localizable("stickTop") - /// 会话列表 cell 左划取消置顶按钮文案内容 + /// 会话列表 cell 左划取消置顶按钮文案内容(会话置顶后生效) public var stickTopBottonCancelTitle = localizable("cancel_stickTop") - /// 会话列表 cell 左划置顶按钮文案颜色 - public var stickTopBottonColor = NEConstant.hexRGB(0x337EFF) + /// 会话列表 cell 左划置顶按钮背景颜色 + public var stickTopBottonBackgroundColor: UIColor? + /// 会话列表 cell 左划置顶按钮点击事件 + public var stickTopBottonClick: ((ConversationListModel?, IndexPath) -> Void)? /// 会话列表 cell 左划删除按钮文案内容 public var deleteBottonTitle = localizable("delete") - /// 会话列表 cell 左划删除按钮文案颜色 - public var deleteBottonColor: UIColor? + /// 会话列表 cell 左划删除按钮背景颜色 + public var deleteBottonBackgroundColor: UIColor? + /// 会话列表 cell 左划删除按钮点击事件 + public var deleteBottonClick: ((ConversationListModel?, IndexPath) -> Void)? + + /// 标题栏左侧按钮点击事件 + public var titleBarLeftClick: (() -> Void)? + + /// 标题栏最右侧按钮点击事件 + public var titleBarRightClick: (() -> Void)? + + /// 标题栏次最右侧按钮点击事件 + public var titleBarRight2Click: (() -> Void)? + + /// 会话列表点击事件 + public var itemClick: ((ConversationListModel?, IndexPath) -> Void)? + + /// 会话列表的视图控制器回调,回调中会返回会话列表的视图控制器 + public var customController: ((NEBaseConversationController) -> Void)? +} + +/// 会话列表页面的 UI 个性化定制 +@objcMembers +public class ConversationProperties: NSObject { + /// 头像圆角大小 + public var avatarCornerRadius = 4.0 + + /// 头像类型 + public var avatarType: NEConversationAvatarType? + + /// 未被置顶的会话项的背景色 + public var itemBackground: UIColor? + + /// 置顶的会话项的背景色 + public var itemStickTopBackground: UIColor? + + // 会话标题的字体大小 + public var itemTitleSize: CGFloat = 0 + + // 会话消息缩略内容的字体大小 + public var itemContentSize: CGFloat = 0 + + /// 时间字体大小 + public var itemDateSize: CGFloat = 0 + + // 会话标题的字体颜色 + public var itemTitleColor = UIColor.ne_darkText + + // 会话消息缩略内容的字体颜色 + public var itemContentColor = UIColor.ne_lightText + + /// 会话时间的字体颜色 + public var itemDateColor = UIColor(hexString: "0xcccccc") } diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/FunUI/Cell/FunConversationListCell.swift b/NEConversationUIKit/NEConversationUIKit/Classes/FunUI/Cell/FunConversationListCell.swift index d140cbac..2079eea4 100644 --- a/NEConversationUIKit/NEConversationUIKit/Classes/FunUI/Cell/FunConversationListCell.swift +++ b/NEConversationUIKit/NEConversationUIKit/Classes/FunUI/Cell/FunConversationListCell.swift @@ -21,7 +21,7 @@ open class FunConversationListCell: NEBaseConversationListCell { headImge.heightAnchor.constraint(equalToConstant: 48), ]) - title.font = NEKitConversationConfig.shared.ui.titleFont ?? UIFont.systemFont(ofSize: 17) + title.font = .systemFont(ofSize: NEKitConversationConfig.shared.ui.conversationProperties.itemTitleSize > 0 ? NEKitConversationConfig.shared.ui.conversationProperties.itemTitleSize : 17) NSLayoutConstraint.activate([ title.leftAnchor.constraint(equalTo: headImge.rightAnchor, constant: 12), title.rightAnchor.constraint(equalTo: timeLabel.leftAnchor, constant: -5), @@ -48,9 +48,9 @@ open class FunConversationListCell: NEBaseConversationListCell { } override func initSubviewsLayout() { - if NEKitConversationConfig.shared.ui.avatarType == .rectangle { - headImge.layer.cornerRadius = NEKitConversationConfig.shared.ui.avatarCornerRadius - } else if NEKitConversationConfig.shared.ui.avatarType == .cycle { + if NEKitConversationConfig.shared.ui.conversationProperties.avatarType == .rectangle { + headImge.layer.cornerRadius = NEKitConversationConfig.shared.ui.conversationProperties.avatarCornerRadius + } else if NEKitConversationConfig.shared.ui.conversationProperties.avatarType == .cycle { headImge.layer.cornerRadius = 24.0 } else { headImge.layer.cornerRadius = 4.0 @@ -65,9 +65,9 @@ open class FunConversationListCell: NEBaseConversationListCell { if let session = sessionModel?.recentSession?.session { let isTop = topStickInfos[session] != nil if isTop { - contentView.backgroundColor = .funConversationBackgroundColor + contentView.backgroundColor = NEKitConversationConfig.shared.ui.conversationProperties.itemStickTopBackground ?? .funConversationBackgroundColor } else { - contentView.backgroundColor = .white + contentView.backgroundColor = NEKitConversationConfig.shared.ui.conversationProperties.itemBackground ?? .white } } } diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/FunUI/Controller/FunConversationController.swift b/NEConversationUIKit/NEConversationUIKit/Classes/FunUI/Controller/FunConversationController.swift index be5b371a..3124592c 100644 --- a/NEConversationUIKit/NEConversationUIKit/Classes/FunUI/Controller/FunConversationController.swift +++ b/NEConversationUIKit/NEConversationUIKit/Classes/FunUI/Controller/FunConversationController.swift @@ -11,7 +11,14 @@ import UIKit open class FunConversationController: NEBaseConversationController { override public init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) - listCtrl = FunConversationListViewController() + className = "FunConversationController" + deleteBottonBackgroundColor = .funConversationdeleteActionColor + cellRegisterDic = [0: FunConversationListCell.self] + brokenNetworkViewHeight = 48 + brokenNetworkView.errorIcon.isHidden = false + brokenNetworkView.backgroundColor = .funConversationNetworkBrokenBackgroundColor + brokenNetworkView.content.textColor = .funConversationNetworkBrokenTitleColor + emptyView.setEmptyImage(name: "fun_user_empty") } public required init?(coder: NSCoder) { @@ -29,8 +36,8 @@ open class FunConversationController: NEBaseConversationController { override open func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .funConversationBackgroundColor - navView.backgroundColor = .funConversationBackgroundColor - navView.bottomLine.isHidden = true + navigationView.backgroundColor = .funConversationBackgroundColor + navigationView.titleBarBottomLine.isHidden = true } deinit { @@ -50,97 +57,47 @@ open class FunConversationController: NEBaseConversationController { navigationItem.rightBarButtonItems = [addBarItem] - navView.searchBtn.isHidden = true - if NEKitConversationConfig.shared.ui.hiddenRightBtns { + navigationView.searchBtn.isHidden = true + if !NEKitConversationConfig.shared.ui.showTitleBarRightIcon { navigationItem.rightBarButtonItems = [] - navView.addBtn.isHidden = true + navigationView.addBtn.isHidden = true } } override open func setupSubviews() { super.setupSubviews() + let tap = UITapGestureRecognizer(target: self, action: #selector(searchAction)) tap.cancelsTouchesInView = false searchView.addGestureRecognizer(tap) - view.addSubview(searchView) + bodyTopView.addSubview(searchView) + bodyTopViewHeight = 60 NSLayoutConstraint.activate([ - searchView.topAnchor.constraint(equalTo: navView.bottomAnchor, constant: 12), - searchView.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 8), - searchView.rightAnchor.constraint(equalTo: view.rightAnchor, constant: -8), + searchView.topAnchor.constraint(equalTo: bodyTopView.topAnchor, constant: 12), + searchView.leftAnchor.constraint(equalTo: bodyTopView.leftAnchor, constant: 8), + searchView.rightAnchor.constraint(equalTo: bodyTopView.rightAnchor, constant: -8), searchView.heightAnchor.constraint(equalToConstant: 36), ]) - NSLayoutConstraint.activate([ - listCtrl.view.topAnchor.constraint(equalTo: searchView.bottomAnchor, constant: 12), - listCtrl.view.leftAnchor.constraint(equalTo: view.leftAnchor), - listCtrl.view.rightAnchor.constraint(equalTo: view.rightAnchor), - listCtrl.view.bottomAnchor.constraint(equalTo: view.bottomAnchor), - ]) - } - - // MARK: lazyMethod + popListController = FunPopListViewController() - public lazy var popListController: FunPopListViewController = { - let popController = FunPopListViewController() - popController.popView.backgroundColor = UIColor.funConversationPopViewBg - return popController - }() -} - -extension FunConversationController { - override open func searchAction() { - let searchVC = FunConversationSearchController() - navigationController?.pushViewController(searchVC, animated: true) + tableView.rowHeight = 72 + tableView.backgroundColor = .funConversationBackgroundColor } - override open func didClickAddBtn() { - print("add click") - - if children.contains(popListController) == false { - popListController.itemDatas = getPopListItems() - addChild(popListController) - popListController.view.frame = view.frame - } - if popListController.view.superview != nil { - popListController.removeSelf() - } else { - view.addSubview(popListController.view) - } - } - - open func getPopListItems() -> [PopListItem] { - weak var weakSelf = self - var items = [PopListItem]() - let addFriend = PopListItem() - addFriend.showName = localizable("add_friend") + override open func getPopListItems() -> [PopListItem] { + let items = super.getPopListItems() + let addFriend = items[0] addFriend.showNameColor = .white addFriend.image = UIImage.ne_imageNamed(name: "funAddFriend") - addFriend.completion = { - Router.shared.use( - ContactAddFriendRouter, - parameters: ["nav": self.navigationController as Any] - ) { obj, routerState, str in - } - } - items.append(addFriend) - let createGroup = PopListItem() - createGroup.showName = localizable("create_discussion_group") + let createGroup = items[1] createGroup.showNameColor = .white createGroup.image = UIImage.ne_imageNamed(name: "funCreateTeam") - createGroup.completion = { - weakSelf?.createDiscussGroup() - } - items.append(createGroup) - let createDicuss = PopListItem() - createDicuss.showName = localizable("create_senior_group") + let createDicuss = items[2] createDicuss.showNameColor = .white createDicuss.image = UIImage.ne_imageNamed(name: "funCreateTeam") - createDicuss.completion = { - weakSelf?.createSeniorGroup() - } - items.append(createDicuss) return items } diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/FunUI/Controller/FunConversationListViewController.swift b/NEConversationUIKit/NEConversationUIKit/Classes/FunUI/Controller/FunConversationListViewController.swift deleted file mode 100644 index b4385fde..00000000 --- a/NEConversationUIKit/NEConversationUIKit/Classes/FunUI/Controller/FunConversationListViewController.swift +++ /dev/null @@ -1,85 +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 NIMSDK -import UIKit - -@objcMembers -open class FunConversationListViewController: NEBaseConversationListViewController { - override public init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { - super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) - className = "FunConversationListViewController" - deleteBottonColor = .funConversationdeleteActionColor - registerCellDic = [0: FunConversationListCell.self] - networkToolHeight = 48 - brokenNetworkView.errorIcon.isHidden = false - brokenNetworkView.backgroundColor = .funConversationNetworkBrokenBackgroundColor - brokenNetworkView.content.textColor = .funConversationNetworkBrokenTitleColor - emptyView.setEmptyImage(name: "fun_user_empty") - } - - public required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - override open func setupSubviews() { - super.setupSubviews() - tableView.rowHeight = 72 - tableView.backgroundColor = .funConversationBackgroundColor - } -} - -// MARK: ==========FunConversationListCellDelegate============ - -extension FunConversationListViewController { - open func getPopListItems(cell: UITableViewCell, contentModel: ConversationListModel?) -> [PopListItem] { - weak var weakSelf = self - var items = [PopListItem]() - - guard let recentSession = contentModel?.recentSession, - let session = recentSession.session, - let cellIndex = tableView.indexPath(for: cell) else { - return [PopListItem]() - } - let isTop = viewModel.stickTopInfos[session] != nil - - let stickTopItem = PopListItem() - stickTopItem.showName = isTop ? NEKitConversationConfig.shared.ui.stickTopBottonCancelTitle : - NEKitConversationConfig.shared.ui.stickTopBottonTitle - stickTopItem.showNameColor = .black - stickTopItem.completion = { - weakSelf?.topActionHandler(action: nil, indexPath: cellIndex, isTop: isTop) - } - items.append(stickTopItem) - - let deleteItem = PopListItem() - deleteItem.showName = NEKitConversationConfig.shared.ui.deleteBottonTitle - deleteItem.showNameColor = .black - deleteItem.completion = { - weakSelf?.deleteActionHandler(action: nil, indexPath: cellIndex) - } - items.append(deleteItem) - - return items - } - -// public func didLongPressConversationView(_ cell: UITableViewCell, _ longPress: UILongPressGestureRecognizer, _ contentModel: ConversationListModel?) { -// let popListController = FunPopListViewController() -// popListController.popView.backgroundColor = .white -// popListController.itemDatas = getPopListItems(cell: cell, contentModel: contentModel) -// addChild(popListController) -// view.addSubview(popListController.view) -// popListController.view.bounds = UIScreen.main.bounds -// -// if let cellIndexPath = tableView.indexPath(for: cell) { -// let y = longPress.location(in: view).y -// let shadowHeight = popListController.shadowView.frame.size.height -// if (y + shadowHeight) > (NEConstant.screenHeight - NEConstant.navigationAndStatusHeight - 123) { -// popListController.shadowViewTopAnchor?.constant = y - shadowHeight -// } else { -// popListController.shadowViewTopAnchor?.constant = y -// } -// } -// } -} diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/FunUI/Controller/FunConversationSearchController.swift b/NEConversationUIKit/NEConversationUIKit/Classes/FunUI/Controller/FunConversationSearchController.swift index add9cd6a..55aa8002 100644 --- a/NEConversationUIKit/NEConversationUIKit/Classes/FunUI/Controller/FunConversationSearchController.swift +++ b/NEConversationUIKit/NEConversationUIKit/Classes/FunUI/Controller/FunConversationSearchController.swift @@ -20,7 +20,7 @@ open class FunConversationSearchController: NEBaseConversationSearchController { super.viewDidLoad() view.backgroundColor = .funConversationBackgroundColor navigationController?.isNavigationBarHidden = true - customNavigationView.isHidden = true + navigationView.isHidden = true emptyView.setEmptyImage(name: "fun_user_empty") } @@ -73,7 +73,10 @@ open class FunConversationSearchController: NEBaseConversationSearchController { if #available(iOS 15.0, *) { tableView.sectionHeaderTopPadding = 0 } - searchTextField.becomeFirstResponder() + + DispatchQueue.main.asyncAfter(deadline: .now() + 0.5, execute: DispatchWorkItem(block: { [weak self] in + self?.searchTextField.becomeFirstResponder() + })) } // MARK: UITableViewDelegate, UITableViewDataSource diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/FunUI/Controller/FunPopListViewController.swift b/NEConversationUIKit/NEConversationUIKit/Classes/FunUI/Controller/FunPopListViewController.swift index 80635773..05daba7f 100644 --- a/NEConversationUIKit/NEConversationUIKit/Classes/FunUI/Controller/FunPopListViewController.swift +++ b/NEConversationUIKit/NEConversationUIKit/Classes/FunUI/Controller/FunPopListViewController.swift @@ -9,8 +9,6 @@ import UIKit @objcMembers open class FunPopListViewController: NEBasePopListViewController { - public var shadowViewTopAnchor: NSLayoutConstraint? - public var triangleView: UIView = { let view = UIView() view.translatesAutoresizingMaskIntoConstraints = false @@ -21,16 +19,12 @@ open class FunPopListViewController: NEBasePopListViewController { override func setupUI() { super.setupUI() - - let popViewHeight = CGFloat(itemDatas.count) * 32 + 16 - NSLayoutConstraint.activate([ + shadowView.topAnchor.constraint(equalTo: view.topAnchor, constant: topConstant), shadowView.rightAnchor.constraint(equalTo: view.rightAnchor, constant: -8), - shadowView.widthAnchor.constraint(equalToConstant: popViewWidth), - shadowView.heightAnchor.constraint(equalToConstant: popViewHeight), ]) - shadowViewTopAnchor = shadowView.topAnchor.constraint(equalTo: view.topAnchor, constant: NEConstant.navigationAndStatusHeight) - shadowViewTopAnchor?.isActive = true + + popView.backgroundColor = UIColor.funConversationPopViewBg view.insertSubview(triangleView, aboveSubview: shadowView) NSLayoutConstraint.activate([ @@ -38,7 +32,6 @@ open class FunPopListViewController: NEBasePopListViewController { triangleView.heightAnchor.constraint(equalToConstant: 11), triangleView.rightAnchor.constraint(equalTo: view.rightAnchor, constant: -25), triangleView.topAnchor.constraint(equalTo: popView.topAnchor, constant: -5), - ]) } } diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/FunUI/FunConversationRouter.swift b/NEConversationUIKit/NEConversationUIKit/Classes/FunUI/FunConversationRouter.swift index 88d7dfaa..c8323663 100644 --- a/NEConversationUIKit/NEConversationUIKit/Classes/FunUI/FunConversationRouter.swift +++ b/NEConversationUIKit/NEConversationUIKit/Classes/FunUI/FunConversationRouter.swift @@ -21,7 +21,7 @@ public extension ConversationRouter { Router.shared.register("ClearAtMessageRemind") { param in if let sessionId = param["sessionId"] as? String { - NEAtMessageManager.instance.clearAtRecord(sessionId) + NEAtMessageManager.instance?.clearAtRecord(sessionId) } } } diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/Manager/NEAtMessageManager.swift b/NEConversationUIKit/NEConversationUIKit/Classes/Manager/NEAtMessageManager.swift index 18e5ecec..99a6d4be 100644 --- a/NEConversationUIKit/NEConversationUIKit/Classes/Manager/NEAtMessageManager.swift +++ b/NEConversationUIKit/NEConversationUIKit/Classes/Manager/NEAtMessageManager.swift @@ -24,13 +24,13 @@ public class AtMEMessageRecord: NSObject { @objcMembers public class NEAtMessageManager: NSObject, NIMChatManagerDelegate, NIMLoginManagerDelegate { - public static let instance = NEAtMessageManager() + public static var instance: NEAtMessageManager? private let workQueue = DispatchQueue(label: "AtMessageWorkQueue") private let lock = NSLock() private var atMessageDic = [String: AtMEMessageRecord]() private var currentAccid = "" - override public init() { + override private init() { super.init() NIMSDK.shared().chatManager.add(self) NIMSDK.shared().loginManager.add(self) @@ -41,6 +41,10 @@ public class NEAtMessageManager: NSObject, NIMChatManagerDelegate, NIMLoginManag NIMSDK.shared().loginManager.remove(self) } + public static func setupInstance() { + NEAtMessageManager.instance = NEAtMessageManager() + } + public func onLogin(_ step: NIMLoginStep) { if step == .loginOK { NELog.infoLog(className(), desc: "login ok") diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/NormalUI/Cell/ConversationListCell.swift b/NEConversationUIKit/NEConversationUIKit/Classes/NormalUI/Cell/ConversationListCell.swift index 0741aa0d..d772dd7c 100644 --- a/NEConversationUIKit/NEConversationUIKit/Classes/NormalUI/Cell/ConversationListCell.swift +++ b/NEConversationUIKit/NEConversationUIKit/Classes/NormalUI/Cell/ConversationListCell.swift @@ -36,9 +36,9 @@ open class ConversationListCell: NEBaseConversationListCell { } override func initSubviewsLayout() { - if NEKitConversationConfig.shared.ui.avatarType == .rectangle { - headImge.layer.cornerRadius = NEKitConversationConfig.shared.ui.avatarCornerRadius - } else if NEKitConversationConfig.shared.ui.avatarType == .cycle { + if NEKitConversationConfig.shared.ui.conversationProperties.avatarType == .rectangle { + headImge.layer.cornerRadius = NEKitConversationConfig.shared.ui.conversationProperties.avatarCornerRadius + } else if NEKitConversationConfig.shared.ui.conversationProperties.avatarType == .cycle { headImge.layer.cornerRadius = 21.0 } else { headImge.layer.cornerRadius = 21.0 @@ -52,9 +52,9 @@ open class ConversationListCell: NEBaseConversationListCell { if let session = sessionModel?.recentSession?.session { let isTop = topStickInfos[session] != nil if isTop { - contentView.backgroundColor = UIColor(hexString: "0xF3F5F7") + contentView.backgroundColor = NEKitConversationConfig.shared.ui.conversationProperties.itemStickTopBackground ?? UIColor(hexString: "0xF3F5F7") } else { - contentView.backgroundColor = .white + contentView.backgroundColor = NEKitConversationConfig.shared.ui.conversationProperties.itemBackground ?? .white } } } diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/NormalUI/Controller/ConversationController.swift b/NEConversationUIKit/NEConversationUIKit/Classes/NormalUI/Controller/ConversationController.swift index 604818ef..7fa791db 100644 --- a/NEConversationUIKit/NEConversationUIKit/Classes/NormalUI/Controller/ConversationController.swift +++ b/NEConversationUIKit/NEConversationUIKit/Classes/NormalUI/Controller/ConversationController.swift @@ -11,8 +11,9 @@ import UIKit @objcMembers open class ConversationController: NEBaseConversationController { override public init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { - super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) - listCtrl = ConversationListViewController() + super.init(nibName: nil, bundle: nil) + className = "ConversationController" + cellRegisterDic = [0: ConversationListCell.self] } public required init?(coder: NSCoder) { @@ -21,7 +22,7 @@ open class ConversationController: NEBaseConversationController { override open func viewDidLoad() { super.viewDidLoad() - view.backgroundColor = UIColor(hexString: "#e9eff5") + view.backgroundColor = .ne_navLineColor } override func initSystemNav() { @@ -42,92 +43,22 @@ open class ConversationController: NEBaseConversationController { spaceBarItem.width = NEConstant.screenInterval navigationItem.rightBarButtonItems = [addBarItem, spaceBarItem, searchBarItem] - if NEKitConversationConfig.shared.ui.hiddenSearchBtn { - navView.searchBtn.isHidden = true + if !NEKitConversationConfig.shared.ui.showTitleBarRight2Icon { + navigationView.searchBtn.isHidden = true navigationItem.rightBarButtonItems = [addBarItem] } - if NEKitConversationConfig.shared.ui.hiddenRightBtns { - navigationItem.rightBarButtonItems = [] - navView.searchBtn.isHidden = true - navView.addBtn.isHidden = true + if !NEKitConversationConfig.shared.ui.showTitleBarRightIcon { + navigationView.addBtn.isHidden = true + navigationItem.rightBarButtonItems = [searchBarItem] } } override open func setupSubviews() { super.setupSubviews() - NSLayoutConstraint.activate([ - listCtrl.view.topAnchor.constraint(equalTo: navView.bottomAnchor), - listCtrl.view.leftAnchor.constraint(equalTo: view.leftAnchor), - listCtrl.view.rightAnchor.constraint(equalTo: view.rightAnchor), - listCtrl.view.bottomAnchor.constraint(equalTo: view.bottomAnchor), - ]) - } - - deinit {} - - // MARK: lazyMethod - - public lazy var popListController: PopListViewController = { - let popController = PopListViewController() - return popController - }() -} -extension ConversationController { - override open func searchAction() { - Router.shared.use( - SearchContactPageRouter, - parameters: ["nav": navigationController as Any], - closure: nil - ) - } - - override open func didClickAddBtn() { - print("add click") - - if children.contains(popListController) == false { - popListController.itemDatas = getPopListItems() - addChild(popListController) - popListController.view.frame = listCtrl.view.frame - } - if popListController.view.superview != nil { - popListController.removeSelf() - } else { - view.addSubview(popListController.view) - } - } - - open func getPopListItems() -> [PopListItem] { - weak var weakSelf = self - var items = [PopListItem]() - let addFriend = PopListItem() - addFriend.showName = localizable("add_friend") - addFriend.image = UIImage.ne_imageNamed(name: "add_friend") - addFriend.completion = { - Router.shared.use( - ContactAddFriendRouter, - parameters: ["nav": self.navigationController as Any] - ) { obj, routerState, str in - } - } - items.append(addFriend) - - let createGroup = PopListItem() - createGroup.showName = localizable("create_discussion_group") - createGroup.image = UIImage.ne_imageNamed(name: "create_discussion") - createGroup.completion = { - weakSelf?.createDiscussGroup() - } - items.append(createGroup) - - let createDicuss = PopListItem() - createDicuss.showName = localizable("create_senior_group") - createDicuss.image = UIImage.ne_imageNamed(name: "create_group") - createDicuss.completion = { - weakSelf?.createSeniorGroup() - } - items.append(createDicuss) + popListController = PopListViewController() - return items + tableView.rowHeight = 62 + tableView.backgroundColor = .white } } diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/NormalUI/Controller/ConversationListViewController.swift b/NEConversationUIKit/NEConversationUIKit/Classes/NormalUI/Controller/ConversationListViewController.swift deleted file mode 100644 index 8ddf255e..00000000 --- a/NEConversationUIKit/NEConversationUIKit/Classes/NormalUI/Controller/ConversationListViewController.swift +++ /dev/null @@ -1,26 +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 NIMSDK -import UIKit - -@objcMembers -open class ConversationListViewController: NEBaseConversationListViewController { - override public init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { - super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) - className = "ConversationListViewController" - registerCellDic = [0: ConversationListCell.self] - } - - public required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - override open func setupSubviews() { - super.setupSubviews() - - tableView.rowHeight = 62 - tableView.backgroundColor = .white - } -} diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/NormalUI/Controller/ConversationSearchController.swift b/NEConversationUIKit/NEConversationUIKit/Classes/NormalUI/Controller/ConversationSearchController.swift index 306db513..76d9c89a 100644 --- a/NEConversationUIKit/NEConversationUIKit/Classes/NormalUI/Controller/ConversationSearchController.swift +++ b/NEConversationUIKit/NEConversationUIKit/Classes/NormalUI/Controller/ConversationSearchController.swift @@ -29,7 +29,7 @@ open class ConversationSearchController: NEBaseConversationSearchController { override public init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) tag = "ConversationSearchController" - customNavigationView.backgroundColor = .white + navigationView.backgroundColor = .white navigationController?.navigationBar.backgroundColor = .white } diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/NormalUI/Controller/PopListViewController.swift b/NEConversationUIKit/NEConversationUIKit/Classes/NormalUI/Controller/PopListViewController.swift index 43a17611..6e3e326f 100644 --- a/NEConversationUIKit/NEConversationUIKit/Classes/NormalUI/Controller/PopListViewController.swift +++ b/NEConversationUIKit/NEConversationUIKit/Classes/NormalUI/Controller/PopListViewController.swift @@ -11,12 +11,9 @@ import UIKit open class PopListViewController: NEBasePopListViewController { override func setupUI() { super.setupUI() - let popViewHeight = CGFloat(itemDatas.count) * 32 + 16 NSLayoutConstraint.activate([ - shadowView.topAnchor.constraint(equalTo: view.topAnchor, constant: 2), + shadowView.topAnchor.constraint(equalTo: view.topAnchor, constant: topConstant - 10), shadowView.rightAnchor.constraint(equalTo: view.rightAnchor, constant: -20), - shadowView.widthAnchor.constraint(equalToConstant: popViewWidth), - shadowView.heightAnchor.constraint(equalToConstant: popViewHeight), ]) popView.backgroundColor = NEConstant.hexRGB(0xFFFFFF) diff --git a/NEConversationUIKit/NEConversationUIKit/Classes/NormalUI/NormalConversationRouter.swift b/NEConversationUIKit/NEConversationUIKit/Classes/NormalUI/NormalConversationRouter.swift index c5aa931e..ec2026bb 100644 --- a/NEConversationUIKit/NEConversationUIKit/Classes/NormalUI/NormalConversationRouter.swift +++ b/NEConversationUIKit/NEConversationUIKit/Classes/NormalUI/NormalConversationRouter.swift @@ -21,7 +21,7 @@ public extension ConversationRouter { Router.shared.register("ClearAtMessageRemind") { param in if let sessionId = param["sessionId"] as? String { - NEAtMessageManager.instance.clearAtRecord(sessionId) + NEAtMessageManager.instance?.clearAtRecord(sessionId) } } } diff --git a/NEMapKit/NEMapKit.podspec b/NEMapKit/NEMapKit.podspec index 796d53c8..a6315e08 100644 --- a/NEMapKit/NEMapKit.podspec +++ b/NEMapKit/NEMapKit.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'NEMapKit' - s.version = '9.6.3' + s.version = '9.6.5' s.summary = 'Netease XKit' # This description is used to generate tags and improve search results. @@ -28,7 +28,7 @@ TODO: Add long description of the pod here. s.source = { :git => 'ssh://git@g.hz.netease.com:22222/yunxin-app/xkit-ios.git', :tag => s.version.to_s } # s.social_media_url = 'https://twitter.com/' - s.ios.deployment_target = '10.0' + s.ios.deployment_target = '11.0' s.source_files = 'NEMapKit/Classes/**/*' # s.resource = 'NEMapKit/Assets/**/*' diff --git a/NERtcCallUIKit/NERtcCallUIKit.podspec b/NERtcCallUIKit/NERtcCallUIKit.podspec index d333e1af..72278cec 100644 --- a/NERtcCallUIKit/NERtcCallUIKit.podspec +++ b/NERtcCallUIKit/NERtcCallUIKit.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.subspec 'NOS' do |nos| nos.dependency 'NERtcCallKit/NOS','2.2.0' nos.dependency 'SDWebImage' - nos.dependency 'NECoreKit','9.6.4' + nos.dependency 'NECoreKit','9.6.5' nos.dependency 'NECommonKit' nos.dependency 'NECommonUIKit' nos.dependency 'NERtcSDK' @@ -30,7 +30,7 @@ Pod::Spec.new do |s| s.subspec 'NOS_Special' do |nos| nos.dependency 'NERtcCallKit/NOS_Special', "2.2.0" nos.dependency 'SDWebImage' - nos.dependency 'NECoreKit','9.6.4' + nos.dependency 'NECoreKit','9.6.5' nos.dependency 'NECommonKit' nos.dependency 'NECommonUIKit' nos.dependency 'NERtcSDK' @@ -40,7 +40,7 @@ Pod::Spec.new do |s| s.subspec 'FCS' do |fcs| fcs.dependency 'NERtcCallKit/FCS','2.2.0' fcs.dependency 'SDWebImage' - fcs.dependency 'NECoreKit','9.6.4' + fcs.dependency 'NECoreKit','9.6.5' fcs.dependency 'NECommonKit' fcs.dependency 'NECommonUIKit' fcs.dependency 'NERtcSDK' @@ -50,7 +50,7 @@ Pod::Spec.new do |s| s.subspec 'FCS_Special' do |fcs| fcs.dependency 'NERtcCallKit/FCS_Special', "2.2.0" fcs.dependency 'SDWebImage' - fcs.dependency 'NECoreKit','9.6.4' + fcs.dependency 'NECoreKit','9.6.5' fcs.dependency 'NECommonKit' fcs.dependency 'NECommonUIKit' fcs.dependency 'NERtcSDK' diff --git a/NETeamUIKit/NETeamUIKit.podspec b/NETeamUIKit/NETeamUIKit.podspec index 2e0cdd69..8dfe0b70 100644 --- a/NETeamUIKit/NETeamUIKit.podspec +++ b/NETeamUIKit/NETeamUIKit.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'NETeamUIKit' - s.version = '9.6.1' + s.version = '9.6.5' s.summary = 'Netease XKit' # This description is used to generate tags and improve search results. @@ -31,7 +31,7 @@ TODO: Add long description of the pod here. 'BUILD_LIBRARY_FOR_DISTRIBUTION' => 'YES' } - s.ios.deployment_target = '10.0' + s.ios.deployment_target = '11.0' s.swift_version = '5.0' s.source_files = 'NETeamUIKit/Classes/**/*' diff --git a/NETeamUIKit/NETeamUIKit/Classes/FunUI/Controller/FunTeamAvatarViewController.swift b/NETeamUIKit/NETeamUIKit/Classes/FunUI/Controller/FunTeamAvatarViewController.swift index ef878fd2..3a5c4631 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/FunUI/Controller/FunTeamAvatarViewController.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/FunUI/Controller/FunTeamAvatarViewController.swift @@ -23,8 +23,8 @@ open class FunTeamAvatarViewController: NEBaseTeamAvatarViewController { navigationController?.navigationBar.backgroundColor = .white addRightAction(localizable("save"), #selector(savePhoto), self, .funTeamThemeColor) - customNavigationView.backgroundColor = .white - customNavigationView.moreButton.setTitleColor(.funTeamThemeColor, for: .normal) + navigationView.backgroundColor = .white + navigationView.moreButton.setTitleColor(.funTeamThemeColor, for: .normal) view.backgroundColor = .funTeamBackgroundColor @@ -75,7 +75,9 @@ open class FunTeamAvatarViewController: NEBaseTeamAvatarViewController { } override open func uploadPhoto() { - showCustomBottomAlert(self) + if changePermission() { + showCustomBottomAlert(self) + } } override open func collectionView(_ collectionView: UICollectionView, diff --git a/NETeamUIKit/NETeamUIKit/Classes/FunUI/Controller/FunTeamHistoryMessageController.swift b/NETeamUIKit/NETeamUIKit/Classes/FunUI/Controller/FunTeamHistoryMessageController.swift index be51019a..427153d4 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/FunUI/Controller/FunTeamHistoryMessageController.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/FunUI/Controller/FunTeamHistoryMessageController.swift @@ -29,7 +29,7 @@ open class FunTeamHistoryMessageController: NEBaseTeamHistoryMessageController { super.viewDidLoad() view.backgroundColor = .funTeamBackgroundColor navigationController?.isNavigationBarHidden = true - customNavigationView.isHidden = true + navigationView.isHidden = true emptyView.backgroundColor = .clear emptyView.setEmptyImage(name: "fun_emptyView") } diff --git a/NETeamUIKit/NETeamUIKit/Classes/FunUI/Controller/FunTeamInfoViewController.swift b/NETeamUIKit/NETeamUIKit/Classes/FunUI/Controller/FunTeamInfoViewController.swift index d8452e3d..3278d2ff 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/FunUI/Controller/FunTeamInfoViewController.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/FunUI/Controller/FunTeamInfoViewController.swift @@ -7,8 +7,8 @@ import UIKit @objcMembers open class FunTeamInfoViewController: NEBaseTeamInfoViewController { - override public init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { - super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) + override init(team: NIMTeam?) { + super.init(team: team) cellClassDic = [ SettingCellType.SettingArrowCell.rawValue: FunTeamArrowSettingCell.self, SettingCellType.SettingHeaderCell.rawValue: FunTeamSettingHeaderCell.self, @@ -33,8 +33,8 @@ open class FunTeamInfoViewController: NEBaseTeamInfoViewController { override open func setupUI() { super.setupUI() navigationController?.navigationBar.backgroundColor = .white - customNavigationView.backgroundColor = .white - customNavigationView.bottomLine.isHidden = false + navigationView.backgroundColor = .white + navigationView.titleBarBottomLine.isHidden = false view.backgroundColor = .funTeamBackgroundColor } diff --git a/NETeamUIKit/NETeamUIKit/Classes/FunUI/Controller/FunTeamIntroduceViewController.swift b/NETeamUIKit/NETeamUIKit/Classes/FunUI/Controller/FunTeamIntroduceViewController.swift index 095047d5..0da2bcbf 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/FunUI/Controller/FunTeamIntroduceViewController.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/FunUI/Controller/FunTeamIntroduceViewController.swift @@ -13,8 +13,8 @@ open class FunTeamIntroduceViewController: NEBaseTeamIntroduceViewController { view.backgroundColor = .funTeamBackgroundColor addRightAction(localizable("save"), #selector(saveIntr), self, .funTeamThemeColor) navigationController?.navigationBar.backgroundColor = .funTeamBackgroundColor - customNavigationView.backgroundColor = .funTeamBackgroundColor - customNavigationView.moreButton.setTitleColor(.funTeamThemeColor, for: .normal) + navigationView.backgroundColor = .funTeamBackgroundColor + navigationView.moreButton.setTitleColor(.funTeamThemeColor, for: .normal) NSLayoutConstraint.activate([ backView.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 0), diff --git a/NETeamUIKit/NETeamUIKit/Classes/FunUI/Controller/FunTeamNameViewController.swift b/NETeamUIKit/NETeamUIKit/Classes/FunUI/Controller/FunTeamNameViewController.swift index 7c0b435d..c4d43514 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/FunUI/Controller/FunTeamNameViewController.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/FunUI/Controller/FunTeamNameViewController.swift @@ -13,8 +13,8 @@ open class FunTeamNameViewController: NEBaseTeamNameViewController { view.backgroundColor = .funTeamBackgroundColor navigationController?.navigationBar.backgroundColor = .funTeamBackgroundColor addRightAction(localizable("save"), #selector(saveName), self, .funTeamThemeColor) - customNavigationView.backgroundColor = .funTeamBackgroundColor - customNavigationView.moreButton.setTitleColor(.funTeamThemeColor, for: .normal) + navigationView.backgroundColor = .funTeamBackgroundColor + navigationView.moreButton.setTitleColor(.funTeamThemeColor, for: .normal) NSLayoutConstraint.activate([ backView.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 0), @@ -41,14 +41,14 @@ open class FunTeamNameViewController: NEBaseTeamNameViewController { override open func disableSubmit() { rightNavBtn.setTitleColor(.funTeamThemeDisableColor, for: .normal) rightNavBtn.isEnabled = false - customNavigationView.moreButton.setTitleColor(.funTeamThemeDisableColor, for: .normal) - customNavigationView.moreButton.isEnabled = false + navigationView.moreButton.setTitleColor(.funTeamThemeDisableColor, for: .normal) + navigationView.moreButton.isEnabled = false } override open func enableSubmit() { rightNavBtn.setTitleColor(.funTeamThemeColor, for: .normal) rightNavBtn.isEnabled = true - customNavigationView.moreButton.setTitleColor(.funTeamThemeColor, for: .normal) - customNavigationView.moreButton.isEnabled = true + navigationView.moreButton.setTitleColor(.funTeamThemeColor, for: .normal) + navigationView.moreButton.isEnabled = true } } diff --git a/NETeamUIKit/NETeamUIKit/Classes/FunUI/Controller/FunTeamSettingViewController.swift b/NETeamUIKit/NETeamUIKit/Classes/FunUI/Controller/FunTeamSettingViewController.swift index 0430757a..8a2ec325 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/FunUI/Controller/FunTeamSettingViewController.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/FunUI/Controller/FunTeamSettingViewController.swift @@ -42,8 +42,8 @@ open class FunTeamSettingViewController: NEBaseTeamSettingViewController { teamHeader.layer.cornerRadius = 4.0 addBtn.setImage(coreLoader.loadImage("fun_add"), for: .normal) navigationController?.navigationBar.backgroundColor = .white - customNavigationView.backgroundColor = .white - customNavigationView.bottomLine.isHidden = false + navigationView.backgroundColor = .white + navigationView.titleBarBottomLine.isHidden = false } override open func getHeaderView() -> UIView { @@ -245,8 +245,7 @@ open class FunTeamSettingViewController: NEBaseTeamSettingViewController { // MARK: objc 方法 override open func toInfoView() { - let info = FunTeamInfoViewController() - info.team = viewmodel.teamInfoModel?.team + let info = FunTeamInfoViewController(team: viewmodel.teamInfoModel?.team) navigationController?.pushViewController(info, animated: true) } @@ -321,12 +320,7 @@ open class FunTeamSettingViewController: NEBaseTeamSettingViewController { } override open func toMemberList() { - let memberController = FunTeamMembersController(viewmodel: viewmodel) - memberController.datas = viewmodel.teamInfoModel?.users - if teamSettingType == .Senior { - memberController.isSenior = true - } - memberController.ownerId = viewmodel.teamInfoModel?.team?.owner + let memberController = FunTeamMembersController(teamId: viewmodel.teamInfoModel?.team?.teamId) navigationController?.pushViewController(memberController, animated: true) } } diff --git a/NETeamUIKit/NETeamUIKit/Classes/NormalUI/Controller/TeamAvatarViewController.swift b/NETeamUIKit/NETeamUIKit/Classes/NormalUI/Controller/TeamAvatarViewController.swift index 5c1e460a..09e24d8c 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/NormalUI/Controller/TeamAvatarViewController.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/NormalUI/Controller/TeamAvatarViewController.swift @@ -16,9 +16,9 @@ open class TeamAvatarViewController: NEBaseTeamAvatarViewController { addRightAction(localizable("save"), #selector(savePhoto), self) view.backgroundColor = .ne_lightBackgroundColor - customNavigationView.backgroundColor = .ne_lightBackgroundColor - customNavigationView.setBackButtonTitle(localizable("cancel")) - customNavigationView.backButton.setTitleColor(.ne_greyText, for: .normal) + navigationView.backgroundColor = .ne_lightBackgroundColor + navigationView.setBackButtonTitle(localizable("cancel")) + navigationView.backButton.setTitleColor(.ne_greyText, for: .normal) navigationController?.navigationBar.backgroundColor = .ne_lightBackgroundColor headerBack.layer.cornerRadius = 8.0 diff --git a/NETeamUIKit/NETeamUIKit/Classes/NormalUI/Controller/TeamHistoryMessageController.swift b/NETeamUIKit/NETeamUIKit/Classes/NormalUI/Controller/TeamHistoryMessageController.swift index 76fd186c..9ab49b1f 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/NormalUI/Controller/TeamHistoryMessageController.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/NormalUI/Controller/TeamHistoryMessageController.swift @@ -11,7 +11,7 @@ open class TeamHistoryMessageController: NEBaseTeamHistoryMessageController { override public init(session: NIMSession?) { super.init(session: session) tag = "TeamHistoryMessageController" - customNavigationView.backgroundColor = .white + navigationView.backgroundColor = .white navigationController?.navigationBar.backgroundColor = .white } diff --git a/NETeamUIKit/NETeamUIKit/Classes/NormalUI/Controller/TeamInfoViewController.swift b/NETeamUIKit/NETeamUIKit/Classes/NormalUI/Controller/TeamInfoViewController.swift index 8ce04d94..04528f6a 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/NormalUI/Controller/TeamInfoViewController.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/NormalUI/Controller/TeamInfoViewController.swift @@ -8,14 +8,14 @@ import UIKit @objcMembers open class TeamInfoViewController: NEBaseTeamInfoViewController { - override public init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { - super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) + override public init(team: NIMTeam?) { + super.init(team: team) cellClassDic = [ SettingCellType.SettingArrowCell.rawValue: TeamArrowSettingCell.self, SettingCellType.SettingHeaderCell.rawValue: TeamSettingHeaderCell.self, ] view.backgroundColor = .ne_lightBackgroundColor - customNavigationView.backgroundColor = .ne_lightBackgroundColor + navigationView.backgroundColor = .ne_lightBackgroundColor navigationController?.navigationBar.backgroundColor = .ne_lightBackgroundColor } diff --git a/NETeamUIKit/NETeamUIKit/Classes/NormalUI/Controller/TeamIntroduceViewController.swift b/NETeamUIKit/NETeamUIKit/Classes/NormalUI/Controller/TeamIntroduceViewController.swift index 52d303a8..9c145195 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/NormalUI/Controller/TeamIntroduceViewController.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/NormalUI/Controller/TeamIntroduceViewController.swift @@ -12,11 +12,11 @@ open class TeamIntroduceViewController: NEBaseTeamIntroduceViewController { override open func setupUI() { super.setupUI() view.backgroundColor = .ne_lightBackgroundColor - customNavigationView.backgroundColor = .ne_lightBackgroundColor + navigationView.backgroundColor = .ne_lightBackgroundColor navigationController?.navigationBar.backgroundColor = .ne_lightBackgroundColor addRightAction(localizable("save"), #selector(saveIntr), self) - customNavigationView.setBackButtonTitle(localizable("cancel")) - customNavigationView.backButton.setTitleColor(.ne_greyText, for: .normal) + navigationView.setBackButtonTitle(localizable("cancel")) + navigationView.backButton.setTitleColor(.ne_greyText, for: .normal) backView.layer.cornerRadius = 8.0 NSLayoutConstraint.activate([ diff --git a/NETeamUIKit/NETeamUIKit/Classes/NormalUI/Controller/TeamMembersController.swift b/NETeamUIKit/NETeamUIKit/Classes/NormalUI/Controller/TeamMembersController.swift index 0640037a..dd7540b2 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/NormalUI/Controller/TeamMembersController.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/NormalUI/Controller/TeamMembersController.swift @@ -8,7 +8,7 @@ import UIKit open class TeamMembersController: NEBaseTeamMembersController { override open func viewDidLoad() { super.viewDidLoad() - customNavigationView.backgroundColor = .white + navigationView.backgroundColor = .white navigationController?.navigationBar.backgroundColor = .white back.backgroundColor = .ne_backcolor contentTable.register(TeamMemberCell.self, forCellReuseIdentifier: "\(TeamMemberCell.self)") diff --git a/NETeamUIKit/NETeamUIKit/Classes/NormalUI/Controller/TeamNameViewController.swift b/NETeamUIKit/NETeamUIKit/Classes/NormalUI/Controller/TeamNameViewController.swift index 8c0728b5..09b03938 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/NormalUI/Controller/TeamNameViewController.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/NormalUI/Controller/TeamNameViewController.swift @@ -12,11 +12,11 @@ open class TeamNameViewController: NEBaseTeamNameViewController { override open func setupUI() { super.setupUI() view.backgroundColor = .ne_lightBackgroundColor - customNavigationView.backgroundColor = .ne_lightBackgroundColor + navigationView.backgroundColor = .ne_lightBackgroundColor navigationController?.navigationBar.backgroundColor = .ne_lightBackgroundColor addRightAction(localizable("save"), #selector(saveName), self) - customNavigationView.setBackButtonTitle(localizable("cancel")) - customNavigationView.backButton.setTitleColor(.ne_greyText, for: .normal) + navigationView.setBackButtonTitle(localizable("cancel")) + navigationView.backButton.setTitleColor(.ne_greyText, for: .normal) backView.layer.cornerRadius = 8.0 NSLayoutConstraint.activate([ diff --git a/NETeamUIKit/NETeamUIKit/Classes/NormalUI/Controller/TeamSettingViewController.swift b/NETeamUIKit/NETeamUIKit/Classes/NormalUI/Controller/TeamSettingViewController.swift index ed6f6327..d07b4f68 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/NormalUI/Controller/TeamSettingViewController.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/NormalUI/Controller/TeamSettingViewController.swift @@ -12,7 +12,7 @@ import UIKit open class TeamSettingViewController: NEBaseTeamSettingViewController { override public init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) - customNavigationView.backgroundColor = .ne_lightBackgroundColor + navigationView.backgroundColor = .ne_lightBackgroundColor navigationController?.navigationBar.backgroundColor = .ne_lightBackgroundColor className = "TeamSettingViewController" cellClassDic = [ @@ -234,8 +234,7 @@ open class TeamSettingViewController: NEBaseTeamSettingViewController { // MARK: objc 方法 override open func toInfoView() { - let info = TeamInfoViewController() - info.team = viewmodel.teamInfoModel?.team + let info = TeamInfoViewController(team: viewmodel.teamInfoModel?.team) navigationController?.pushViewController(info, animated: true) } @@ -279,12 +278,7 @@ open class TeamSettingViewController: NEBaseTeamSettingViewController { } override open func toMemberList() { - let memberController = TeamMembersController(viewmodel: viewmodel) - memberController.datas = viewmodel.teamInfoModel?.users - if teamSettingType == .Senior { - memberController.isSenior = true - } - memberController.ownerId = viewmodel.teamInfoModel?.team?.owner + let memberController = TeamMembersController(teamId: viewmodel.teamInfoModel?.team?.teamId) navigationController?.pushViewController(memberController, animated: true) } } diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamMembersController.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamMembersController.swift index e1505295..109bc7d9 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamMembersController.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/NEBaseTeamMembersController.swift @@ -9,7 +9,7 @@ import UIKit @objcMembers open class NEBaseTeamMembersController: NEBaseViewController, UITableViewDelegate, UITableViewDataSource { - public var viewmodel: TeamSettingViewModel? + public var teamId: String? public var datas: [TeamMemberInfoModel]? @@ -62,9 +62,9 @@ open class NEBaseTeamMembersController: NEBaseViewController, UITableViewDelegat return view }() - init(viewmodel: TeamSettingViewModel? = nil) { + public init(teamId: String?) { super.init(nibName: nil, bundle: nil) - self.viewmodel = viewmodel + self.teamId = teamId } public required init?(coder: NSCoder) { @@ -72,7 +72,7 @@ open class NEBaseTeamMembersController: NEBaseViewController, UITableViewDelegat } override open func viewWillAppear(_ animated: Bool) { - viewmodel?.getTeamInfo(viewmodel?.teamInfoModel?.team?.teamId ?? "") { [weak self] error in + TeamRepo.shared.fetchTeamInfo(teamId ?? "") { [weak self] error, teamModel in if let err = error as? NSError { if err.code == 803 || err.code == 1 { self?.showToast(localizable("team_not_exist")) @@ -80,7 +80,7 @@ open class NEBaseTeamMembersController: NEBaseViewController, UITableViewDelegat self?.showToast(err.localizedDescription) } } else { - self?.datas = self?.viewmodel?.teamInfoModel?.users + self?.datas = teamModel?.users self?.contentTable.reloadData() } } @@ -89,7 +89,12 @@ open class NEBaseTeamMembersController: NEBaseViewController, UITableViewDelegat override open func viewDidLoad() { super.viewDidLoad() - // Do any additional setup after loading the view. + let team = TeamProvider.shared.getTeam(teamId: teamId ?? "") + ownerId = team?.owner + if team?.isDisscuss() == false { + isSenior = true + } + setupUI() } diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamAvatarViewController.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamAvatarViewController.swift index 49a432b1..cd3fb504 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamAvatarViewController.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamAvatarViewController.swift @@ -57,8 +57,8 @@ open class NEBaseTeamAvatarViewController: NEBaseViewController, UICollectionVie open func setupUI() { title = localizable("modify_headImage") addRightAction(localizable("save"), #selector(savePhoto), self) - customNavigationView.setMoreButtonTitle(localizable("save")) - customNavigationView.addMoreButtonTarget(target: self, selector: #selector(savePhoto)) + navigationView.setMoreButtonTitle(localizable("save")) + navigationView.addMoreButtonTarget(target: self, selector: #selector(savePhoto)) view.backgroundColor = .ne_lightBackgroundColor @@ -111,7 +111,7 @@ open class NEBaseTeamAvatarViewController: NEBaseViewController, UICollectionVie if changePermission() == false { rightNavBtn.isHidden = true - customNavigationView.moreButton.isHidden = true + navigationView.moreButton.isHidden = true photoImage.isHidden = true defaultHeaderBack.isHidden = true } @@ -133,8 +133,9 @@ open class NEBaseTeamAvatarViewController: NEBaseViewController, UICollectionVie // MARK: objc 方法 open func uploadPhoto() { - print("upload photo") - showBottomAlert(self) + if changePermission() { + showBottomAlert(self) + } } open func savePhoto() { @@ -207,7 +208,7 @@ open class NEBaseTeamAvatarViewController: NEBaseViewController, UICollectionVie view.makeToastActivity(.center) if let imageData = image.jpegData(compressionQuality: 0.6) as NSData? { let filePath = NSHomeDirectory().appending("/Documents/") - .appending(IMKitClient.instance.imAccid) + .appending(IMKitClient.instance.imAccid()) let succcess = imageData.write(toFile: filePath, atomically: true) if succcess { NIMSDK.shared().resourceManager diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamInfoViewController.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamInfoViewController.swift index 8ab1ccb8..2b552fe5 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamInfoViewController.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamInfoViewController.swift @@ -26,6 +26,15 @@ open class NEBaseTeamInfoViewController: NEBaseViewController, UITableViewDelega return table }() + init(team: NIMTeam?) { + super.init(nibName: nil, bundle: nil) + self.team = team + } + + public required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + override open func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) if let type = team?.type, type == .normal { diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamIntroduceViewController.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamIntroduceViewController.swift index bdef70e8..619cc68d 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamIntroduceViewController.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamIntroduceViewController.swift @@ -54,8 +54,8 @@ open class NEBaseTeamIntroduceViewController: NEBaseViewController, UITextViewDe } open func setupUI() { - customNavigationView.setMoreButtonTitle(localizable("save")) - customNavigationView.addMoreButtonTarget(target: self, selector: #selector(saveIntr)) + navigationView.setMoreButtonTitle(localizable("save")) + navigationView.addMoreButtonTarget(target: self, selector: #selector(saveIntr)) if let type = team?.type, type == .advanced { title = localizable("team_intr") @@ -82,7 +82,7 @@ open class NEBaseTeamIntroduceViewController: NEBaseViewController, UITextViewDe if changePermission() == false { textView.isEditable = false rightNavBtn.isHidden = true - customNavigationView.moreButton.isHidden = true + navigationView.moreButton.isHidden = true } } diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamNameViewController.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamNameViewController.swift index b30423c6..62ae95f7 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamNameViewController.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamNameViewController.swift @@ -53,8 +53,8 @@ open class NEBaseTeamNameViewController: NEBaseViewController, UITextViewDelegat } open func setupUI() { - customNavigationView.setMoreButtonTitle(localizable("save")) - customNavigationView.addMoreButtonTarget(target: self, selector: #selector(saveName)) + navigationView.setMoreButtonTitle(localizable("save")) + navigationView.addMoreButtonTarget(target: self, selector: #selector(saveName)) view.addSubview(backView) backView.addSubview(textView) @@ -75,7 +75,7 @@ open class NEBaseTeamNameViewController: NEBaseViewController, UITextViewDelegat name = n if changePermission() == false { rightNavBtn.isHidden = true - customNavigationView.moreButton.isHidden = true + navigationView.moreButton.isHidden = true textView.isEditable = false } } else if type == .NickName { @@ -123,15 +123,15 @@ open class NEBaseTeamNameViewController: NEBaseViewController, UITextViewDelegat open func disableSubmit() { rightNavBtn.setTitleColor(NEConstant.hexRGBAlpha(0x337EFF, 0.5), for: .normal) rightNavBtn.isEnabled = false - customNavigationView.moreButton.setTitleColor(NEConstant.hexRGBAlpha(0x337EFF, 0.5), for: .normal) - customNavigationView.moreButton.isEnabled = false + navigationView.moreButton.setTitleColor(NEConstant.hexRGBAlpha(0x337EFF, 0.5), for: .normal) + navigationView.moreButton.isEnabled = false } open func enableSubmit() { rightNavBtn.setTitleColor(NEConstant.hexRGB(0x337EFF), for: .normal) rightNavBtn.isEnabled = true - customNavigationView.moreButton.setTitleColor(NEConstant.hexRGB(0x337EFF), for: .normal) - customNavigationView.moreButton.isEnabled = true + navigationView.moreButton.setTitleColor(NEConstant.hexRGB(0x337EFF), for: .normal) + navigationView.moreButton.isEnabled = true } open func saveName() { diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamSettingCell.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamSettingCell.swift index e2bbbd6c..623a13cf 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamSettingCell.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamSettingCell.swift @@ -25,6 +25,7 @@ open class NEBaseTeamSettingCell: CornerCell { label.translatesAutoresizingMaskIntoConstraints = false label.textColor = NEConstant.hexRGB(0x333333) label.font = NEConstant.defaultTextFont(16.0) + label.accessibilityIdentifier = "id.titleLabel" return label }() diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamSettingSwitchCell.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamSettingSwitchCell.swift index 6584ee5e..8adf331b 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamSettingSwitchCell.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamSettingSwitchCell.swift @@ -10,6 +10,7 @@ open class NEBaseTeamSettingSwitchCell: NEBaseTeamSettingCell { public var tSwitch: UISwitch = { let q = UISwitch() q.translatesAutoresizingMaskIntoConstraints = false + q.accessibilityIdentifier = "id.tSwitch" return q }() diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamSettingViewController.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamSettingViewController.swift index 28d4f912..193d82d5 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamSettingViewController.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/View/NEBaseTeamSettingViewController.swift @@ -258,12 +258,7 @@ open class NEBaseTeamSettingViewController: NEBaseViewController, UICollectionVi open func toInfoView() {} open func toMemberList() { - let memberController = NEBaseTeamMembersController(viewmodel: viewmodel) - memberController.datas = viewmodel.teamInfoModel?.users - if teamSettingType == .Senior { - memberController.isSenior = true - } - memberController.ownerId = viewmodel.teamInfoModel?.team?.owner + let memberController = NEBaseTeamMembersController(teamId: viewmodel.teamInfoModel?.team?.teamId) navigationController?.pushViewController(memberController, animated: true) } @@ -330,17 +325,6 @@ open class NEBaseTeamSettingViewController: NEBaseViewController, UICollectionVi for: indexPath ) as? NEBaseTeamSettingCell { cell.configure(model) - if let c = cell as? TeamSettingSwitchCell { - if model.cellName == localizable("message_remind") { - c.tSwitch.accessibilityIdentifier = "id.messageRemind" - } - if model.cellName == localizable("session_set_top") { - c.tSwitch.accessibilityIdentifier = "id.sessionPin" - } - if model.cellName == localizable("team_no_speak") { - c.tSwitch.accessibilityIdentifier = "id.teamMute" - } - } return cell } return UITableViewCell() diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/View/TeamSettingRightCustomCell.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/View/TeamSettingRightCustomCell.swift index a1dd0039..289a9d22 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/View/TeamSettingRightCustomCell.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/View/TeamSettingRightCustomCell.swift @@ -50,6 +50,7 @@ open class TeamSettingRightCustomCell: TeamSettingSubtitleCell { public lazy var customRightView: UIButton = { let btn = UIButton() btn.translatesAutoresizingMaskIntoConstraints = false + btn.accessibilityIdentifier = "id.accountCopy" return btn }() diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/View/TeamSettingSubtitleCell.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/View/TeamSettingSubtitleCell.swift index 80fdf2f4..c041c1d4 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/View/TeamSettingSubtitleCell.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/View/TeamSettingSubtitleCell.swift @@ -70,6 +70,7 @@ open class TeamSettingSubtitleCell: NEBaseTeamSettingCell { label.font = NEConstant.defaultTextFont(12.0) label.translatesAutoresizingMaskIntoConstraints = false label.textAlignment = .right + label.accessibilityIdentifier = "id.subTitleLabel" return label }() } diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamInfoViewModel.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamInfoViewModel.swift index 51d4acbe..9c03c911 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamInfoViewModel.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamInfoViewModel.swift @@ -27,7 +27,7 @@ public class TeamInfoViewModel: NSObject { intrCell.type = SettingCellType.SettingArrowCell.rawValue intrCell.cornerType = .bottomLeft.union(.bottomRight) - if let type = team?.type, type == .normal || (type == .advanced && team?.clientCustomInfo?.contains(discussTeamKey) == true) { + if team?.isDisscuss() == true { headerCell.cellName = localizable("discuss_avatar") nameCell.cellName = localizable("discuss_name") intrCell.cellName = localizable("discuss_intro") diff --git a/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamSettingViewModel.swift b/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamSettingViewModel.swift index 2640692c..9f850d6d 100644 --- a/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamSettingViewModel.swift +++ b/NETeamUIKit/NETeamUIKit/Classes/Setting/ViewModel/TeamSettingViewModel.swift @@ -310,7 +310,7 @@ public class TeamSettingViewModel: NSObject, NIMTeamManagerDelegate { print("get team info error: ", error as Any) if error == nil { weakSelf?.getData() - weakSelf?.getCurrentMember(IMKitEngine.instance.imAccid, teamId) + weakSelf?.getCurrentMember(IMKitClient.instance.imAccid(), teamId) } completion(error) } @@ -350,7 +350,7 @@ public class TeamSettingViewModel: NSObject, NIMTeamManagerDelegate { func isOwner() -> Bool { NELog.infoLog(ModuleName + " " + className, desc: #function) if let accid = teamInfoModel?.team?.owner { - if IMKitEngine.instance.isMySelf(accid) { + if IMKitClient.instance.isMySelf(accid) { return true } } diff --git a/Podfile b/Podfile index 8cdc1fac..15c129a7 100644 --- a/Podfile +++ b/Podfile @@ -10,36 +10,37 @@ target 'app' do pod 'YXLogin', '1.0.0' #可选UI库 - # pod 'NEContactUIKit', '9.6.3' -# pod 'NEConversationUIKit', '9.6.3' - # pod 'NEChatUIKit', '9.6.3' -# pod 'NETeamUIKit', '9.6.3' - -# #可选Kit库(和UIKit对应) -# pod 'NEChatKit', '9.6.3' - -# #基础kit库 -# pod 'NECommonUIKit', '9.6.4' -# pod 'NECommonKit', '9.6.3' -# pod 'NECoreIMKit', '9.6.3' -# pod 'NECoreKit', '9.6.4' - -# #扩展库 - # pod 'NEMapKit', '9.6.3' + pod 'NEContactUIKit', '9.6.5' + pod 'NEConversationUIKit', '9.6.5' + pod 'NEChatUIKit', '9.6.5' + pod 'NETeamUIKit', '9.6.5' + + #可选Kit库(和UIKit对应) + pod 'NEChatKit', '9.6.5' + + #基础kit库 + pod 'NIMSDK_LITE','9.14.0' + pod 'NECommonUIKit', '9.6.5' + pod 'NECommonKit', '9.6.4' + pod 'NECoreIMKit', '9.6.5' + pod 'NECoreKit', '9.6.5' + + #扩展库 + pod 'NEMapKit', '9.6.5' #呼叫组件,音视频通话能力,需要开通 音视频2.0,可选,聊天一面会根据依赖初始化自动显示音视频通话入口 -# pod 'NERtcCallUIKit', '2.2.0' -# pod 'NERtcCallKit', '2.2.0' -# pod 'NERtcSDK', '5.5.2' + pod 'NERtcCallKit/NOS_Special', '2.2.0' + pod 'NERtcCallUIKit/NOS_Special', '2.2.0' + pod 'NERtcSDK', '5.5.2' - # 如果需要查看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 'NERtcCallUIKit', :path => 'NERtcCallUIKit/NERtcCallUIKit.podspec' + # # 如果需要查看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 'NERtcCallUIKit', :path => 'NERtcCallUIKit/NERtcCallUIKit.podspec' end @@ -49,7 +50,7 @@ post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES' - config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0' + config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0' end end end diff --git a/app.xcodeproj/project.pbxproj b/app.xcodeproj/project.pbxproj index 5636a08c..b10bcfa1 100644 --- a/app.xcodeproj/project.pbxproj +++ b/app.xcodeproj/project.pbxproj @@ -7,10 +7,43 @@ objects = { /* Begin PBXBuildFile section */ + 181EE5872B234C510043817F /* CustomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE57E2B234C510043817F /* CustomView.swift */; }; + 181EE5882B234C510043817F /* CustomP2PChatViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE57F2B234C510043817F /* CustomP2PChatViewController.swift */; }; + 181EE58A2B234C510043817F /* CustomContactsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE5812B234C510043817F /* CustomContactsViewController.swift */; }; + 181EE58B2B234C510043817F /* CustomConversationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE5822B234C510043817F /* CustomConversationController.swift */; }; + 181EE58C2B234C510043817F /* CustomAttachment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE5832B234C510043817F /* CustomAttachment.swift */; }; + 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 */; }; + 181EE5EA2B234E540043817F /* NodeViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE5CD2B234E540043817F /* NodeViewModel.swift */; }; + 181EE5EB2B234E540043817F /* MineSettingViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE5CE2B234E540043817F /* MineSettingViewModel.swift */; }; + 181EE5EC2B234E540043817F /* PersonInfoViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE5CF2B234E540043817F /* PersonInfoViewModel.swift */; }; + 181EE5ED2B234E540043817F /* MessageRemindViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE5D02B234E540043817F /* MessageRemindViewModel.swift */; }; + 181EE5EE2B234E540043817F /* IntroduceViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE5D12B234E540043817F /* IntroduceViewModel.swift */; }; + 181EE5EF2B234E540043817F /* MeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE5D32B234E540043817F /* MeViewController.swift */; }; + 181EE5F02B234E540043817F /* StyleSelectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE5D42B234E540043817F /* StyleSelectionViewController.swift */; }; + 181EE5F12B234E540043817F /* NEAboutWebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE5D52B234E540043817F /* NEAboutWebViewController.swift */; }; + 181EE5F22B234E540043817F /* NELoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE5D62B234E540043817F /* NELoginViewController.swift */; }; + 181EE5F32B234E540043817F /* InputPersonInfoController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE5D72B234E540043817F /* InputPersonInfoController.swift */; }; + 181EE5F42B234E540043817F /* MineSettingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE5D82B234E540043817F /* MineSettingViewController.swift */; }; + 181EE5F52B234E540043817F /* MessageRemindViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE5D92B234E540043817F /* MessageRemindViewController.swift */; }; + 181EE5F62B234E540043817F /* NENodeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE5DA2B234E540043817F /* NENodeViewController.swift */; }; + 181EE5F72B234E540043817F /* PersonInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE5DB2B234E540043817F /* PersonInfoViewController.swift */; }; + 181EE5F82B234E540043817F /* ConfigTestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE5DC2B234E540043817F /* ConfigTestViewController.swift */; }; + 181EE5F92B234E540043817F /* IntroduceBrandViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE5DD2B234E540043817F /* IntroduceBrandViewController.swift */; }; + 181EE5FA2B234E540043817F /* MineTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE5DF2B234E540043817F /* MineTableViewCell.swift */; }; + 181EE5FB2B234E540043817F /* StyleSelectionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE5E02B234E540043817F /* StyleSelectionCell.swift */; }; + 181EE5FC2B234E540043817F /* BirthdayDatePickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE5E12B234E540043817F /* BirthdayDatePickerView.swift */; }; + 181EE5FD2B234E540043817F /* CustomTeamSettingRightCustomCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE5E32B234E540043817F /* CustomTeamSettingRightCustomCell.swift */; }; + 181EE5FE2B234E540043817F /* CustomTeamSettingSubtitleCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE5E42B234E540043817F /* CustomTeamSettingSubtitleCell.swift */; }; + 181EE5FF2B234E540043817F /* CustomTeamArrowSettingCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE5E52B234E540043817F /* CustomTeamArrowSettingCell.swift */; }; + 181EE6002B234E540043817F /* CustomTeamSettingHeaderCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE5E62B234E540043817F /* CustomTeamSettingHeaderCell.swift */; }; + 181EE6012B234E540043817F /* CustomTeamSettingSwitchCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE5E72B234E540043817F /* CustomTeamSettingSwitchCell.swift */; }; + 181EE6022B234E540043817F /* NodeSelectCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE5E82B234E540043817F /* NodeSelectCell.swift */; }; + 181EE6032B234E540043817F /* VersionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE5E92B234E540043817F /* VersionCell.swift */; }; 39E9E27728D87E9800A11820 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 39E9E27528D87E9800A11820 /* Localizable.strings */; }; 4B3B9BE6277AFEE50091A74E /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4B3B9BE4277AFEE50091A74E /* Main.storyboard */; }; 4B3B9BEB277AFEE70091A74E /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4B3B9BE9277AFEE70091A74E /* LaunchScreen.storyboard */; }; - 8D94D1BFC1723D94D352756A /* Pods_app.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D8ECED9A11CC9DB62207FC66 /* Pods_app.framework */; }; DD141DFC2A56ABFD0091318F /* Constant.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DC82A56ABFD0091318F /* Constant.swift */; }; DD141DFD2A56ABFE0091318F /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DC92A56ABFD0091318F /* ViewController.swift */; }; DD141DFF2A56ABFE0091318F /* NENavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DCB2A56ABFD0091318F /* NENavigationController.swift */; }; @@ -18,41 +51,8 @@ DD141E032A56ABFE0091318F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DCF2A56ABFD0091318F /* AppDelegate.swift */; }; DD141E042A56ABFE0091318F /* NETabBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DD02A56ABFD0091318F /* NETabBarController.swift */; }; DD141E052A56ABFE0091318F /* AppKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DD12A56ABFD0091318F /* AppKey.swift */; }; - DD141E062A56ABFE0091318F /* CustomP2PChatViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DD32A56ABFD0091318F /* CustomP2PChatViewController.swift */; }; - DD141E072A56ABFE0091318F /* CustomConversationListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DD42A56ABFD0091318F /* CustomConversationListViewController.swift */; }; - DD141E082A56ABFE0091318F /* CustomContactsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DD52A56ABFD0091318F /* CustomContactsViewController.swift */; }; - DD141E092A56ABFE0091318F /* CustomConversationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DD62A56ABFD0091318F /* CustomConversationController.swift */; }; - DD141E0A2A56ABFE0091318F /* CustomAttachment.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DD72A56ABFD0091318F /* CustomAttachment.swift */; }; - DD141E0B2A56ABFE0091318F /* CustomContactTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DD82A56ABFD0091318F /* CustomContactTableViewCell.swift */; }; - DD141E0C2A56ABFE0091318F /* CustomChatCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DD92A56ABFD0091318F /* CustomChatCell.swift */; }; - DD141E0D2A56ABFE0091318F /* CustomTopView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DDA2A56ABFD0091318F /* CustomTopView.swift */; }; - DD141E0E2A56ABFE0091318F /* CustomConversationListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DDB2A56ABFD0091318F /* CustomConversationListCell.swift */; }; - DD141E102A56ABFE0091318F /* NodeViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DE02A56ABFD0091318F /* NodeViewModel.swift */; }; - DD141E112A56ABFE0091318F /* MineSettingViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DE12A56ABFD0091318F /* MineSettingViewModel.swift */; }; - DD141E122A56ABFE0091318F /* PersonInfoViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DE22A56ABFD0091318F /* PersonInfoViewModel.swift */; }; - DD141E132A56ABFE0091318F /* MessageRemindViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DE32A56ABFD0091318F /* MessageRemindViewModel.swift */; }; - DD141E142A56ABFE0091318F /* IntroduceViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DE42A56ABFD0091318F /* IntroduceViewModel.swift */; }; - DD141E152A56ABFE0091318F /* MeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DE62A56ABFD0091318F /* MeViewController.swift */; }; - DD141E162A56ABFE0091318F /* StyleSelectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DE72A56ABFD0091318F /* StyleSelectionViewController.swift */; }; - DD141E172A56ABFE0091318F /* NEAboutWebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DE82A56ABFD0091318F /* NEAboutWebViewController.swift */; }; - DD141E182A56ABFE0091318F /* NELoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DE92A56ABFD0091318F /* NELoginViewController.swift */; }; - DD141E192A56ABFE0091318F /* InputPersonInfoController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DEA2A56ABFD0091318F /* InputPersonInfoController.swift */; }; - DD141E1A2A56ABFE0091318F /* MineSettingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DEB2A56ABFD0091318F /* MineSettingViewController.swift */; }; - DD141E1B2A56ABFE0091318F /* MessageRemindViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DEC2A56ABFD0091318F /* MessageRemindViewController.swift */; }; - DD141E1C2A56ABFE0091318F /* NENodeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DED2A56ABFD0091318F /* NENodeViewController.swift */; }; - DD141E1D2A56ABFE0091318F /* PersonInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DEE2A56ABFD0091318F /* PersonInfoViewController.swift */; }; - DD141E1E2A56ABFE0091318F /* IntroduceBrandViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DEF2A56ABFD0091318F /* IntroduceBrandViewController.swift */; }; - DD141E1F2A56ABFE0091318F /* MineTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DF12A56ABFD0091318F /* MineTableViewCell.swift */; }; - DD141E202A56ABFE0091318F /* StyleSelectionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DF22A56ABFD0091318F /* StyleSelectionCell.swift */; }; - DD141E212A56ABFE0091318F /* BirthdayDatePickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DF32A56ABFD0091318F /* BirthdayDatePickerView.swift */; }; - DD141E222A56ABFE0091318F /* CustomTeamSettingRightCustomCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DF52A56ABFD0091318F /* CustomTeamSettingRightCustomCell.swift */; }; - DD141E232A56ABFE0091318F /* CustomTeamSettingSubtitleCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DF62A56ABFD0091318F /* CustomTeamSettingSubtitleCell.swift */; }; - DD141E242A56ABFE0091318F /* CustomTeamArrowSettingCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DF72A56ABFD0091318F /* CustomTeamArrowSettingCell.swift */; }; - DD141E252A56ABFE0091318F /* CustomTeamSettingHeaderCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DF82A56ABFD0091318F /* CustomTeamSettingHeaderCell.swift */; }; - DD141E262A56ABFE0091318F /* CustomTeamSettingSwitchCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DF92A56ABFD0091318F /* CustomTeamSettingSwitchCell.swift */; }; - DD141E272A56ABFE0091318F /* NodeSelectCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DFA2A56ABFD0091318F /* NodeSelectCell.swift */; }; - DD141E282A56ABFE0091318F /* VersionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD141DFB2A56ABFD0091318F /* VersionCell.swift */; }; DDCE2A652A56BDB800E17751 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DDCE2A642A56BDB800E17751 /* Assets.xcassets */; }; + E3361980803427B31EB33C64 /* Pods_app.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F2833D0D33BD28525D83EAB4 /* Pods_app.framework */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -74,14 +74,47 @@ 01B0A28E2816CF41009065C5 /* app.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = app.entitlements; sourceTree = ""; }; 01C0FC0F27BE754400C32949 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Main.strings"; sourceTree = ""; }; 01C0FC1027BE754500C32949 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/LaunchScreen.strings"; sourceTree = ""; }; + 181EE57E2B234C510043817F /* CustomView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomView.swift; sourceTree = ""; }; + 181EE57F2B234C510043817F /* CustomP2PChatViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomP2PChatViewController.swift; sourceTree = ""; }; + 181EE5812B234C510043817F /* CustomContactsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomContactsViewController.swift; sourceTree = ""; }; + 181EE5822B234C510043817F /* CustomConversationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomConversationController.swift; sourceTree = ""; }; + 181EE5832B234C510043817F /* CustomAttachment.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomAttachment.swift; sourceTree = ""; }; + 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 = ""; }; + 181EE5CD2B234E540043817F /* NodeViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NodeViewModel.swift; sourceTree = ""; }; + 181EE5CE2B234E540043817F /* MineSettingViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MineSettingViewModel.swift; sourceTree = ""; }; + 181EE5CF2B234E540043817F /* PersonInfoViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PersonInfoViewModel.swift; sourceTree = ""; }; + 181EE5D02B234E540043817F /* MessageRemindViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessageRemindViewModel.swift; sourceTree = ""; }; + 181EE5D12B234E540043817F /* IntroduceViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IntroduceViewModel.swift; sourceTree = ""; }; + 181EE5D32B234E540043817F /* MeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MeViewController.swift; sourceTree = ""; }; + 181EE5D42B234E540043817F /* StyleSelectionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StyleSelectionViewController.swift; sourceTree = ""; }; + 181EE5D52B234E540043817F /* NEAboutWebViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NEAboutWebViewController.swift; sourceTree = ""; }; + 181EE5D62B234E540043817F /* NELoginViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NELoginViewController.swift; sourceTree = ""; }; + 181EE5D72B234E540043817F /* InputPersonInfoController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InputPersonInfoController.swift; sourceTree = ""; }; + 181EE5D82B234E540043817F /* MineSettingViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MineSettingViewController.swift; sourceTree = ""; }; + 181EE5D92B234E540043817F /* MessageRemindViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessageRemindViewController.swift; sourceTree = ""; }; + 181EE5DA2B234E540043817F /* NENodeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NENodeViewController.swift; sourceTree = ""; }; + 181EE5DB2B234E540043817F /* PersonInfoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PersonInfoViewController.swift; sourceTree = ""; }; + 181EE5DC2B234E540043817F /* ConfigTestViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConfigTestViewController.swift; sourceTree = ""; }; + 181EE5DD2B234E540043817F /* IntroduceBrandViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IntroduceBrandViewController.swift; sourceTree = ""; }; + 181EE5DF2B234E540043817F /* MineTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MineTableViewCell.swift; sourceTree = ""; }; + 181EE5E02B234E540043817F /* StyleSelectionCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StyleSelectionCell.swift; sourceTree = ""; }; + 181EE5E12B234E540043817F /* BirthdayDatePickerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BirthdayDatePickerView.swift; sourceTree = ""; }; + 181EE5E32B234E540043817F /* CustomTeamSettingRightCustomCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomTeamSettingRightCustomCell.swift; sourceTree = ""; }; + 181EE5E42B234E540043817F /* CustomTeamSettingSubtitleCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomTeamSettingSubtitleCell.swift; sourceTree = ""; }; + 181EE5E52B234E540043817F /* CustomTeamArrowSettingCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomTeamArrowSettingCell.swift; sourceTree = ""; }; + 181EE5E62B234E540043817F /* CustomTeamSettingHeaderCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomTeamSettingHeaderCell.swift; sourceTree = ""; }; + 181EE5E72B234E540043817F /* CustomTeamSettingSwitchCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomTeamSettingSwitchCell.swift; sourceTree = ""; }; + 181EE5E82B234E540043817F /* NodeSelectCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NodeSelectCell.swift; sourceTree = ""; }; + 181EE5E92B234E540043817F /* VersionCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VersionCell.swift; sourceTree = ""; }; 39E9E27628D87E9800A11820 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; 39E9E27828D87EA000A11820 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = ""; }; 4B3B9BDB277AFEE50091A74E /* app.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = app.app; sourceTree = BUILT_PRODUCTS_DIR; }; 4B3B9BE5277AFEE50091A74E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 4B3B9BEA277AFEE70091A74E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; - A9E4316D70F3EF2E6BD5E5CB /* Pods-app.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-app.release.xcconfig"; path = "Target Support Files/Pods-app/Pods-app.release.xcconfig"; sourceTree = ""; }; - B831F1EC5F2E309A7BB5582D /* Pods-app.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-app.debug.xcconfig"; path = "Target Support Files/Pods-app/Pods-app.debug.xcconfig"; sourceTree = ""; }; - D8ECED9A11CC9DB62207FC66 /* Pods_app.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_app.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 852A4E08916CBE74DF8872B0 /* Pods-app.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-app.debug.xcconfig"; path = "Target Support Files/Pods-app/Pods-app.debug.xcconfig"; sourceTree = ""; }; + B7F66F12DB299173053C1C33 /* Pods-app.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-app.release.xcconfig"; path = "Target Support Files/Pods-app/Pods-app.release.xcconfig"; sourceTree = ""; }; DD141DC82A56ABFD0091318F /* Constant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constant.swift; sourceTree = ""; }; DD141DC92A56ABFD0091318F /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; DD141DCB2A56ABFD0091318F /* NENavigationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NENavigationController.swift; sourceTree = ""; }; @@ -89,41 +122,8 @@ DD141DCF2A56ABFD0091318F /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; DD141DD02A56ABFD0091318F /* NETabBarController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NETabBarController.swift; sourceTree = ""; }; DD141DD12A56ABFD0091318F /* AppKey.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppKey.swift; sourceTree = ""; }; - DD141DD32A56ABFD0091318F /* CustomP2PChatViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomP2PChatViewController.swift; sourceTree = ""; }; - DD141DD42A56ABFD0091318F /* CustomConversationListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomConversationListViewController.swift; sourceTree = ""; }; - DD141DD52A56ABFD0091318F /* CustomContactsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomContactsViewController.swift; sourceTree = ""; }; - DD141DD62A56ABFD0091318F /* CustomConversationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomConversationController.swift; sourceTree = ""; }; - DD141DD72A56ABFD0091318F /* CustomAttachment.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomAttachment.swift; sourceTree = ""; }; - DD141DD82A56ABFD0091318F /* CustomContactTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomContactTableViewCell.swift; sourceTree = ""; }; - DD141DD92A56ABFD0091318F /* CustomChatCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomChatCell.swift; sourceTree = ""; }; - DD141DDA2A56ABFD0091318F /* CustomTopView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomTopView.swift; sourceTree = ""; }; - DD141DDB2A56ABFD0091318F /* CustomConversationListCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomConversationListCell.swift; sourceTree = ""; }; - DD141DE02A56ABFD0091318F /* NodeViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NodeViewModel.swift; sourceTree = ""; }; - DD141DE12A56ABFD0091318F /* MineSettingViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MineSettingViewModel.swift; sourceTree = ""; }; - DD141DE22A56ABFD0091318F /* PersonInfoViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PersonInfoViewModel.swift; sourceTree = ""; }; - DD141DE32A56ABFD0091318F /* MessageRemindViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessageRemindViewModel.swift; sourceTree = ""; }; - DD141DE42A56ABFD0091318F /* IntroduceViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IntroduceViewModel.swift; sourceTree = ""; }; - DD141DE62A56ABFD0091318F /* MeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MeViewController.swift; sourceTree = ""; }; - DD141DE72A56ABFD0091318F /* StyleSelectionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StyleSelectionViewController.swift; sourceTree = ""; }; - DD141DE82A56ABFD0091318F /* NEAboutWebViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NEAboutWebViewController.swift; sourceTree = ""; }; - DD141DE92A56ABFD0091318F /* NELoginViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NELoginViewController.swift; sourceTree = ""; }; - DD141DEA2A56ABFD0091318F /* InputPersonInfoController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InputPersonInfoController.swift; sourceTree = ""; }; - DD141DEB2A56ABFD0091318F /* MineSettingViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MineSettingViewController.swift; sourceTree = ""; }; - DD141DEC2A56ABFD0091318F /* MessageRemindViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessageRemindViewController.swift; sourceTree = ""; }; - DD141DED2A56ABFD0091318F /* NENodeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NENodeViewController.swift; sourceTree = ""; }; - DD141DEE2A56ABFD0091318F /* PersonInfoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PersonInfoViewController.swift; sourceTree = ""; }; - DD141DEF2A56ABFD0091318F /* IntroduceBrandViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IntroduceBrandViewController.swift; sourceTree = ""; }; - DD141DF12A56ABFD0091318F /* MineTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MineTableViewCell.swift; sourceTree = ""; }; - DD141DF22A56ABFD0091318F /* StyleSelectionCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StyleSelectionCell.swift; sourceTree = ""; }; - DD141DF32A56ABFD0091318F /* BirthdayDatePickerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BirthdayDatePickerView.swift; sourceTree = ""; }; - DD141DF52A56ABFD0091318F /* CustomTeamSettingRightCustomCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomTeamSettingRightCustomCell.swift; sourceTree = ""; }; - DD141DF62A56ABFD0091318F /* CustomTeamSettingSubtitleCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomTeamSettingSubtitleCell.swift; sourceTree = ""; }; - DD141DF72A56ABFD0091318F /* CustomTeamArrowSettingCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomTeamArrowSettingCell.swift; sourceTree = ""; }; - DD141DF82A56ABFD0091318F /* CustomTeamSettingHeaderCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomTeamSettingHeaderCell.swift; sourceTree = ""; }; - DD141DF92A56ABFD0091318F /* CustomTeamSettingSwitchCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomTeamSettingSwitchCell.swift; sourceTree = ""; }; - DD141DFA2A56ABFD0091318F /* NodeSelectCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NodeSelectCell.swift; sourceTree = ""; }; - DD141DFB2A56ABFD0091318F /* VersionCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VersionCell.swift; sourceTree = ""; }; DDCE2A642A56BDB800E17751 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + F2833D0D33BD28525D83EAB4 /* Pods_app.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_app.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -131,155 +131,155 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 8D94D1BFC1723D94D352756A /* Pods_app.framework in Frameworks */, + E3361980803427B31EB33C64 /* Pods_app.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 345791C57A67E47F5C6B3317 /* Frameworks */ = { + 181EE57D2B234C510043817F /* Custom */ = { isa = PBXGroup; children = ( - D8ECED9A11CC9DB62207FC66 /* Pods_app.framework */, + 181EE57E2B234C510043817F /* CustomView.swift */, + 181EE57F2B234C510043817F /* CustomP2PChatViewController.swift */, + 181EE5812B234C510043817F /* CustomContactsViewController.swift */, + 181EE5822B234C510043817F /* CustomConversationController.swift */, + 181EE5832B234C510043817F /* CustomAttachment.swift */, + 181EE5842B234C510043817F /* CustomContactTableViewCell.swift */, + 181EE5852B234C510043817F /* CustomChatCell.swift */, + 181EE5862B234C510043817F /* CustomConversationListCell.swift */, ); - name = Frameworks; + path = Custom; sourceTree = ""; }; - 4B3B9BD2277AFEE50091A74E = { + 181EE5CB2B234E540043817F /* Mine */ = { isa = PBXGroup; children = ( - 4B3B9BDD277AFEE50091A74E /* app */, - 4B3B9BDC277AFEE50091A74E /* Products */, - BF083551FB71DB2F668919FB /* Pods */, - 345791C57A67E47F5C6B3317 /* Frameworks */, + 181EE5CC2B234E540043817F /* ViewModel */, + 181EE5D22B234E540043817F /* Controller */, + 181EE5DE2B234E540043817F /* View */, ); + path = Mine; sourceTree = ""; }; - 4B3B9BDC277AFEE50091A74E /* Products */ = { + 181EE5CC2B234E540043817F /* ViewModel */ = { isa = PBXGroup; children = ( - 4B3B9BDB277AFEE50091A74E /* app.app */, + 181EE5CD2B234E540043817F /* NodeViewModel.swift */, + 181EE5CE2B234E540043817F /* MineSettingViewModel.swift */, + 181EE5CF2B234E540043817F /* PersonInfoViewModel.swift */, + 181EE5D02B234E540043817F /* MessageRemindViewModel.swift */, + 181EE5D12B234E540043817F /* IntroduceViewModel.swift */, ); - name = Products; + path = ViewModel; sourceTree = ""; }; - 4B3B9BDD277AFEE50091A74E /* app */ = { + 181EE5D22B234E540043817F /* Controller */ = { isa = PBXGroup; children = ( - DDCE2A642A56BDB800E17751 /* Assets.xcassets */, - DD141DD22A56ABFD0091318F /* Custom */, - DD141DC62A56ABFD0091318F /* Main */, - DD141DDE2A56ABFD0091318F /* Mine */, - 01B0A28E2816CF41009065C5 /* app.entitlements */, - 39E9E27528D87E9800A11820 /* Localizable.strings */, - 4B3B9BE4277AFEE50091A74E /* Main.storyboard */, - 4B3B9BE9277AFEE70091A74E /* LaunchScreen.storyboard */, + 181EE5D32B234E540043817F /* MeViewController.swift */, + 181EE5D42B234E540043817F /* StyleSelectionViewController.swift */, + 181EE5D52B234E540043817F /* NEAboutWebViewController.swift */, + 181EE5D62B234E540043817F /* NELoginViewController.swift */, + 181EE5D72B234E540043817F /* InputPersonInfoController.swift */, + 181EE5D82B234E540043817F /* MineSettingViewController.swift */, + 181EE5D92B234E540043817F /* MessageRemindViewController.swift */, + 181EE5DA2B234E540043817F /* NENodeViewController.swift */, + 181EE5DB2B234E540043817F /* PersonInfoViewController.swift */, + 181EE5DC2B234E540043817F /* ConfigTestViewController.swift */, + 181EE5DD2B234E540043817F /* IntroduceBrandViewController.swift */, ); - path = app; + path = Controller; sourceTree = ""; }; - BF083551FB71DB2F668919FB /* Pods */ = { + 181EE5DE2B234E540043817F /* View */ = { isa = PBXGroup; children = ( - B831F1EC5F2E309A7BB5582D /* Pods-app.debug.xcconfig */, - A9E4316D70F3EF2E6BD5E5CB /* Pods-app.release.xcconfig */, + 181EE5DF2B234E540043817F /* MineTableViewCell.swift */, + 181EE5E02B234E540043817F /* StyleSelectionCell.swift */, + 181EE5E12B234E540043817F /* BirthdayDatePickerView.swift */, + 181EE5E22B234E540043817F /* Theme */, + 181EE5E82B234E540043817F /* NodeSelectCell.swift */, + 181EE5E92B234E540043817F /* VersionCell.swift */, ); - path = Pods; + path = View; sourceTree = ""; }; - DD141DC62A56ABFD0091318F /* Main */ = { + 181EE5E22B234E540043817F /* Theme */ = { isa = PBXGroup; children = ( - DD141DC82A56ABFD0091318F /* Constant.swift */, - DD141DC92A56ABFD0091318F /* ViewController.swift */, - DD141DCB2A56ABFD0091318F /* NENavigationController.swift */, - DD141DCD2A56ABFD0091318F /* UIStyleManager.swift */, - DD141DCF2A56ABFD0091318F /* AppDelegate.swift */, - DD141DD02A56ABFD0091318F /* NETabBarController.swift */, - DD141DD12A56ABFD0091318F /* AppKey.swift */, + 181EE5E32B234E540043817F /* CustomTeamSettingRightCustomCell.swift */, + 181EE5E42B234E540043817F /* CustomTeamSettingSubtitleCell.swift */, + 181EE5E52B234E540043817F /* CustomTeamArrowSettingCell.swift */, + 181EE5E62B234E540043817F /* CustomTeamSettingHeaderCell.swift */, + 181EE5E72B234E540043817F /* CustomTeamSettingSwitchCell.swift */, ); - path = Main; + path = Theme; sourceTree = ""; }; - DD141DD22A56ABFD0091318F /* Custom */ = { + 405473F1290906C67D0BFCE0 /* Frameworks */ = { isa = PBXGroup; children = ( - DD141DD32A56ABFD0091318F /* CustomP2PChatViewController.swift */, - DD141DD42A56ABFD0091318F /* CustomConversationListViewController.swift */, - DD141DD52A56ABFD0091318F /* CustomContactsViewController.swift */, - DD141DD62A56ABFD0091318F /* CustomConversationController.swift */, - DD141DD72A56ABFD0091318F /* CustomAttachment.swift */, - DD141DD82A56ABFD0091318F /* CustomContactTableViewCell.swift */, - DD141DD92A56ABFD0091318F /* CustomChatCell.swift */, - DD141DDA2A56ABFD0091318F /* CustomTopView.swift */, - DD141DDB2A56ABFD0091318F /* CustomConversationListCell.swift */, + F2833D0D33BD28525D83EAB4 /* Pods_app.framework */, ); - path = Custom; + name = Frameworks; sourceTree = ""; }; - DD141DDE2A56ABFD0091318F /* Mine */ = { + 4B3B9BD2277AFEE50091A74E = { isa = PBXGroup; children = ( - DD141DDF2A56ABFD0091318F /* ViewModel */, - DD141DE52A56ABFD0091318F /* Controller */, - DD141DF02A56ABFD0091318F /* View */, + 4B3B9BDD277AFEE50091A74E /* app */, + 4B3B9BDC277AFEE50091A74E /* Products */, + BF083551FB71DB2F668919FB /* Pods */, + 405473F1290906C67D0BFCE0 /* Frameworks */, ); - path = Mine; sourceTree = ""; }; - DD141DDF2A56ABFD0091318F /* ViewModel */ = { + 4B3B9BDC277AFEE50091A74E /* Products */ = { isa = PBXGroup; children = ( - DD141DE02A56ABFD0091318F /* NodeViewModel.swift */, - DD141DE12A56ABFD0091318F /* MineSettingViewModel.swift */, - DD141DE22A56ABFD0091318F /* PersonInfoViewModel.swift */, - DD141DE32A56ABFD0091318F /* MessageRemindViewModel.swift */, - DD141DE42A56ABFD0091318F /* IntroduceViewModel.swift */, + 4B3B9BDB277AFEE50091A74E /* app.app */, ); - path = ViewModel; + name = Products; sourceTree = ""; }; - DD141DE52A56ABFD0091318F /* Controller */ = { + 4B3B9BDD277AFEE50091A74E /* app */ = { isa = PBXGroup; children = ( - DD141DE62A56ABFD0091318F /* MeViewController.swift */, - DD141DE72A56ABFD0091318F /* StyleSelectionViewController.swift */, - DD141DE82A56ABFD0091318F /* NEAboutWebViewController.swift */, - DD141DE92A56ABFD0091318F /* NELoginViewController.swift */, - DD141DEA2A56ABFD0091318F /* InputPersonInfoController.swift */, - DD141DEB2A56ABFD0091318F /* MineSettingViewController.swift */, - DD141DEC2A56ABFD0091318F /* MessageRemindViewController.swift */, - DD141DED2A56ABFD0091318F /* NENodeViewController.swift */, - DD141DEE2A56ABFD0091318F /* PersonInfoViewController.swift */, - DD141DEF2A56ABFD0091318F /* IntroduceBrandViewController.swift */, + 181EE5CB2B234E540043817F /* Mine */, + 181EE57D2B234C510043817F /* Custom */, + DDCE2A642A56BDB800E17751 /* Assets.xcassets */, + DD141DC62A56ABFD0091318F /* Main */, + 01B0A28E2816CF41009065C5 /* app.entitlements */, + 39E9E27528D87E9800A11820 /* Localizable.strings */, + 4B3B9BE4277AFEE50091A74E /* Main.storyboard */, + 4B3B9BE9277AFEE70091A74E /* LaunchScreen.storyboard */, ); - path = Controller; + path = app; sourceTree = ""; }; - DD141DF02A56ABFD0091318F /* View */ = { + BF083551FB71DB2F668919FB /* Pods */ = { isa = PBXGroup; children = ( - DD141DF12A56ABFD0091318F /* MineTableViewCell.swift */, - DD141DF22A56ABFD0091318F /* StyleSelectionCell.swift */, - DD141DF32A56ABFD0091318F /* BirthdayDatePickerView.swift */, - DD141DF42A56ABFD0091318F /* Theme */, - DD141DFA2A56ABFD0091318F /* NodeSelectCell.swift */, - DD141DFB2A56ABFD0091318F /* VersionCell.swift */, + 852A4E08916CBE74DF8872B0 /* Pods-app.debug.xcconfig */, + B7F66F12DB299173053C1C33 /* Pods-app.release.xcconfig */, ); - path = View; + path = Pods; sourceTree = ""; }; - DD141DF42A56ABFD0091318F /* Theme */ = { + DD141DC62A56ABFD0091318F /* Main */ = { isa = PBXGroup; children = ( - DD141DF52A56ABFD0091318F /* CustomTeamSettingRightCustomCell.swift */, - DD141DF62A56ABFD0091318F /* CustomTeamSettingSubtitleCell.swift */, - DD141DF72A56ABFD0091318F /* CustomTeamArrowSettingCell.swift */, - DD141DF82A56ABFD0091318F /* CustomTeamSettingHeaderCell.swift */, - DD141DF92A56ABFD0091318F /* CustomTeamSettingSwitchCell.swift */, + DD141DC82A56ABFD0091318F /* Constant.swift */, + DD141DC92A56ABFD0091318F /* ViewController.swift */, + DD141DCB2A56ABFD0091318F /* NENavigationController.swift */, + DD141DCD2A56ABFD0091318F /* UIStyleManager.swift */, + DD141DCF2A56ABFD0091318F /* AppDelegate.swift */, + DD141DD02A56ABFD0091318F /* NETabBarController.swift */, + DD141DD12A56ABFD0091318F /* AppKey.swift */, ); - path = Theme; + path = Main; sourceTree = ""; }; /* End PBXGroup section */ @@ -289,13 +289,13 @@ isa = PBXNativeTarget; buildConfigurationList = 4B3B9BEF277AFEE70091A74E /* Build configuration list for PBXNativeTarget "app" */; buildPhases = ( - 5F9B18A712AF519ACF5898F9 /* [CP] Check Pods Manifest.lock */, + F6BBE706AB53572CEA1E810B /* [CP] Check Pods Manifest.lock */, 4B3B9BD7277AFEE50091A74E /* Sources */, 4B3B9BD8277AFEE50091A74E /* Frameworks */, 4B3B9BD9277AFEE50091A74E /* Resources */, - 8293FFD3DEA5F5A02EBCD9D8 /* [CP] Embed Pods Frameworks */, 39722F9327998A14007BFC8B /* Embed Frameworks */, - E4AF30BDBA5D645CD8868D43 /* [CP] Copy Pods Resources */, + DDF8E1695FBE0EE8EC771C05 /* [CP] Embed Pods Frameworks */, + BCB7AB04958A9EAFB3582CAA /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -357,29 +357,24 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 5F9B18A712AF519ACF5898F9 /* [CP] Check Pods Manifest.lock */ = { + BCB7AB04958A9EAFB3582CAA /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-app/Pods-app-resources-${CONFIGURATION}-input-files.xcfilelist", ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; + name = "[CP] Copy Pods Resources"; outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-app-checkManifestLockResult.txt", + "${PODS_ROOT}/Target Support Files/Pods-app/Pods-app-resources-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-app/Pods-app-resources.sh\"\n"; showEnvVarsInLog = 0; }; - 8293FFD3DEA5F5A02EBCD9D8 /* [CP] Embed Pods Frameworks */ = { + DDF8E1695FBE0EE8EC771C05 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -396,21 +391,26 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-app/Pods-app-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - E4AF30BDBA5D645CD8868D43 /* [CP] Copy Pods Resources */ = { + F6BBE706AB53572CEA1E810B /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-app/Pods-app-resources-${CONFIGURATION}-input-files.xcfilelist", ); - name = "[CP] Copy Pods Resources"; + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-app/Pods-app-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-app-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-app/Pods-app-resources.sh\"\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -420,47 +420,47 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - DD141E1A2A56ABFE0091318F /* MineSettingViewController.swift in Sources */, - DD141E142A56ABFE0091318F /* IntroduceViewModel.swift in Sources */, - DD141E262A56ABFE0091318F /* CustomTeamSettingSwitchCell.swift in Sources */, - DD141E222A56ABFE0091318F /* CustomTeamSettingRightCustomCell.swift in Sources */, - DD141E062A56ABFE0091318F /* CustomP2PChatViewController.swift in Sources */, - DD141E092A56ABFE0091318F /* CustomConversationController.swift in Sources */, - DD141E1E2A56ABFE0091318F /* IntroduceBrandViewController.swift in Sources */, - DD141E182A56ABFE0091318F /* NELoginViewController.swift in Sources */, - DD141E202A56ABFE0091318F /* StyleSelectionCell.swift in Sources */, - DD141E1D2A56ABFE0091318F /* PersonInfoViewController.swift in Sources */, - DD141E162A56ABFE0091318F /* StyleSelectionViewController.swift in Sources */, + 181EE5EA2B234E540043817F /* NodeViewModel.swift in Sources */, + 181EE6032B234E540043817F /* VersionCell.swift in Sources */, + 181EE58D2B234C510043817F /* CustomContactTableViewCell.swift in Sources */, + 181EE5F82B234E540043817F /* ConfigTestViewController.swift in Sources */, + 181EE5ED2B234E540043817F /* MessageRemindViewModel.swift in Sources */, + 181EE5872B234C510043817F /* CustomView.swift in Sources */, + 181EE58F2B234C510043817F /* CustomConversationListCell.swift in Sources */, + 181EE5F32B234E540043817F /* InputPersonInfoController.swift in Sources */, + 181EE5FC2B234E540043817F /* BirthdayDatePickerView.swift in Sources */, + 181EE5882B234C510043817F /* CustomP2PChatViewController.swift in Sources */, + 181EE5F12B234E540043817F /* NEAboutWebViewController.swift in Sources */, + 181EE58E2B234C510043817F /* CustomChatCell.swift in Sources */, + 181EE5F02B234E540043817F /* StyleSelectionViewController.swift in Sources */, + 181EE5F42B234E540043817F /* MineSettingViewController.swift in Sources */, + 181EE5F22B234E540043817F /* NELoginViewController.swift in Sources */, DD141DFD2A56ABFE0091318F /* ViewController.swift in Sources */, - DD141E082A56ABFE0091318F /* CustomContactsViewController.swift in Sources */, - DD141E0B2A56ABFE0091318F /* CustomContactTableViewCell.swift in Sources */, - DD141E192A56ABFE0091318F /* InputPersonInfoController.swift in Sources */, DD141DFF2A56ABFE0091318F /* NENavigationController.swift in Sources */, - DD141E0C2A56ABFE0091318F /* CustomChatCell.swift in Sources */, - DD141E242A56ABFE0091318F /* CustomTeamArrowSettingCell.swift in Sources */, - DD141E0A2A56ABFE0091318F /* CustomAttachment.swift in Sources */, - DD141E172A56ABFE0091318F /* NEAboutWebViewController.swift in Sources */, - DD141E132A56ABFE0091318F /* MessageRemindViewModel.swift in Sources */, + 181EE5FF2B234E540043817F /* CustomTeamArrowSettingCell.swift in Sources */, + 181EE6002B234E540043817F /* CustomTeamSettingHeaderCell.swift in Sources */, DD141E032A56ABFE0091318F /* AppDelegate.swift in Sources */, - DD141E102A56ABFE0091318F /* NodeViewModel.swift in Sources */, - DD141E122A56ABFE0091318F /* PersonInfoViewModel.swift in Sources */, - DD141E1B2A56ABFE0091318F /* MessageRemindViewController.swift in Sources */, - DD141E282A56ABFE0091318F /* VersionCell.swift in Sources */, + 181EE58B2B234C510043817F /* CustomConversationController.swift in Sources */, + 181EE5F92B234E540043817F /* IntroduceBrandViewController.swift in Sources */, + 181EE58A2B234C510043817F /* CustomContactsViewController.swift in Sources */, + 181EE5F62B234E540043817F /* NENodeViewController.swift in Sources */, + 181EE5FB2B234E540043817F /* StyleSelectionCell.swift in Sources */, + 181EE5EB2B234E540043817F /* MineSettingViewModel.swift in Sources */, + 181EE58C2B234C510043817F /* CustomAttachment.swift in Sources */, DD141E052A56ABFE0091318F /* AppKey.swift in Sources */, - DD141E0D2A56ABFE0091318F /* CustomTopView.swift in Sources */, - DD141E232A56ABFE0091318F /* CustomTeamSettingSubtitleCell.swift in Sources */, - DD141E152A56ABFE0091318F /* MeViewController.swift in Sources */, - DD141E252A56ABFE0091318F /* CustomTeamSettingHeaderCell.swift in Sources */, - DD141E0E2A56ABFE0091318F /* CustomConversationListCell.swift in Sources */, + 181EE5EF2B234E540043817F /* MeViewController.swift in Sources */, + 181EE5FE2B234E540043817F /* CustomTeamSettingSubtitleCell.swift in Sources */, + 181EE6022B234E540043817F /* NodeSelectCell.swift in Sources */, DD141E012A56ABFE0091318F /* UIStyleManager.swift in Sources */, - DD141E212A56ABFE0091318F /* BirthdayDatePickerView.swift in Sources */, + 181EE5EE2B234E540043817F /* IntroduceViewModel.swift in Sources */, + 181EE5F72B234E540043817F /* PersonInfoViewController.swift in Sources */, DD141E042A56ABFE0091318F /* NETabBarController.swift in Sources */, - DD141E1C2A56ABFE0091318F /* NENodeViewController.swift in Sources */, - DD141E1F2A56ABFE0091318F /* MineTableViewCell.swift in Sources */, DD141DFC2A56ABFD0091318F /* Constant.swift in Sources */, - DD141E112A56ABFE0091318F /* MineSettingViewModel.swift in Sources */, - DD141E072A56ABFE0091318F /* CustomConversationListViewController.swift in Sources */, - DD141E272A56ABFE0091318F /* NodeSelectCell.swift in Sources */, + 181EE6012B234E540043817F /* CustomTeamSettingSwitchCell.swift in Sources */, + 181EE5F52B234E540043817F /* MessageRemindViewController.swift in Sources */, + 181EE5FD2B234E540043817F /* CustomTeamSettingRightCustomCell.swift in Sources */, + 181EE5FA2B234E540043817F /* MineTableViewCell.swift in Sources */, + 181EE5EC2B234E540043817F /* PersonInfoViewModel.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -621,7 +621,7 @@ }; 4B3B9BF0277AFEE70091A74E /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = B831F1EC5F2E309A7BB5582D /* Pods-app.debug.xcconfig */; + baseConfigurationReference = 852A4E08916CBE74DF8872B0 /* Pods-app.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; @@ -655,7 +655,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 9.6.3; + MARKETING_VERSION = 9.6.5; PRODUCT_BUNDLE_IDENTIFIER = com.netease.yunxin.app.im; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -670,7 +670,7 @@ }; 4B3B9BF1277AFEE70091A74E /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = A9E4316D70F3EF2E6BD5E5CB /* Pods-app.release.xcconfig */; + baseConfigurationReference = B7F66F12DB299173053C1C33 /* Pods-app.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; @@ -704,7 +704,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 9.6.3; + MARKETING_VERSION = 9.6.5; PRODUCT_BUNDLE_IDENTIFIER = com.netease.yunxin.app.im; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = inHouseYunxin; diff --git a/app/Custom/CustomAttachment.swift b/app/Custom/CustomAttachment.swift index b56b869e..602ed073 100644 --- a/app/Custom/CustomAttachment.swift +++ b/app/Custom/CustomAttachment.swift @@ -3,9 +3,9 @@ // Use of this source code is governed by a MIT license that can be // found in the LICENSE file. -import UIKit -import NIMSDK import NEChatUIKit +import NIMSDK +import UIKit public class CustomAttachment: NSObject, NIMCustomAttachment, NECustomAttachmentProtocol { public var customType: Int = 0 diff --git a/app/Custom/CustomChatCell.swift b/app/Custom/CustomChatCell.swift index f70da02b..e21c5024 100644 --- a/app/Custom/CustomChatCell.swift +++ b/app/Custom/CustomChatCell.swift @@ -1,9 +1,9 @@ -//// Copyright (c) 2022 NetEase, Inc. All rights reserved. +// 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 UIKit import NEChatUIKit +import UIKit class CustomChatCell: NEChatBaseCell { public var testLabel = UILabel() diff --git a/app/Custom/CustomContactTableViewCell.swift b/app/Custom/CustomContactTableViewCell.swift index ee4da8ff..cb95f899 100644 --- a/app/Custom/CustomContactTableViewCell.swift +++ b/app/Custom/CustomContactTableViewCell.swift @@ -1,4 +1,4 @@ -//// Copyright (c) 2022 NetEase, Inc. All rights reserved. +// 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. diff --git a/app/Custom/CustomContactsViewController.swift b/app/Custom/CustomContactsViewController.swift index be658e57..ca603bb1 100644 --- a/app/Custom/CustomContactsViewController.swift +++ b/app/Custom/CustomContactsViewController.swift @@ -1,15 +1,23 @@ -//// Copyright (c) 2022 NetEase, Inc. All rights reserved. +// 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 Foundation import NEContactUIKit -public class CustomContactsViewController: ContactsViewController, ContactsViewControllerDelegate { +public class CustomContactsViewController: ContactsViewController, NEBaseContactsViewControllerDelegate { override public init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { + /// 是否在通讯录界面显示头部模块 +// NEKitContactConfig.shared.ui.showHeader = false + + /// 通讯录列表头部模块的数据回调 + NEKitContactConfig.shared.ui.headerData = { headerData in + headerData[0].name = "收到的验证消息" + } + super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) delegate = self - customCells[ContactCellType.ContactCutom.rawValue] = CustomContactTableViewCell.self + cellRegisterDic[ContactCellType.ContactCutom.rawValue] = CustomContactTableViewCell.self } required init?(coder: NSCoder) { @@ -18,48 +26,122 @@ public class CustomContactsViewController: ContactsViewController, ContactsViewC override public func viewDidLoad() { // 通过配置项实现自定义 - configCustom() + customByConfig() + + // 通过重写实现自定义 + // customByOverread() super.viewDidLoad() - let view = UIView(frame: CGRect(x: 0, y: 0, width: NEConstant.screenWidth, height: 40)) - view.backgroundColor = .blue - topView.addSubview(view) } - func configCustom() { + func customByConfig() { + /* + UI 属性自定义 + */ + /// 头像圆角大小 - NEKitContactConfig.shared.ui.avatarCornerRadius = 4.0 + NEKitContactConfig.shared.ui.contactProperties.avatarCornerRadius = 4.0 /// 头像类型 - NEKitContactConfig.shared.ui.avatarType = .rectangle + NEKitContactConfig.shared.ui.contactProperties.avatarType = .rectangle + + // 标题栏文案 + NEKitContactConfig.shared.ui.title = "好友列表" + + /// 标题栏文案颜色 + NEKitContactConfig.shared.ui.titleColor = .purple + + // 通讯录好友标题大小 + NEKitContactConfig.shared.ui.contactProperties.itemTitleSize = 28 + + /// 通讯录好友标题颜色 + NEKitContactConfig.shared.ui.contactProperties.itemTitleColor = UIColor.red + + /// 是否展示标题栏 + NEKitContactConfig.shared.ui.showTitleBar = true + + /// 通讯录列表头部模块 cell 点击事件 + NEKitContactConfig.shared.ui.headerItemClick = { info, indexPath in + self.showToast("点击了头部模块中的第 \(indexPath.row) 个") + } - // 通讯录标题大小 - NEKitContactConfig.shared.ui.titleFont = .systemFont(ofSize: 28) + /// 通讯录列表好友 cell 点击事件 + NEKitContactConfig.shared.ui.friendItemClick = { info, indexPath in + self.showToast("点击了好友列表中的: \(info.user?.showName() ?? "")") + } + + /// 是否展示标题栏的次最右侧图标 + NEKitContactConfig.shared.ui.showTitleBarRight2Icon = true - /// 通讯录标题颜色 - NEKitContactConfig.shared.ui.titleColor = UIColor.red + /// 是否展示标题栏的最右侧图标 + NEKitContactConfig.shared.ui.showTitleBarRightIcon = true - /// 是否隐藏通讯录搜索按钮 - NEKitContactConfig.shared.ui.hiddenSearchBtn = true + /// 标题栏的最右侧图标 + NEKitContactConfig.shared.ui.titleBarRightRes = UIImage(named: "person") - /// 是否把顶部添加好友和搜索按钮都隐藏 - NEKitContactConfig.shared.ui.hiddenRightBtns = false + /// 标题栏的次最右侧图标 + NEKitContactConfig.shared.ui.titleBarRight2Res = UIImage(named: "contact") + + /// 标题栏最右侧按钮点击事件,如果已经通过继承方式重写该点击事件, 则本方式会被覆盖 + NEKitContactConfig.shared.ui.titleBarRightClick = { + print("addItemAction") + } + + /// 标题栏次最右侧按钮点击事件,如果已经通过继承方式重写该点击事件, 则本方式会被覆盖 + NEKitContactConfig.shared.ui.titleBarRight2Click = { + print("searchItemAction") + } /// 通讯录间隔线颜色 - NEKitContactConfig.shared.ui.divideLineColor = UIColor.blue + NEKitContactConfig.shared.ui.contactProperties.divideLineColor = UIColor.blue /// 检索标题字体颜色 - NEKitContactConfig.shared.ui.indexTitleColor = .green + NEKitContactConfig.shared.ui.contactProperties.indexTitleColor = .green + + /* + 布局自定义 + */ + /// 自定义界面UI接口,回调中会传入会话列表界面的UI布局,您可以进行UI元素调整。 + NEKitContactConfig.shared.ui.customController = { viewController in + // 更改导航栏背景色 + viewController.navigationView.backgroundColor = .gray + + // 顶部bodyTopView中添加自定义view(需要设置bodyTopView的高度) + self.customTopView.btn.setTitle("通过配置项添加", for: .normal) + viewController.bodyTopView.backgroundColor = .purple + viewController.bodyTopView.addSubview(self.customTopView) + viewController.bodyTopViewHeight = 80 + + // 底部bodyBottomView中添加自定义view(需要设置bodyBottomView的高度) + self.customBottomView.btn.setTitle("通过配置项添加", for: .normal) + viewController.bodyBottomView.backgroundColor = .purple + viewController.bodyBottomView.addSubview(self.customBottomView) + viewController.bodyBottomViewHeight = 60 + } } - @objc private func addItemAction() { - print("addItemAction") - topViewHeight = 80 + func customByOverread() { + // 顶部bodyTopView中添加自定义view(需要设置bodyTopView的高度) + customTopView.btn.setTitle("通过重写方式添加", for: .normal) + bodyTopView.addSubview(customTopView) + bodyTopViewHeight = 80 + + // 底部bodyBottomView中添加自定义view(需要设置bodyBottomView的高度) + customBottomView.btn.setTitle("通过重写方式添加", for: .normal) + bodyBottomView.addSubview(customBottomView) + bodyBottomViewHeight = 60 + } + + // 通过继承方式重写次最右侧按钮点击事件, 这种方式会覆盖配置项中的点击事件 + override public func searchAction() { + bodyTopViewHeight = 80 + bodyBottomViewHeight = 80 } - @objc private func searchItemAction() { - print("searchItemAction") - topViewHeight = 0 + // 通过继承方式重写最右侧按钮点击事件, 这种方式会覆盖配置项中的点击事件 + override public func didClickAddBtn() { + bodyTopViewHeight = 0 + bodyBottomViewHeight = 0 } public func onDataLoaded() { @@ -67,4 +149,18 @@ public class CustomContactsViewController: ContactsViewController, ContactsViewC info.contactCellType = ContactCellType.ContactCutom.rawValue } } + + // MARK: lazy load + + public lazy var customTopView: CustomView = { + let view = CustomView(frame: CGRect(x: 0, y: 10, width: NEConstant.screenWidth, height: 40)) + view.backgroundColor = .blue + return view + }() + + public lazy var customBottomView: CustomView = { + let view = CustomView(frame: CGRect(x: 0, y: 10, width: NEConstant.screenWidth, height: 40)) + view.backgroundColor = .green + return view + }() } diff --git a/app/Custom/CustomConversationController.swift b/app/Custom/CustomConversationController.swift index 2b188701..bb2867bf 100644 --- a/app/Custom/CustomConversationController.swift +++ b/app/Custom/CustomConversationController.swift @@ -1,14 +1,17 @@ -//// Copyright (c) 2022 NetEase, Inc. All rights reserved. +// 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 Foundation import NEConversationUIKit -open class CustomConversationController: ConversationController { +open class CustomConversationController: ConversationController, NEBaseConversationControllerDelegate { override public init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) - listCtrl = CustomConversationListViewController() + delegate = self + + // 自定义cell, [ConversationListModel.customType: 需要注册的自定义cell] + cellRegisterDic[1] = CustomConversationListCell.self } public required init?(coder: NSCoder) { @@ -17,90 +20,192 @@ open class CustomConversationController: ConversationController { override public func viewDidLoad() { // 通过配置项实现自定义 - configCustom() + customByConfig() - // 实现协议(重写tabbar点击事件) - navView.delegate = self + // 通过重写实现自定义 +// customByOverread() - // 自定义会话列表标题、图标、间距 - navView.brandBtn.setTitle("消息", for: .normal) - navView.brandBtn.setImage(nil, for: .normal) - navView.brandBtn.layoutButtonImage(style: .left, space: 0) + super.viewDidLoad() + } - // 自定义tabbar图标 - navView.addBtn.setImage(UIImage.ne_imageNamed(name: "noNeed_notify"), for: .normal) + // 通过配置项实现自定义(这种方式不需要继承就可以实现 UI 自定义) + open func customByConfig() { + /* + UI 属性自定义 + */ - // 顶部topView中添加自定义view(需要设置topView的高度) - let view = CustomTopView(frame: CGRect(x: 0, y: 0, width: NEConstant.screenWidth, height: 40)) - view.backgroundColor = .blue -// listCtrl.topViewHeight = 40 - listCtrl.topView.addSubview(view) + /// 头像圆角大小 + NEKitConversationConfig.shared.ui.conversationProperties.avatarCornerRadius = 4.0 - // 自定义占位图文案、背景图片 - listCtrl.emptyView.setEmptyImage(image: UIImage()) - listCtrl.emptyView.settingContent(content: "") + /// 头像类型 + NEKitConversationConfig.shared.ui.conversationProperties.avatarType = .rectangle - viewmodel.repo.clearAllUnreadCount() + /// 是否展示界面顶部的标题栏 + NEKitConversationConfig.shared.ui.showTitleBar = true - super.viewDidLoad() - } + /// 是否展示标题栏次最右侧图标 + NEKitConversationConfig.shared.ui.showTitleBarRight2Icon = true - open func configCustom() { - /// 头像圆角大小 - NEKitConversationConfig.shared.ui.avatarCornerRadius = 4.0 + /// 是否展示标题栏最右侧图标 + NEKitConversationConfig.shared.ui.showTitleBarRightIcon = true - /// 头像类型 - NEKitConversationConfig.shared.ui.avatarType = .rectangle + // 自定义会话列表标题、图标 + NEKitConversationConfig.shared.ui.titleBarTitle = "消息" + NEKitConversationConfig.shared.ui.titleBarTitleColor = .purple + NEKitConversationConfig.shared.ui.titleBarLeftRes = UIImage() - /// 是否隐藏导航栏 -// NEKitConversationConfig.shared.ui.hiddenNav = true + // 未被置顶的会话项的背景色 + NEKitConversationConfig.shared.ui.conversationProperties.itemBackground = .gray - /// 是否隐藏搜索按钮 - NEKitConversationConfig.shared.ui.hiddenSearchBtn = true + // 置顶的会话项的背景色 + NEKitConversationConfig.shared.ui.conversationProperties.itemStickTopBackground = .orange -// / 是否把顶部添加按钮和搜索按钮都隐藏 -// NEKitConversationConfig.shared.ui.hiddenRightBtns = true + // 主标题字体大小 + NEKitConversationConfig.shared.ui.conversationProperties.itemTitleSize = 24 // 主标题字体大小 - NEKitConversationConfig.shared.ui.titleFont = .systemFont(ofSize: 24) + NEKitConversationConfig.shared.ui.conversationProperties.itemTitleSize = 24 // 副标题字体大小 - NEKitConversationConfig.shared.ui.subTitleFont = .systemFont(ofSize: 18) + NEKitConversationConfig.shared.ui.conversationProperties.itemContentSize = 18 // 主标题字体颜色 - NEKitConversationConfig.shared.ui.titleColor = UIColor.red + NEKitConversationConfig.shared.ui.conversationProperties.itemTitleColor = UIColor.red // 副标题字体颜色 - NEKitConversationConfig.shared.ui.subTitleColor = UIColor.blue + NEKitConversationConfig.shared.ui.conversationProperties.itemContentColor = UIColor.blue /// 时间字体颜色 - NEKitConversationConfig.shared.ui.timeColor = UIColor.green + NEKitConversationConfig.shared.ui.conversationProperties.itemDateColor = UIColor.green /// 时间字体大小 - NEKitConversationConfig.shared.ui.timeFont = UIFont.systemFont(ofSize: 14) + NEKitConversationConfig.shared.ui.conversationProperties.itemDateSize = 14 /// 会话列表 cell 左划置顶按钮文案内容 - NEKitConversationConfig.shared.ui.stickTopBottonTitle = "文案" - /// 会话列表 cell 左划取消置顶按钮文案内容 - NEKitConversationConfig.shared.ui.stickTopBottonCancelTitle = "文案1" - /// 会话列表 cell 左划置顶按钮文案颜色 - NEKitConversationConfig.shared.ui.stickTopBottonColor = UIColor.yellow + NEKitConversationConfig.shared.ui.stickTopBottonTitle = "左侧" + /// 会话列表 cell 左划取消置顶按钮文案内容(会话置顶后生效) + NEKitConversationConfig.shared.ui.stickTopBottonCancelTitle = "左侧1" + /// 会话列表 cell 左划置顶按钮背景颜色 + NEKitConversationConfig.shared.ui.stickTopBottonBackgroundColor = UIColor.brown + /// 会话列表 cell 左划置顶按钮点击事件 + NEKitConversationConfig.shared.ui.stickTopBottonClick = { model, indexPath in + self.showToast("会话列表 cell 左划置顶按钮点击事件") + } /// 会话列表 cell 左划删除按钮文案内容 - NEKitConversationConfig.shared.ui.deleteBottonTitle = "文案2" - /// 会话列表 cell 左划删除按钮文案颜色 - NEKitConversationConfig.shared.ui.deleteBottonColor = UIColor.gray + NEKitConversationConfig.shared.ui.deleteBottonTitle = "右侧" + /// 会话列表 cell 左划删除按钮背景颜色 + NEKitConversationConfig.shared.ui.deleteBottonBackgroundColor = UIColor.purple + /// 会话列表 cell 左划删除按钮点击事件 + NEKitConversationConfig.shared.ui.deleteBottonClick = { model, indexPath in + self.showToast("会话列表 cell 左划删除按钮点击事件") + } + + /// 标题栏左侧按钮点击事件 + NEKitConversationConfig.shared.ui.titleBarLeftClick = { + self.showSingleAlert(message: "titleBarLeftClick") {} + } + + /// 标题栏最右侧按钮点击事件,如果已经通过继承方式重写该点击事件, 则本方式会被覆盖 + NEKitConversationConfig.shared.ui.titleBarRightClick = { + self.showToast("didClickAddBtn") + } + + /// 标题栏次最右侧按钮点击事件,如果已经通过继承方式重写该点击事件, 则本方式会被覆盖 + NEKitConversationConfig.shared.ui.titleBarRight2Click = { + self.showToast("didClickSearchBtn") + } + + /// 会话列表点击事件 + NEKitConversationConfig.shared.ui.itemClick = { model, indexPath in + self.showToast((model?.userInfo?.showName(true) ?? model?.teamInfo?.getShowName()) ?? "会话列表点击事件") + } + + /* + 布局自定义 + */ + /// 自定义界面UI接口,回调中会传入会话列表界面的UI布局,您可以进行UI元素调整。 + NEKitConversationConfig.shared.ui.customController = { viewController in + // 更改导航栏背景色 + viewController.navigationView.backgroundColor = .gray + + // 顶部bodyTopView中添加自定义view(需要设置bodyTopView的高度) + self.customTopView.btn.setTitle("通过配置项添加", for: .normal) + viewController.bodyTopView.backgroundColor = .purple + viewController.bodyTopView.addSubview(self.customTopView) + viewController.bodyTopViewHeight = 80 + + // 底部bodyBottomView中添加自定义view(需要设置bodyBottomView的高度) + self.customBottomView.btn.setTitle("通过配置项添加", for: .normal) + viewController.bodyBottomView.backgroundColor = .purple + viewController.bodyBottomView.addSubview(self.customBottomView) + viewController.bodyBottomViewHeight = 60 + } } - // 重写搜索按钮点击事件 + // 通过重写实现自定义布局(这种方式需要继承,拿到父类属性) + open func customByOverread() { + // 实现协议(重写tabbar点击事件) + navigationView.delegate = self + + // 顶部bodyTopView中添加自定义view(需要设置bodyTopView的高度) + customTopView.btn.setTitle("通过重写方式添加", for: .normal) + bodyTopView.addSubview(customTopView) + bodyTopViewHeight = 80 + + // 底部bodyBottomView中添加自定义view(需要设置bodyBottomView的高度) + customBottomView.btn.setTitle("通过重写方式添加", for: .normal) + bodyBottomView.addSubview(customBottomView) + bodyBottomViewHeight = 60 + + // 自定义占位图文案、背景图片 + emptyView.setEmptyImage(image: UIImage()) + emptyView.settingContent(content: "") + } + + // 通过继承方式重写次最右侧按钮点击事件, 这种方式会覆盖配置项中的点击事件 override open func searchAction() { - listCtrl.topViewHeight = 80 + bodyTopViewHeight = 80 + bodyBottomViewHeight = 80 } - // 重写添加按钮点击事件 + // 通过继承方式重写最右侧按钮点击事件, 这种方式会覆盖配置项中的点击事件 override open func didClickAddBtn() { - showSingleAlert(message: "override didClickAddBtn") { - self.listCtrl.topViewHeight = 0 + bodyTopViewHeight = 0 + bodyBottomViewHeight = 0 + } + + override open func deleteActionHandler(action: UITableViewRowAction?, indexPath: IndexPath) { + showSingleAlert(message: "override deleteActionHandler") {} + } + + override open func topActionHandler(action: UITableViewRowAction?, indexPath: IndexPath, isTop: Bool) { + showSingleAlert(message: "override topActionHandler") { + super.topActionHandler(action: action, indexPath: indexPath, isTop: isTop) + } + } + + // 可自行处理数据 + public func onDataLoaded() { + guard let conversationList = viewModel.conversationListArray else { return + } + conversationList.forEach { model in + model.customType = 1 } + tableView.reloadData() } + + // MARK: lazy load + + public lazy var customTopView: CustomView = { + let view = CustomView(frame: CGRect(x: 0, y: 10, width: NEConstant.screenWidth, height: 40)) + view.backgroundColor = .blue + return view + }() + + public lazy var customBottomView: CustomView = { + let view = CustomView(frame: CGRect(x: 0, y: 10, width: NEConstant.screenWidth, height: 40)) + view.backgroundColor = .green + return view + }() } diff --git a/app/Custom/CustomConversationListCell.swift b/app/Custom/CustomConversationListCell.swift index 1d171be7..afa64a91 100644 --- a/app/Custom/CustomConversationListCell.swift +++ b/app/Custom/CustomConversationListCell.swift @@ -3,8 +3,8 @@ // Use of this source code is governed by a MIT license that can be // found in the LICENSE file. -import UIKit import NEConversationUIKit +import UIKit open class CustomConversationListCell: ConversationListCell { private lazy var onlineView: UIImageView = { diff --git a/app/Custom/CustomConversationListViewController.swift b/app/Custom/CustomConversationListViewController.swift deleted file mode 100644 index 840bb128..00000000 --- a/app/Custom/CustomConversationListViewController.swift +++ /dev/null @@ -1,44 +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 Foundation -import NEConversationUIKit - -open class CustomConversationListViewController: ConversationListViewController, ConversationListViewControllerDelegate { - override public init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { - super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) - delegate = self - - // 自定义cell, [ConversationListModel.customType: 需要注册的自定义cell] - registerCellDic[1] = CustomConversationListCell.self - } - - public required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - override open func viewDidLoad() { - super.viewDidLoad() - } - - override open func deleteActionHandler(action: UITableViewRowAction?, indexPath: IndexPath) { - showSingleAlert(message: "override deleteActionHandler") {} - } - - override open func topActionHandler(action: UITableViewRowAction?, indexPath: IndexPath, isTop: Bool) { - showSingleAlert(message: "override topActionHandler") { - super.topActionHandler(action: action, indexPath: indexPath, isTop: isTop) - } - } - - // 可自行处理数据 - public func onDataLoaded() { - guard let conversationList = viewModel.conversationListArray else { return - } - conversationList.forEach { model in - model.customType = 1 - } - tableView.reloadData() - } -} diff --git a/app/Custom/CustomP2PChatViewController.swift b/app/Custom/CustomP2PChatViewController.swift index 6452dfa4..0e4c435b 100644 --- a/app/Custom/CustomP2PChatViewController.swift +++ b/app/Custom/CustomP2PChatViewController.swift @@ -1,163 +1,243 @@ -//// Copyright (c) 2022 NetEase, Inc. All rights reserved. +// 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 UIKit import NEChatUIKit import NIMSDK +import UIKit class CustomP2PChatViewController: P2PChatViewController { override func viewDidLoad() { -// NEKitChatConfig.shared.ui.avatarType = .rectangle -// NEKitChatConfig.shared.ui.avatarCornerRadius = 8.0 -// NEKitChatConfig.shared.ui.signalBgColor = UIColor.ne_backcolor -// NEKitChatConfig.shared.ui.selfMessageBg = UIColor.ne_greenText -// NEKitChatConfig.shared.ui.receiveMessageBg = UIColor.ne_greenText -// NEKitChatConfig.shared.ui.timeTextColor = UIColor.ne_redText -// NEKitChatConfig.shared.ui.timeTextSize = 18 -// NEKitChatConfig.shared.ui.userNickColor = UIColor.ne_redText -// NEKitChatConfig.shared.ui.userNickTextSize = 8.0 -// NEKitChatConfig.shared.ui.messageTextColor = UIColor.ne_redColor -// NEKitChatConfig.shared.ui.messageTextSize = UIFont.systemFont(ofSize: 12) -// NEKitChatConfig.shared.ui.rightBubbleBg = UIImage(named: "copy_right") -// NEKitChatConfig.shared.ui.leftBubbleBg = UIImage(named: "copy_right") -// NEKitChatConfig.shared.ui.showP2pMessageStatus = false -// NEKitChatConfig.shared.ui.showTeamMessageStatus = false -// NEKitChatConfig.shared.ui.showTitleBar = false -// NEKitChatConfig.shared.ui.showTitleBarRightIcon = false -// NEKitChatConfig.shared.ui.titleBarRightRes = UIImage(named: "copy_right") -// NEKitChatConfig.shared.ui.titleBarRightClick = {[weak self] in -// self?.showToast("dfnaskfnas") -// } -// NEKitChatConfig.shared.ui.chatViewBackground = UIColor.ne_redText - - /* - // 聊天面板外部扩展示例 - // 新增未知类型 - let itemNew = NEMoreItemModel() - itemNew.customImage = UIImage(named: "mine_collection") - itemNew.customDelegate = self - itemNew.action = #selector(testLog) - itemNew.title = "新增" - NEChatUIKitClient.instance.moreAction.append(itemNew) - - // 覆盖已有类型 - // 遍历 NEChatUIKitClient.instance.moreAction, 根据type 覆盖已有类型 - for (i, item) in NEChatUIKitClient.instance.moreAction.enumerated() { - if item.type == .rtc { - let itemReplace = NEChatUIKitClient.instance.moreAction[i] - itemReplace.customImage = UIImage(named: "mine_setting") - itemReplace.customDelegate = self - itemReplace.action = #selector(testLog) - itemReplace.type = .rtc - itemReplace.title = "覆盖" - } - } - - // 移除已有类型 - // 遍历 NEChatUIKitClient.instance.moreAction, 根据type 移除已有类型 - for (i, item) in NEChatUIKitClient.instance.moreAction.enumerated() { - if item.type == .file { - NEChatUIKitClient.instance.moreAction.remove(at: i) - } - } - @objc func testLog() { - print("聊天面板外部扩展示例") + // 自定义消息以及外部扩展 覆盖cell UI 样式示例 +// customMessage() + + // 通过配置项实现自定义 + customByConfig() + + // 通过重写实现自定义 +// customByOverread() + + super.viewDidLoad() + } + + /// 通过配置项实现 UI 自定义 + func customByConfig() { +// NEKitChatConfig.shared.ui.messageProperties.avatarType = .rectangle +// NEKitChatConfig.shared.ui.messageProperties.avatarCornerRadius = 8.0 +// NEKitChatConfig.shared.ui.messageProperties.signalBgColor = UIColor.ne_backcolor +// NEKitChatConfig.shared.ui.messageProperties.selfMessageBg = UIColor.ne_greenText +// NEKitChatConfig.shared.ui.messageProperties.receiveMessageBg = UIColor.ne_greenText +// NEKitChatConfig.shared.ui.messageProperties.timeTextColor = UIColor.ne_redText +// NEKitChatConfig.shared.ui.messageProperties.timeTextSize = 18 +// NEKitChatConfig.shared.ui.messageProperties.userNickColor = UIColor.ne_redText +// NEKitChatConfig.shared.ui.messageProperties.userNickTextSize = 8.0 +// NEKitChatConfig.shared.ui.messageProperties.messageTextColor = UIColor.ne_redColor +// NEKitChatConfig.shared.ui.messageProperties.messageTextSize = 12 +// NEKitChatConfig.shared.ui.messageProperties.rightBubbleBg = UIImage(named: "copy_right") +// NEKitChatConfig.shared.ui.messageProperties.leftBubbleBg = UIImage(named: "copy_right") +// NEKitChatConfig.shared.ui.messageProperties.showP2pMessageStatus = false +// NEKitChatConfig.shared.ui.messageProperties.showTeamMessageStatus = false +// NEKitChatConfig.shared.ui.messageProperties.showTitleBar = false +// NEKitChatConfig.shared.ui.messageProperties.showTitleBarRightIcon = false +// NEKitChatConfig.shared.ui.messageProperties.titleBarRightRes = UIImage(named: "copy_right") +// NEKitChatConfig.shared.ui.messageProperties.titleBarRightClick = { [weak self] in +// self?.showToast("标题栏右侧图标的点击事件") +// } +// NEKitChatConfig.shared.ui.messageProperties.chatViewBackground = UIColor.ne_redText + + NEKitChatConfig.shared.ui.messageItemClick = { [weak self] cell, model in + self?.showToast("点击了消息: \(String(describing: model?.message?.text))") + } + + /// 文本输入框下方 tab 按钮定制 + NEKitChatConfig.shared.ui.chatInputBar = { [weak self] item in + // 修改 + let takePicBtn = item[2] + takePicBtn.setImage(nil, for: .normal) + takePicBtn.setTitle("拍照", for: .normal) + takePicBtn.setTitleColor(.blue, for: .normal) + takePicBtn.removeTarget(takePicBtn.superview, action: nil, for: .allEvents) + takePicBtn.addTarget(self, action: #selector(self?.customClick), for: .touchUpInside) + + // 新增 + let button = UIButton(type: .custom) + button.setTitle("新增", for: .normal) + button.setTitleColor(.blue, for: .normal) + button.addTarget(self, action: #selector(self?.customClick), for: .touchUpInside) + item.append(button) + } + + /// 【更多】区域功能列表自定义示例 + NEKitChatConfig.shared.ui.chatInputMenu = { [weak self] menuList in + // 新增未知类型 + let itemNew = NEMoreItemModel() + itemNew.customImage = UIImage(named: "mine_collection") + itemNew.customDelegate = self + itemNew.action = #selector(self?.customClick) + itemNew.title = "新增" + menuList.append(itemNew) + + // 覆盖已有类型 + // 遍历 menuList, 根据type 覆盖已有类型 + for item in menuList { + if item.type == .rtc { + item.customImage = UIImage(named: "mine_setting") + item.customDelegate = self + item.action = #selector(self?.customClick) + item.type = .rtc + item.title = "覆盖" } + } - */ + // 移除已有类型 + // 遍历 menuList, 根据type 移除已有类型 + for (i, item) in menuList.enumerated() { + if item.type == .file { + menuList.remove(at: i) + } + } + } - // 输入框上区域扩展视图示例 - /* - inputTopExtendHeight = 20 - let topCustom = UIView() - topCustom.translatesAutoresizingMaskIntoConstraints = false - topCustom.backgroundColor = UIColor.yellow - inputTopExtendView.addSubview(topCustom) - NSLayoutConstraint.activate([ - topCustom.leftAnchor.constraint(equalTo: inputTopExtendView.leftAnchor), - topCustom.rightAnchor.constraint(equalTo: inputTopExtendView.rightAnchor), - topCustom.topAnchor.constraint(equalTo: inputTopExtendView.topAnchor), - topCustom.bottomAnchor.constraint(equalTo: inputTopExtendView.bottomAnchor) - ]) - */ + /// 消息长按弹出菜单自定义 + NEKitChatConfig.shared.ui.chatPopMenu = { menuList, model in + // 遍历 menuList, 根据 type 覆盖已有类型 + // 将所有文本消息的【复制】替换成【粘贴】 + if model?.type == .text { + for item in menuList { + if item.type == .copy { + item.text = "粘贴" + } + } + } + } - // 聊天页顶部导航栏下方扩展视图示例 - /* - navigationBarBottomExtendHeight = 20 - let bottomCustom = UIView() - bottomCustom.translatesAutoresizingMaskIntoConstraints = false - bottomCustom.backgroundColor = UIColor.yellow - navigationBarBottomExtendView.addSubview(bottomCustom) - NSLayoutConstraint.activate([ - bottomCustom.leftAnchor.constraint(equalTo: navigationBarBottomExtendView.leftAnchor), - bottomCustom.rightAnchor.constraint(equalTo: navigationBarBottomExtendView.rightAnchor), - bottomCustom.topAnchor.constraint(equalTo: navigationBarBottomExtendView.topAnchor), - bottomCustom.bottomAnchor.constraint(equalTo: navigationBarBottomExtendView.bottomAnchor), - ]) */ + /// 消息长按弹出菜单点击事件回调,根据按钮类型进行区分 + NEKitChatConfig.shared.ui.popMenuClick = { [weak self] item in + switch item.type { + case .copy: + // 更改【复制】类型按钮的点击事件 + self?.customClick() + default: + break + } + } - // 自定义消息以及外部扩展 覆盖cell UI 样式示例 - // 注册自定义消息的解析器 - /* - NIMCustomObject.registerCustomDecoder(CustomAttachmentDecoder()) - NEChatUIKitClient.instance.regsiterCustomCell(["20": CustomChatCell.self]) - - // 测试自定义消息发送按钮 - let testBtn = UIButton() - testBtn.translatesAutoresizingMaskIntoConstraints = false - view.addSubview(testBtn) - NSLayoutConstraint.activate([ - testBtn.widthAnchor.constraint(equalToConstant: 100), - testBtn.heightAnchor.constraint(equalToConstant: 40), - testBtn.centerXAnchor.constraint(equalTo: view.centerXAnchor), - testBtn.centerYAnchor.constraint(equalTo: view.centerYAnchor), - ]) - testBtn.backgroundColor = UIColor.red - testBtn.addTarget(self, action: #selector(sendCustomButton), for: .touchUpInside) - */ + /// 消息列表的视图控制器回调,回调中会返回消息列表的视图控制器 + NEKitChatConfig.shared.ui.customController = { viewController in + // 更改导航栏背景色 + viewController.navigationView.backgroundColor = .gray - super.viewDidLoad() + // 顶部bodyTopView中添加自定义view(需要设置bodyTopView的高度) + self.customTopView.btn.setTitle("通过配置项添加", for: .normal) + viewController.bodyTopView.backgroundColor = .purple + viewController.bodyTopView.addSubview(self.customTopView) + viewController.bodyTopViewHeight = 80 + + // 底部bodyBottomView中添加自定义view(需要设置bodyBottomView的高度) + self.customBottomView.btn.setTitle("通过配置项添加", for: .normal) + viewController.bodyBottomView.backgroundColor = .purple + viewController.bodyBottomView.addSubview(self.customBottomView) + viewController.bodyBottomViewHeight = 60 + } + } + + /// 通过重写实现自定义 + func customByOverread() { + // 聊天页顶部导航栏下方扩展视图示例 + customTopView.btn.setTitle("通过重写方式添加", for: .normal) + bodyTopView.addSubview(customTopView) + bodyTopView.backgroundColor = .yellow + bodyTopViewHeight = 80 + + // 输入框上区域扩展视图示例 + customBottomView.btn.setTitle("通过重写方式添加", for: .normal) + bodyBottomView.addSubview(customBottomView) + bodyBottomView.backgroundColor = .yellow + bodyBottomViewHeight = 60 // 聊天页输入框左右间距自定义 - /* - menuView.textviewLeftConstraint?.constant = 100 - menuView.textviewRightConstraint?.constant = -100 - */ + chatInputView.textviewLeftConstraint?.constant = 100 + chatInputView.textviewRightConstraint?.constant = -100 // 自定义底部工具条(未点击更多状态) - /* - customBottomBar() - */ + customBottomBar() // 长按消息功能弹窗过滤列表(过滤列表中的能力会在整个页面中禁用) - /* - operationCellFilter = [.delete, .copy] - */ + operationCellFilter = [.delete, .copy] - // Do any additional setup after loading the view. + /// 【更多】区域功能列表自定义示例 + + // 新增未知类型 + let itemNew = NEMoreItemModel() + itemNew.customImage = UIImage(named: "mine_collection") + itemNew.customDelegate = self + itemNew.action = #selector(customClick) + itemNew.title = "新增" + NEChatUIKitClient.instance.moreAction.append(itemNew) + + // 覆盖已有类型 + // 遍历 NEChatUIKitClient.instance.moreAction, 根据type 覆盖已有类型 + for (i, item) in NEChatUIKitClient.instance.moreAction.enumerated() { + if item.type == .rtc { + let itemReplace = NEChatUIKitClient.instance.moreAction[i] + itemReplace.customImage = UIImage(named: "mine_setting") + itemReplace.customDelegate = self + itemReplace.action = #selector(customClick) + itemReplace.type = .rtc + itemReplace.title = "覆盖" + } + } + + // 移除已有类型 + // 遍历 NEChatUIKitClient.instance.moreAction, 根据type 移除已有类型 + for (i, item) in NEChatUIKitClient.instance.moreAction.enumerated() { + if item.type == .file { + NEChatUIKitClient.instance.moreAction.remove(at: i) + } + } + } + + /// 自定义消息以及外部扩展 覆盖cell UI 样式示例 + func customMessage() { + // 注册自定义消息的解析器 + NIMCustomObject.registerCustomDecoder(CustomAttachmentDecoder()) + NEChatUIKitClient.instance.regsiterCustomCell(["20": CustomChatCell.self]) + + // 测试自定义消息发送按钮 + let testBtn = UIButton() + testBtn.translatesAutoresizingMaskIntoConstraints = false + view.addSubview(testBtn) + NSLayoutConstraint.activate([ + testBtn.widthAnchor.constraint(equalToConstant: 100), + testBtn.heightAnchor.constraint(equalToConstant: 40), + testBtn.centerXAnchor.constraint(equalTo: view.centerXAnchor), + testBtn.centerYAnchor.constraint(equalTo: view.centerYAnchor), + ]) + testBtn.backgroundColor = UIColor.red + testBtn.addTarget(self, action: #selector(sendCustomButton), for: .touchUpInside) } // 自定义标题 -// override func getSessionInfo(session: NIMSession) { -// super.getSessionInfo(session: session) -// title = "小易助手" -// } + // override func getSessionInfo(session: NIMSession) { + // super.getSessionInfo(session: session) + // title = "小易助手" + // } // 长按消息功能弹窗列表自定义(可针对不同 type 消息自定义长按功能项) -// override func setOperationItems(items: inout [OperationItem], model: MessageContentModel?) { -// if model?.type == .rtcCallRecord { -// items.append(OperationItem.deleteItem()) -// } -// } + // override func setOperationItems(items: inout [OperationItem], model: MessageContentModel?) { + // if model?.type == .rtcCallRecord { + // items.append(OperationItem.deleteItem()) + // } + // } - @objc func testLog() { - print("聊天面板外部扩展示例") + @objc func customClick() { + showToast("自定义点击事件") } func customBottomBar() { - let subviews = menuView.stackView.subviews + let subviews = chatInputView.stackView.subviews subviews.forEach { view in view.removeFromSuperview() - menuView.stackView.removeArrangedSubview(view) + chatInputView.stackView.removeArrangedSubview(view) } let titles = ["表情", "语音", "照片", "更多"] @@ -169,22 +249,22 @@ class CustomP2PChatViewController: P2PChatViewController { button.tag = i button.setTitle(title, for: .normal) button.setTitleColor(.blue, for: .normal) - menuView.stackView.addArrangedSubview(button) + chatInputView.stackView.addArrangedSubview(button) } } @objc func buttonEvent(_ btn: UIButton) { if btn.tag == 0 { // 表情 layoutInputView(offset: bottomExanpndHeight) - menuView.addEmojiView() + chatInputView.addEmojiView() } else if btn.tag == 1 { // 语音 layoutInputView(offset: bottomExanpndHeight) - menuView.addRecordView() + chatInputView.addRecordView() } else if btn.tag == 2 { // 照片 goPhotoAlbumWithVideo(self) } else if btn.tag == 3 { // 更多 layoutInputView(offset: bottomExanpndHeight) - menuView.addMoreActionView() + chatInputView.addMoreActionView() } } @@ -202,13 +282,17 @@ class CustomP2PChatViewController: P2PChatViewController { } } - /* - // MARK: - Navigation + // MARK: lazy load + + public lazy var customTopView: CustomView = { + let view = CustomView(frame: CGRect(x: 0, y: 10, width: NEConstant.screenWidth, height: 40)) + view.backgroundColor = .blue + return view + }() - // 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. - } - */ + public lazy var customBottomView: CustomView = { + let view = CustomView(frame: CGRect(x: 0, y: 10, width: NEConstant.screenWidth, height: 40)) + view.backgroundColor = .green + return view + }() } diff --git a/app/Custom/CustomTopView.swift b/app/Custom/CustomView.swift similarity index 60% rename from app/Custom/CustomTopView.swift rename to app/Custom/CustomView.swift index c52747f6..71cd2b0b 100644 --- a/app/Custom/CustomTopView.swift +++ b/app/Custom/CustomView.swift @@ -1,25 +1,24 @@ -//// Copyright (c) 2022 NetEase, Inc. All rights reserved. +// 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 Foundation import UIKit -public class CustomTopView: UIView { +public class CustomView: UIView { + public let btn = UIButton() + override public init(frame: CGRect) { super.init(frame: frame) -// let tap = UITapGestureRecognizer(target: self, action: #selector(tapView)) -// addGestureRecognizer(tap) - let btn = UIButton() btn.translatesAutoresizingMaskIntoConstraints = false btn.addTarget(self, action: #selector(tapView), for: .touchUpInside) + btn.setTitle("按钮", for: .normal) btn.backgroundColor = .red addSubview(btn) NSLayoutConstraint.activate([ btn.topAnchor.constraint(equalTo: topAnchor), - btn.leftAnchor.constraint(equalTo: leftAnchor), - btn.rightAnchor.constraint(equalTo: rightAnchor), btn.bottomAnchor.constraint(equalTo: bottomAnchor), + btn.widthAnchor.constraint(equalToConstant: 200), + btn.centerXAnchor.constraint(equalTo: centerXAnchor), ]) } @@ -27,5 +26,7 @@ public class CustomTopView: UIView { fatalError("init(coder:) has not been implemented") } - @objc func tapView() {} + @objc func tapView() { + print("点击了自定义按钮") + } } diff --git a/app/Mine/Controller/ConfigTestViewController.swift b/app/Mine/Controller/ConfigTestViewController.swift new file mode 100644 index 00000000..3300c4bf --- /dev/null +++ b/app/Mine/Controller/ConfigTestViewController.swift @@ -0,0 +1,163 @@ + +// 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 NEChatUIKit +import NECoreKit +import NETeamUIKit +import UIKit + +class ConfigTestViewController: NEBaseViewController, UITableViewDelegate, + UITableViewDataSource { + public var cellClassDic = + [SettingCellType.SettingSwitchCell.rawValue: CustomTeamSettingSwitchCell.self] + var sectionData = [SettingSectionModel]() + + override func viewDidLoad() { + super.viewDidLoad() + sectionData.append(getSectionData()) + setupSubviews() + initialConfig() + } + + func getSectionData() -> SettingSectionModel { + let model = SettingSectionModel() + + let useSysNav = SettingCellModel() + useSysNav.cellName = "使用系统导航栏" + useSysNav.type = SettingCellType.SettingSwitchCell.rawValue + useSysNav.switchOpen = NEConfigManager.instance.getParameter(key: useSystemNav) as? Bool ?? false + useSysNav.swichChange = { isOpen in + NEConfigManager.instance.setParameter(key: useSystemNav, value: isOpen) + } + model.cellModels.append(useSysNav) + + let showTeam = SettingCellModel() + showTeam.cellName = "显示群聊" + showTeam.type = SettingCellType.SettingSwitchCell.rawValue + showTeam.switchOpen = IMKitClient.instance.getConfigCenter().teamEnable + showTeam.swichChange = { isOpen in + IMKitClient.instance.getConfigCenter().teamEnable = isOpen + } + model.cellModels.append(showTeam) + + model.setCornerType() + return model + } + + func initialConfig() { + title = "配置测试页" + if NEStyleManager.instance.isNormalStyle() { + view.backgroundColor = .ne_backgroundColor + navigationView.backgroundColor = .ne_backgroundColor + navigationController?.navigationBar.backgroundColor = .ne_backgroundColor + navigationView.moreButton.setTitleColor(.ne_greyText, for: .normal) + } else { + view.backgroundColor = .funChatBackgroundColor + navigationView.moreButton.setTitleColor(.funChatThemeColor, for: .normal) + } + } + + func setupSubviews() { + addRightAction("保存", #selector(saveConfig), self) + navigationView.moreButton.isHidden = false + navigationView.setMoreButtonTitle("保存") + navigationView.addMoreButtonTarget(target: self, selector: #selector(saveConfig)) + + let tipLabel = UILabel() + tipLabel.translatesAutoresizingMaskIntoConstraints = false + tipLabel.text = "点击保存生效" + tipLabel.textColor = .ne_greyText + tipLabel.font = UIFont.systemFont(ofSize: 14) + tipLabel.textAlignment = .center + view.addSubview(tipLabel) + NSLayoutConstraint.activate([ + tipLabel.leftAnchor.constraint(equalTo: view.leftAnchor), + tipLabel.rightAnchor.constraint(equalTo: view.rightAnchor), + tipLabel.topAnchor.constraint(equalTo: view.topAnchor, constant: NEConstant.navigationAndStatusHeight), + tipLabel.heightAnchor.constraint(equalToConstant: 20), + ]) + + view.addSubview(tableView) + NSLayoutConstraint.activate([ + tableView.leftAnchor.constraint(equalTo: view.leftAnchor), + tableView.rightAnchor.constraint(equalTo: view.rightAnchor), + tableView.topAnchor.constraint(equalTo: tipLabel.bottomAnchor), + tableView.bottomAnchor.constraint(equalTo: view.bottomAnchor), + ]) + + cellClassDic.forEach { (key: Int, value: NEBaseTeamSettingCell.Type) in + tableView.register(value, forCellReuseIdentifier: "\(key)") + } + } + + lazy var tableView: UITableView = { + let table = UITableView() + table.translatesAutoresizingMaskIntoConstraints = false + table.backgroundColor = .clear + table.dataSource = self + table.delegate = self + table.separatorColor = .clear + table.separatorStyle = .none + table.sectionHeaderHeight = 12.0 + if #available(iOS 15.0, *) { + table.sectionHeaderTopPadding = 0.0 + } + return table + }() + + @objc func saveConfig() { + NotificationCenter.default.post( + name: Notification.Name(CHANGE_UI), + object: nil + ) + } + + // MARK: UITableViewDelegate, UITableViewDataSource + + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + if sectionData.count > section { + let model = sectionData[section] + return model.cellModels.count + } + return 0 + } + + func numberOfSections(in tableView: UITableView) -> Int { + sectionData.count + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let model = sectionData[indexPath.section].cellModels[indexPath.row] + if let cell = tableView.dequeueReusableCell( + withIdentifier: "\(model.type)", + for: indexPath + ) as? NEBaseTeamSettingCell { + cell.configure(model) + return cell + } + return UITableViewCell() + } + + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { + let model = sectionData[indexPath.section].cellModels[indexPath.row] + return model.rowHeight + } + + func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { + if sectionData.count > section { + let model = sectionData[section] + if model.cellModels.count > 0 { + return 12.0 + } + } + return 0 + } + + func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { + let header = UIView() + header.backgroundColor = .ne_lightBackgroundColor + return header + } +} diff --git a/app/Mine/Controller/InputPersonInfoController.swift b/app/Mine/Controller/InputPersonInfoController.swift index 3e40695c..1871cd0b 100644 --- a/app/Mine/Controller/InputPersonInfoController.swift +++ b/app/Mine/Controller/InputPersonInfoController.swift @@ -3,9 +3,9 @@ // Use of this source code is governed by a MIT license that can be // found in the LICENSE file. -import UIKit -import NECoreKit import NEChatUIKit +import NECoreKit +import UIKit public enum EditType: Int { case nickName = 0 @@ -42,7 +42,7 @@ class InputPersonInfoController: NEBaseViewController, UITextFieldDelegate { NSLayoutConstraint.activate([ textfieldBgView.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 20.0), textfieldBgView.rightAnchor.constraint(equalTo: view.rightAnchor, constant: -20), - textfieldBgView.topAnchor.constraint(equalTo: view.topAnchor, constant: 12 + kNavigationHeight + KStatusBarHeight), + textfieldBgView.topAnchor.constraint(equalTo: view.topAnchor, constant: 12 + topConstant), textfieldBgView.heightAnchor.constraint(equalToConstant: 50), ]) @@ -50,7 +50,7 @@ class InputPersonInfoController: NEBaseViewController, UITextFieldDelegate { NSLayoutConstraint.activate([ textfieldBgView.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 0), textfieldBgView.rightAnchor.constraint(equalTo: view.rightAnchor, constant: 0), - textfieldBgView.topAnchor.constraint(equalTo: view.topAnchor, constant: 12 + kNavigationHeight + KStatusBarHeight), + textfieldBgView.topAnchor.constraint(equalTo: view.topAnchor, constant: 12 + topConstant), textfieldBgView.heightAnchor.constraint(equalToConstant: 50), ]) textfieldBgView.layer.cornerRadius = 0 @@ -66,18 +66,18 @@ class InputPersonInfoController: NEBaseViewController, UITextFieldDelegate { addRightAction(NSLocalizedString("save", comment: ""), #selector(saveName), self) view.backgroundColor = NEStyleManager.instance.isNormalStyle() ? UIColor(hexString: "#EFF1F4") : UIColor(hexString: "#EDEDED") - customNavigationView.setMoreButtonTitle(NSLocalizedString("save", comment: "")) - customNavigationView.addMoreButtonTarget(target: self, selector: #selector(saveName)) + navigationView.setMoreButtonTitle(NSLocalizedString("save", comment: "")) + navigationView.addMoreButtonTarget(target: self, selector: #selector(saveName)) if NEStyleManager.instance.isNormalStyle() { view.backgroundColor = .ne_backgroundColor - customNavigationView.backgroundColor = .ne_backgroundColor + navigationView.backgroundColor = .ne_backgroundColor navigationController?.navigationBar.backgroundColor = .ne_backgroundColor - customNavigationView.moreButton.setTitleColor(.ne_greyText, for: .normal) + navigationView.moreButton.setTitleColor(.ne_greyText, for: .normal) } else { view.backgroundColor = .funChatBackgroundColor - customNavigationView.moreButton.setTitleColor(.funChatThemeColor, for: .normal) - customNavigationView.moreButton.titleLabel?.font = .systemFont(ofSize: 17) + navigationView.moreButton.setTitleColor(.funChatThemeColor, for: .normal) + navigationView.moreButton.titleLabel?.font = .systemFont(ofSize: 17) } } @@ -102,10 +102,11 @@ class InputPersonInfoController: NEBaseViewController, UITextFieldDelegate { case .cellphone: title = NSLocalizedString("phone", comment: "") limitNumberCount = 11 - textField.keyboardType = .numberPad + textField.keyboardType = .phonePad case .email: title = NSLocalizedString("email", comment: "") limitNumberCount = 30 + textField.keyboardType = .emailAddress case .specialSign: title = NSLocalizedString("individuality_sign", comment: "") limitNumberCount = 50 @@ -122,6 +123,10 @@ class InputPersonInfoController: NEBaseViewController, UITextFieldDelegate { text.delegate = self text.clearButtonMode = .always text.addTarget(self, action: #selector(textFieldChange), for: .editingChanged) + if let clearButton = text.value(forKey: "_clearButton") as? UIButton { + clearButton.accessibilityIdentifier = "id.clear" + } + text.accessibilityIdentifier = "id.nickname" return text }() diff --git a/app/Mine/Controller/IntroduceBrandViewController.swift b/app/Mine/Controller/IntroduceBrandViewController.swift index 74d80d8c..31c3c438 100644 --- a/app/Mine/Controller/IntroduceBrandViewController.swift +++ b/app/Mine/Controller/IntroduceBrandViewController.swift @@ -2,10 +2,10 @@ // Use of this source code is governed by a MIT license that can be // found in the LICENSE file. -import UIKit +import NEChatUIKit import NECoreKit import NETeamUIKit -import NEChatUIKit +import UIKit class IntroduceBrandViewController: NEBaseViewController, UITableViewDelegate, UITableViewDataSource { @@ -22,13 +22,13 @@ class IntroduceBrandViewController: NEBaseViewController, UITableViewDelegate, view.addSubview(headLabel) view.addSubview(tableView) navigationController?.navigationBar.backgroundColor = .white - customNavigationView.backgroundColor = .white + navigationView.backgroundColor = .white NSLayoutConstraint.activate([ headImage.centerXAnchor.constraint(equalTo: view.centerXAnchor), headImage.topAnchor.constraint( equalTo: view.topAnchor, - constant: kNavigationHeight + KStatusBarHeight + 20 + constant: topConstant + 20 ), headImage.widthAnchor.constraint(equalToConstant: 72), headImage.heightAnchor.constraint(equalToConstant: 53), @@ -52,6 +52,7 @@ class IntroduceBrandViewController: NEBaseViewController, UITableViewDelegate, private lazy var headImage: UIImageView = { let image = UIImageView(image: UIImage(named: "yunxin_logo")) image.translatesAutoresizingMaskIntoConstraints = false + image.accessibilityIdentifier = "id.aboutLogo" return image }() @@ -61,6 +62,7 @@ class IntroduceBrandViewController: NEBaseViewController, UITableViewDelegate, label.text = NSLocalizedString("brand_des", comment: "") label.font = UIFont.systemFont(ofSize: 20.0) label.textColor = UIColor(hexString: "333333") + label.accessibilityIdentifier = "id.aboutApp" return label }() diff --git a/app/Mine/Controller/MeViewController.swift b/app/Mine/Controller/MeViewController.swift index 17ef0ad9..65bea16f 100644 --- a/app/Mine/Controller/MeViewController.swift +++ b/app/Mine/Controller/MeViewController.swift @@ -3,12 +3,12 @@ // Use of this source code is governed by a MIT license that can be // found in the LICENSE file. -import UIKit -import YXLogin +import NECommonUIKit +import NECoreIMKit import NECoreKit import NIMSDK -import NECoreIMKit -import NECommonUIKit +import UIKit +import YXLogin class MeViewController: UIViewController { private let mineData = [ @@ -22,6 +22,7 @@ class MeViewController: UIViewController { let view = UIView(frame: .zero) view.translatesAutoresizingMaskIntoConstraints = false view.backgroundColor = .white + view.accessibilityIdentifier = "id.avatar" return view }() @@ -37,6 +38,7 @@ class MeViewController: UIViewController { name.textColor = .ne_darkText name.font = UIFont.systemFont(ofSize: 22.0) name.translatesAutoresizingMaskIntoConstraints = false + name.accessibilityIdentifier = "id.name" return name }() @@ -45,6 +47,7 @@ class MeViewController: UIViewController { label.textColor = .ne_darkText label.font = UIFont.systemFont(ofSize: 16.0) label.translatesAutoresizingMaskIntoConstraints = false + label.accessibilityIdentifier = "id.account" return label }() @@ -150,7 +153,7 @@ class MeViewController: UIViewController { } func updateUserInfo() { - let user = userProvider.getUserInfo(userId: IMKitClient.instance.imAccid) + let user = userProvider.getUserInfo(userId: IMKitClient.instance.imAccid()) idLabel.text = "\(NSLocalizedString("account", comment: "")):\(user?.userId ?? "")" nameLabel.text = user?.showName(false) header.configHeadData(headUrl: user?.userInfo?.avatarUrl, @@ -176,6 +179,7 @@ class MeViewController: UIViewController { private lazy var arrow: UIImageView = { let imageView = UIImageView(image: UIImage(named: "arrow_right")) imageView.translatesAutoresizingMaskIntoConstraints = false + imageView.accessibilityIdentifier = "id.rightArrow" return imageView }() @@ -199,12 +203,15 @@ extension MeViewController: UITableViewDelegate, UITableViewDataSource { public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - let cell = tableView.dequeueReusableCell( + if let cell = tableView.dequeueReusableCell( withIdentifier: "\(NSStringFromClass(MineTableViewCell.self))", for: indexPath - ) as! MineTableViewCell - cell.configCell(data: mineData[indexPath.row]) - return cell + ) as? MineTableViewCell { + let cellTitle = mineData[indexPath.row] + cell.configCell(data: cellTitle) + return cell + } + return MineTableViewCell() } public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { diff --git a/app/Mine/Controller/MessageRemindViewController.swift b/app/Mine/Controller/MessageRemindViewController.swift index a5537f24..c0bad2dd 100644 --- a/app/Mine/Controller/MessageRemindViewController.swift +++ b/app/Mine/Controller/MessageRemindViewController.swift @@ -3,10 +3,10 @@ // Use of this source code is governed by a MIT license that can be // found in the LICENSE file. -import UIKit +import NEChatUIKit import NECoreKit import NETeamUIKit -import NEChatUIKit +import UIKit class MessageRemindViewController: NEBaseViewController, UITableViewDelegate, UITableViewDataSource { @@ -25,7 +25,7 @@ class MessageRemindViewController: NEBaseViewController, UITableViewDelegate, title = NSLocalizedString("message_remind", comment: "") if NEStyleManager.instance.isNormalStyle() { view.backgroundColor = .ne_backgroundColor - customNavigationView.backgroundColor = .ne_backgroundColor + navigationView.backgroundColor = .ne_backgroundColor navigationController?.navigationBar.backgroundColor = .ne_backgroundColor } else { view.backgroundColor = .funChatBackgroundColor diff --git a/app/Mine/Controller/MineSettingViewController.swift b/app/Mine/Controller/MineSettingViewController.swift index a61a3a76..05b8ddb9 100644 --- a/app/Mine/Controller/MineSettingViewController.swift +++ b/app/Mine/Controller/MineSettingViewController.swift @@ -3,11 +3,11 @@ // Use of this source code is governed by a MIT license that can be // found in the LICENSE file. -import UIKit import NECoreKit import NETeamUIKit -import YXLogin import NIMSDK +import UIKit +import YXLogin class MineSettingViewController: NEBaseViewController, UITableViewDataSource, UITableViewDelegate { private var viewModel = MineSettingViewModel() @@ -20,14 +20,6 @@ class MineSettingViewController: NEBaseViewController, UITableViewDataSource, UI override func viewDidLoad() { super.viewDidLoad() - if userDefault.value(forKey: "HandSetModeKey") == nil { - SettingProvider.shared.setHandSetMode(true) - } - - if userDefault.value(forKey: "MessageHasRead") == nil { - SettingProvider.shared.setMessageRead(true) - } - viewModel.delegate = self viewModel.getData() setupSubviews() @@ -39,7 +31,7 @@ class MineSettingViewController: NEBaseViewController, UITableViewDataSource, UI if NEStyleManager.instance.isNormalStyle() { view.backgroundColor = .ne_backgroundColor - customNavigationView.backgroundColor = .ne_backgroundColor + navigationView.backgroundColor = .ne_backgroundColor navigationController?.navigationBar.backgroundColor = .ne_backgroundColor } else { view.backgroundColor = .funChatBackgroundColor @@ -89,7 +81,7 @@ class MineSettingViewController: NEBaseViewController, UITableViewDataSource, UI button.setTitle(title, for: .normal) button.addTarget(self, action: #selector(loginOutAction), for: .touchUpInside) button.setTitle(NSLocalizedString("logout", comment: ""), for: .normal) - + button.accessibilityIdentifier = "id.logout" if NEStyleManager.instance.isNormalStyle() { button.layer.cornerRadius = 8.0 button.frame = CGRect(x: 20, y: 12, width: view.frame.size.width - 40, height: 40) @@ -113,25 +105,26 @@ class MineSettingViewController: NEBaseViewController, UITableViewDataSource, UI withCompletion: { [weak self] user, error in if error != nil { self?.view.makeToast(error?.localizedDescription) - } else { - weak var weakSelf = self - NotificationCenter.default.post( - name: Notification.Name("logout"), - object: nil + NELog.errorLog( + self?.tag ?? "", + desc: "CALLBACK logout failed,error = \(error!)" ) - IMKitEngine.instance.logout { error in - if error == nil { - NIMSDK.shared().qchatManager.logout { chatError in - if chatError != nil { - self?.view.makeToast(chatError?.localizedDescription) - } else { - print("logout success") - } - } - } else { + } else { + IMKitClient.instance.logout { error in + if error != nil { + self?.view.makeToast(error?.localizedDescription) NELog.errorLog( - weakSelf?.tag ?? "", - desc: "❌CALLBACK logout failed,error = \(error!)" + self?.tag ?? "", + desc: "CALLBACK logout failed,error = \(error!)" + ) + } else { + NotificationCenter.default.post( + name: Notification.Name("logout"), + object: nil + ) + NELog.infoLog( + self?.tag ?? "", + desc: "CALLBACK logout SUCCESS" ) } } @@ -217,4 +210,9 @@ extension MineSettingViewController: MineSettingViewModelDelegate { } func didClickCleanCache() {} + + func didClickConfigTest() { + let configTestVC = ConfigTestViewController() + navigationController?.pushViewController(configTestVC, animated: true) + } } diff --git a/app/Mine/Controller/NEAboutWebViewController.swift b/app/Mine/Controller/NEAboutWebViewController.swift index eebbc59c..402e6f0a 100644 --- a/app/Mine/Controller/NEAboutWebViewController.swift +++ b/app/Mine/Controller/NEAboutWebViewController.swift @@ -3,10 +3,10 @@ // Use of this source code is governed by a MIT license that can be // found in the LICENSE file. -import UIKit +import NECommonUIKit import NECoreKit +import UIKit import WebKit -import NECommonUIKit class NEAboutWebViewController: NEBaseViewController { private var loadUrl: String = "" @@ -27,7 +27,7 @@ class NEAboutWebViewController: NEBaseViewController { func setUpSubViews() { title = NSLocalizedString("product_intro", comment: "") - customNavigationView.backgroundColor = .white + navigationView.backgroundColor = .white navigationController?.navigationBar.backgroundColor = .white guard let requestUrl = URL(string: loadUrl) else { diff --git a/app/Mine/Controller/NENodeViewController.swift b/app/Mine/Controller/NENodeViewController.swift index ab97a43c..22539d8c 100644 --- a/app/Mine/Controller/NENodeViewController.swift +++ b/app/Mine/Controller/NENodeViewController.swift @@ -3,9 +3,9 @@ // Use of this source code is governed by a MIT license that can be // found in the LICENSE file. -import UIKit import NECoreKit import NETeamUIKit +import UIKit class NENodeViewController: NEBaseViewController, UITableViewDataSource, UITableViewDelegate { private var viewModel = NodeViewModel() @@ -46,7 +46,7 @@ class NENodeViewController: NEBaseViewController, UITableViewDataSource, UITable alertController.addAction(cancelAction) let sureAction = UIAlertAction(title: NSLocalizedString("restart", comment: ""), style: .default) { action in // 设置节点 - IMKitClient.instance.repo.setNodeValue(isDomestic) + IMKitClient.instance.getSettingRepo().setNodeValue(isDomestic) exit(0) } alertController.addAction(sureAction) diff --git a/app/Mine/Controller/PersonInfoViewController.swift b/app/Mine/Controller/PersonInfoViewController.swift index b1ec2fab..8e79511a 100644 --- a/app/Mine/Controller/PersonInfoViewController.swift +++ b/app/Mine/Controller/PersonInfoViewController.swift @@ -2,11 +2,11 @@ // Use of this source code is governed by a MIT license that can be // found in the LICENSE file. -import UIKit +import NEChatUIKit import NECoreKit import NETeamUIKit -import NEChatUIKit import NIMSDK +import UIKit @objcMembers class PersonInfoViewController: NEBaseViewController, NIMUserManagerDelegate, @@ -29,11 +29,11 @@ class PersonInfoViewController: NEBaseViewController, NIMUserManagerDelegate, func initialConfig() { title = NSLocalizedString("person_info", comment: "") - customNavigationView.navTitle.text = title + navigationView.navTitle.text = title if NEStyleManager.instance.isNormalStyle() { view.backgroundColor = .ne_backgroundColor - customNavigationView.backgroundColor = .ne_backgroundColor + navigationView.backgroundColor = .ne_backgroundColor navigationController?.navigationBar.backgroundColor = .ne_backgroundColor } else { view.backgroundColor = .funChatBackgroundColor @@ -68,16 +68,19 @@ class PersonInfoViewController: NEBaseViewController, NIMUserManagerDelegate, selectValue(0) } first.setValue(UIColor(hexString: "0x333333"), forKey: "_titleTextColor") + first.accessibilityIdentifier = "id.action1" let second = UIAlertAction(title: secondContent, style: .default) { action in selectValue(1) } second.setValue(UIColor(hexString: "0x333333"), forKey: "_titleTextColor") + second.accessibilityIdentifier = "id.action2" let cancel = UIAlertAction(title: NSLocalizedString("cancel", comment: ""), style: .cancel) cancel.setValue(UIColor(hexString: "0x333333"), forKey: "_titleTextColor") + cancel.accessibilityIdentifier = "id.action3" alert.addAction(first) alert.addAction(second) @@ -151,7 +154,7 @@ class PersonInfoViewController: NEBaseViewController, NIMUserManagerDelegate, // MARK: NIMUserManagerDelegate func onUserInfoChanged(_ user: NIMUser) { - if user.userId == IMKitClient.instance.imAccid { + if user.userId == IMKitClient.instance.imAccid() { viewModel.getData() tableView.reloadData() } @@ -177,7 +180,7 @@ class PersonInfoViewController: NEBaseViewController, NIMUserManagerDelegate, view.makeToastActivity(.center) if let imageData = image.jpegData(compressionQuality: 0.6) as NSData? { let filePath = NSHomeDirectory().appending("/Documents/") - .appending(IMKitClient.instance.imAccid) + .appending(IMKitClient.instance.imAccid()) let succcess = imageData.write(toFile: filePath, atomically: true) if succcess { NIMSDK.shared().resourceManager diff --git a/app/Mine/Controller/StyleSelectionViewController.swift b/app/Mine/Controller/StyleSelectionViewController.swift index 1a84a933..21124fd5 100644 --- a/app/Mine/Controller/StyleSelectionViewController.swift +++ b/app/Mine/Controller/StyleSelectionViewController.swift @@ -2,11 +2,11 @@ // Use of this source code is governed by a MIT license that can be // found in the LICENSE file. -import UIKit -import NECoreKit import NECommonKit import NECommonUIKit import NEConversationUIKit +import NECoreKit +import UIKit open class StyleCellModel: NSObject { public var styleName: String @@ -57,7 +57,7 @@ open class StyleSelectionViewController: NEBaseViewController, UICollectionViewD if NEStyleManager.instance.isNormalStyle() { view.backgroundColor = .ne_backgroundColor - customNavigationView.backgroundColor = .ne_backgroundColor + navigationView.backgroundColor = .ne_backgroundColor navigationController?.navigationBar.backgroundColor = .ne_backgroundColor } else { view.backgroundColor = .funChatBackgroundColor diff --git a/app/Mine/View/BirthdayDatePickerView.swift b/app/Mine/View/BirthdayDatePickerView.swift index 5867a251..907717d5 100644 --- a/app/Mine/View/BirthdayDatePickerView.swift +++ b/app/Mine/View/BirthdayDatePickerView.swift @@ -3,8 +3,8 @@ // Use of this source code is governed by a MIT license that can be // found in the LICENSE file. -import UIKit import NECommonUIKit +import UIKit public class BirthdayDatePickerView: UIView { private var selectTime: String? @@ -17,7 +17,7 @@ public class BirthdayDatePickerView: UIView { button.setTitle(NSLocalizedString("cancel", comment: ""), for: .normal) button.setTitleColor(UIColor.ne_blueText, for: .normal) button.titleLabel?.font = UIFont.systemFont(ofSize: 14) - + button.addTarget(self, action: #selector(removeFromSuperview), for: .touchUpInside) return button }() diff --git a/app/Mine/View/MineTableViewCell.swift b/app/Mine/View/MineTableViewCell.swift index 17467dd1..b3d712b7 100644 --- a/app/Mine/View/MineTableViewCell.swift +++ b/app/Mine/View/MineTableViewCell.swift @@ -3,8 +3,8 @@ // Use of this source code is governed by a MIT license that can be // found in the LICENSE file. -import UIKit import NECommonUIKit +import UIKit public class MineTableViewCell: UITableViewCell { // override func awakeFromNib() { @@ -81,6 +81,7 @@ public class MineTableViewCell: UITableViewCell { name.textColor = UIColor.ne_darkText name.font = UIFont.systemFont(ofSize: 16.0) name.text = NSLocalizedString("setting", comment: "") + name.accessibilityIdentifier = "id.titleLabel" return name }() diff --git a/app/Mine/View/NodeSelectCell.swift b/app/Mine/View/NodeSelectCell.swift index cef006f9..62bc3b96 100644 --- a/app/Mine/View/NodeSelectCell.swift +++ b/app/Mine/View/NodeSelectCell.swift @@ -3,8 +3,8 @@ // Use of this source code is governed by a MIT license that can be // found in the LICENSE file. -import UIKit import NETeamUIKit +import UIKit class NodeSelectCell: CornerCell { override func awakeFromNib() { diff --git a/app/Mine/View/Theme/CustomTeamArrowSettingCell.swift b/app/Mine/View/Theme/CustomTeamArrowSettingCell.swift index 4c9b5ced..064b08c6 100644 --- a/app/Mine/View/Theme/CustomTeamArrowSettingCell.swift +++ b/app/Mine/View/Theme/CustomTeamArrowSettingCell.swift @@ -1,9 +1,9 @@ -//// Copyright (c) 2022 NetEase, Inc. All rights reserved. +// 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 UIKit import NETeamUIKit +import UIKit class CustomTeamArrowSettingCell: TeamArrowSettingCell { override func setupUI() { diff --git a/app/Mine/View/Theme/CustomTeamSettingHeaderCell.swift b/app/Mine/View/Theme/CustomTeamSettingHeaderCell.swift index 26f5d910..1e716cd6 100644 --- a/app/Mine/View/Theme/CustomTeamSettingHeaderCell.swift +++ b/app/Mine/View/Theme/CustomTeamSettingHeaderCell.swift @@ -1,9 +1,9 @@ -//// Copyright (c) 2022 NetEase, Inc. All rights reserved. +// 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 UIKit import NETeamUIKit +import UIKit class CustomTeamSettingHeaderCell: TeamSettingHeaderCell { override func setupUI() { diff --git a/app/Mine/View/Theme/CustomTeamSettingRightCustomCell.swift b/app/Mine/View/Theme/CustomTeamSettingRightCustomCell.swift index e254caa8..051aba0b 100644 --- a/app/Mine/View/Theme/CustomTeamSettingRightCustomCell.swift +++ b/app/Mine/View/Theme/CustomTeamSettingRightCustomCell.swift @@ -1,9 +1,9 @@ -//// Copyright (c) 2022 NetEase, Inc. All rights reserved. +// 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 UIKit import NETeamUIKit +import UIKit class CustomTeamSettingRightCustomCell: TeamSettingRightCustomCell { override func setupUI() { diff --git a/app/Mine/View/Theme/CustomTeamSettingSubtitleCell.swift b/app/Mine/View/Theme/CustomTeamSettingSubtitleCell.swift index d8b35ed0..98e3cfb1 100644 --- a/app/Mine/View/Theme/CustomTeamSettingSubtitleCell.swift +++ b/app/Mine/View/Theme/CustomTeamSettingSubtitleCell.swift @@ -1,9 +1,9 @@ -//// Copyright (c) 2022 NetEase, Inc. All rights reserved. +// 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 UIKit import NETeamUIKit +import UIKit class CustomTeamSettingSubtitleCell: TeamSettingSubtitleCell { override func setupUI() { diff --git a/app/Mine/View/Theme/CustomTeamSettingSwitchCell.swift b/app/Mine/View/Theme/CustomTeamSettingSwitchCell.swift index d7466456..d383fc1e 100644 --- a/app/Mine/View/Theme/CustomTeamSettingSwitchCell.swift +++ b/app/Mine/View/Theme/CustomTeamSettingSwitchCell.swift @@ -1,9 +1,9 @@ -//// Copyright (c) 2022 NetEase, Inc. All rights reserved. +// 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 UIKit import NETeamUIKit +import UIKit class CustomTeamSettingSwitchCell: TeamSettingSwitchCell { override func setupUI() { diff --git a/app/Mine/View/VersionCell.swift b/app/Mine/View/VersionCell.swift index 8404f62c..9a799576 100644 --- a/app/Mine/View/VersionCell.swift +++ b/app/Mine/View/VersionCell.swift @@ -3,8 +3,8 @@ // Use of this source code is governed by a MIT license that can be // found in the LICENSE file. -import UIKit import NETeamUIKit +import UIKit enum IntroduceCellType: Int { case version = 0 @@ -93,6 +93,7 @@ class VersionCell: UITableViewCell { label.textColor = UIColor(hexString: "0x333333") label.font = UIFont.systemFont(ofSize: 14) label.isHidden = true + label.accessibilityIdentifier = "id.version" return label }() diff --git a/app/Mine/ViewModel/MessageRemindViewModel.swift b/app/Mine/ViewModel/MessageRemindViewModel.swift index 154ff535..169f66dc 100644 --- a/app/Mine/ViewModel/MessageRemindViewModel.swift +++ b/app/Mine/ViewModel/MessageRemindViewModel.swift @@ -10,7 +10,7 @@ import NETeamUIKit public class MessageRemindViewModel: NSObject { var sectionData = [SettingSectionModel]() - let repo = SettingRepo() + let repo = SettingRepo.shared func getData() { sectionData.append(getFirstSection()) @@ -21,15 +21,19 @@ public class MessageRemindViewModel: NSObject { private func getFirstSection() -> SettingSectionModel { let model = SettingSectionModel() weak var weakSelf = self + + // 新消息通知 let messageNotify = SettingCellModel() messageNotify.cellName = NSLocalizedString("new_message_remind", comment: "") messageNotify.type = SettingCellType.SettingSwitchCell.rawValue - messageNotify.cornerType = .topLeft.union(.topRight).union(.bottomLeft).union(.bottomRight) messageNotify.switchOpen = repo.getPushEnable() messageNotify.swichChange = { isOpen in weakSelf?.repo.setPushEnable(isOpen) } - model.cellModels.append(contentsOf: [messageNotify]) + model.cellModels.append(contentsOf: [ + messageNotify, // 新消息通知 + ]) + model.setCornerType() return model } @@ -39,7 +43,6 @@ public class MessageRemindViewModel: NSObject { let ringBellItem = SettingCellModel() ringBellItem.cellName = NSLocalizedString("ring_mode", comment: "") ringBellItem.type = SettingCellType.SettingSwitchCell.rawValue - ringBellItem.cornerType = .topLeft.union(.topRight) ringBellItem.switchOpen = repo.getRingMode() ringBellItem.swichChange = { isOpen in weakSelf?.repo.setRingMode(isOpen) @@ -48,12 +51,15 @@ public class MessageRemindViewModel: NSObject { let vibrationItem = SettingCellModel() vibrationItem.cellName = NSLocalizedString("vibration_mode", comment: "") vibrationItem.type = SettingCellType.SettingSwitchCell.rawValue - vibrationItem.cornerType = .bottomLeft.union(.bottomRight) vibrationItem.switchOpen = repo.getVibrateMode() vibrationItem.swichChange = { isOpen in weakSelf?.repo.setVibrateMode(isOpen) } - model.cellModels.append(contentsOf: [ringBellItem, vibrationItem]) + model.cellModels.append(contentsOf: [ + ringBellItem, + vibrationItem, + ]) + model.setCornerType() return model } @@ -63,7 +69,6 @@ public class MessageRemindViewModel: NSObject { // let receiveItem = SettingCellModel() // receiveItem.cellName = NSLocalizedString("syn_receive_push", comment: "") // receiveItem.type = SettingCellType.SettingSwitchCell.rawValue -// receiveItem.cornerType = .topLeft.union(.topRight) // receiveItem.switchOpen = repo.getPcWebPushEnable() // receiveItem.swichChange = { isOpen in // weakSelf?.repo.updatePcWebPushEnable(isOpen) @@ -72,14 +77,13 @@ public class MessageRemindViewModel: NSObject { let messageDetailItem = SettingCellModel() messageDetailItem.cellName = NSLocalizedString("display_message_detail", comment: "") messageDetailItem.type = SettingCellType.SettingSwitchCell.rawValue -// messageDetailItem.cornerType = .bottomLeft.union(.bottomRight) - messageDetailItem.cornerType = .topLeft.union(.topRight).union(.bottomLeft).union(.bottomRight) messageDetailItem.switchOpen = repo.getPushShowDetail() messageDetailItem.swichChange = { isOpen in weakSelf?.repo.setPushShowDetail(isOpen) } model.cellModels.append(contentsOf: [messageDetailItem]) + model.setCornerType() return model } } diff --git a/app/Mine/ViewModel/MineSettingViewModel.swift b/app/Mine/ViewModel/MineSettingViewModel.swift index da8a5c14..9b38538d 100644 --- a/app/Mine/ViewModel/MineSettingViewModel.swift +++ b/app/Mine/ViewModel/MineSettingViewModel.swift @@ -10,6 +10,7 @@ public protocol MineSettingViewModelDelegate: NSObjectProtocol { func didMessageRemindClick() func didStyleClick() func didClickCleanCache() + func didClickConfigTest() } @objcMembers @@ -30,8 +31,6 @@ public class MineSettingViewModel: NSObject { let remind = SettingCellModel() remind.cellName = NSLocalizedString("message_remind", comment: "") remind.type = SettingCellType.SettingArrowCell.rawValue - remind.cornerType = .topLeft.union(.topRight) -// remind.cornerType = .topLeft.union(.topRight).union(.bottomLeft).union(.bottomRight) remind.cellClick = { weakSelf?.delegate?.didMessageRemindClick() } @@ -41,7 +40,6 @@ public class MineSettingViewModel: NSObject { let style = SettingCellModel() style.cellName = NSLocalizedString("style_selection", comment: "") style.type = SettingCellType.SettingArrowCell.rawValue - style.cornerType = .bottomLeft.union(.bottomRight) style.cellClick = { weakSelf?.delegate?.didStyleClick() } @@ -50,12 +48,22 @@ public class MineSettingViewModel: NSObject { // let cleanCache = SettingCellModel() // cleanCache.cellName = "清理缓存" // cleanCache.type = SettingCellType.SettingArrowCell.rawValue -// cleanCache.cornerType = .bottomLeft.union(.bottomRight) // cleanCache.cellClick = { // weakSelf?.delegate?.didClickCleanCache() // } // model.cellModels.append(cleanCache) + #if DEBUG + let configTest = SettingCellModel() + configTest.cellName = "配置测试页" + configTest.type = SettingCellType.SettingArrowCell.rawValue + configTest.cellClick = { + weakSelf?.delegate?.didClickConfigTest() + } + model.cellModels.append(configTest) + #endif + + model.setCornerType() return model } @@ -65,12 +73,11 @@ public class MineSettingViewModel: NSObject { let receiverModel = SettingCellModel() receiverModel.cellName = NSLocalizedString("receiver_mode", comment: "") receiverModel.type = SettingCellType.SettingSwitchCell.rawValue - receiverModel.cornerType = .topLeft.union(.topRight) // receiverModel.switchOpen = CoreKitEngine.instance.repo.getHandSetMode() - receiverModel.switchOpen = IMKitEngine.instance.repo.getHandsetMode() + receiverModel.switchOpen = IMKitClient.instance.getSettingRepo().getHandsetMode() receiverModel.swichChange = { isOpen in - IMKitEngine.instance.repo.setHandsetMode(isOpen) + IMKitClient.instance.getSettingRepo().setHandsetMode(isOpen) } // //过滤通知 // let filterNotify = SettingCellModel() @@ -86,23 +93,26 @@ public class MineSettingViewModel: NSObject { // let deleteFriend = SettingCellModel() // deleteFriend.cellName = NSLocalizedString("delete_friend", comment: "") // deleteFriend.type = SettingCellType.SettingSwitchCell.rawValue -// deleteFriend.switchOpen = IMKitEngine.instance.repo.getDeleteFriendAlias() +// deleteFriend.switchOpen = IMKitClient.instance.getSettingRepo().getDeleteFriendAlias() // // deleteFriend.swichChange = { isOpen in -// IMKitEngine.instance.repo.setDeleteFriendAlias(isOpen) +// IMKitClient.instance.getSettingRepo().setDeleteFriendAlias(isOpen) // } // 消息已读未读功能 let hasRead = SettingCellModel() hasRead.cellName = NSLocalizedString("message_read_function", comment: "") hasRead.type = SettingCellType.SettingSwitchCell.rawValue - hasRead.cornerType = .bottomLeft.union(.bottomRight) // hasRead.switchOpen = true - hasRead.switchOpen = IMKitEngine.instance.repo.getShowReadStatus() + hasRead.switchOpen = IMKitClient.instance.getSettingRepo().getShowReadStatus() hasRead.swichChange = { isOpen in - IMKitEngine.instance.repo.setShowReadStatus(isOpen) + IMKitClient.instance.getSettingRepo().setShowReadStatus(isOpen) } - model.cellModels.append(contentsOf: [receiverModel, hasRead]) + model.cellModels.append(contentsOf: [ + receiverModel, // 听筒模式 + hasRead, // 消息已读未读功能 + ]) + model.setCornerType() return model } } diff --git a/app/Mine/ViewModel/NodeViewModel.swift b/app/Mine/ViewModel/NodeViewModel.swift index cd36dfc7..e8989c75 100644 --- a/app/Mine/ViewModel/NodeViewModel.swift +++ b/app/Mine/ViewModel/NodeViewModel.swift @@ -3,8 +3,8 @@ // Use of this source code is governed by a MIT license that can be // found in the LICENSE file. -import UIKit import NETeamUIKit +import UIKit class NodeViewModel: NSObject { var sectionData = [SettingSectionModel]() @@ -18,18 +18,20 @@ class NodeViewModel: NSObject { // 国内节点配置 let home = SettingCellModel() home.subTitle = NSLocalizedString("domestic_node", comment: "") - home.cornerType = .topLeft.union(.topRight) home.rowHeight = 44.0 - home.switchOpen = IMKitClient.instance.repo.getNodeValue() == true ? true : false + home.switchOpen = IMKitClient.instance.getSettingRepo().getNodeValue() == true ? true : false // 海外节点配置 let overseas = SettingCellModel() overseas.subTitle = NSLocalizedString("overseas_node", comment: "") - overseas.cornerType = .bottomLeft.union(.bottomRight) - overseas.switchOpen = IMKitClient.instance.repo.getNodeValue() == true ? false : true + overseas.switchOpen = IMKitClient.instance.getSettingRepo().getNodeValue() == true ? false : true overseas.rowHeight = 44.0 - model.cellModels.append(contentsOf: [home, overseas]) + model.cellModels.append(contentsOf: [ + home, // 国内节点配置 + overseas, // 海外节点配置 + ]) + model.setCornerType() return model } } diff --git a/app/Mine/ViewModel/PersonInfoViewModel.swift b/app/Mine/ViewModel/PersonInfoViewModel.swift index d9cae709..c213c7ab 100644 --- a/app/Mine/ViewModel/PersonInfoViewModel.swift +++ b/app/Mine/ViewModel/PersonInfoViewModel.swift @@ -29,7 +29,7 @@ public class PersonInfoViewModel: NSObject { func getData() { sectionData.removeAll() - userInfo = userProvider.getUserInfo(userId: IMKitEngine.instance.imAccid) + userInfo = userProvider.getUserInfo(userId: IMKitClient.instance.imAccid()) sectionData.append(getFirstSection()) sectionData.append(getSecondSection()) } @@ -43,7 +43,6 @@ public class PersonInfoViewModel: NSObject { weak var weakSelf = self let headImageItem = SettingCellModel() - headImageItem.cornerType = .topLeft.union(.topRight) headImageItem.type = SettingCellType.SettingHeaderCell.rawValue headImageItem.cellName = NSLocalizedString("headImage", comment: "") headImageItem.headerUrl = userInfo?.userInfo?.avatarUrl @@ -96,7 +95,7 @@ public class PersonInfoViewModel: NSObject { // 生日 let birthdayItem = SettingCellModel() birthdayItem.type = SettingCellType.SettingSubtitleCell.rawValue - birthdayItem.cellName = NSLocalizedString("birehday", comment: "") + birthdayItem.cellName = NSLocalizedString("birthday", comment: "") birthdayItem.subTitle = mineInfo.userInfo?.birth birthdayItem.rowHeight = 46.0 birthdayItem.cellClick = { @@ -117,7 +116,6 @@ public class PersonInfoViewModel: NSObject { emailItem.type = SettingCellType.SettingSubtitleCell.rawValue emailItem.cellName = NSLocalizedString("email", comment: "") emailItem.subTitle = mineInfo.userInfo?.email - emailItem.cornerType = .bottomLeft.union(.bottomRight) emailItem.rowHeight = 46.0 emailItem.cellClick = { weakSelf?.delegate?.didClickEmail(email: emailItem.subTitle ?? "") @@ -131,6 +129,7 @@ public class PersonInfoViewModel: NSObject { telephoneItem, emailItem, ]) + model.setCornerType() return model } @@ -146,12 +145,12 @@ public class PersonInfoViewModel: NSObject { signItem.subTitle = mineInfo.userInfo?.sign signItem.rowHeight = 46.0 signItem.titleWidth = 64 - signItem.cornerType = .topLeft.union(.topRight).union(.bottomLeft).union(.bottomRight) weak var weakSelf = self signItem.cellClick = { weakSelf?.delegate?.didClickSign(sign: signItem.subTitle ?? "") } model.cellModels.append(contentsOf: [signItem]) + model.setCornerType() return model }